MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  cshfn Structured version   Visualization version   GIF version

Theorem cshfn 14152
Description: Perform a cyclical shift for a function over a half-open range of nonnegative integers. (Contributed by AV, 20-May-2018.) (Revised by AV, 17-Nov-2018.) (Revised by AV, 4-Nov-2022.)
Assertion
Ref Expression
cshfn ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
Distinct variable group:   𝑓,𝑙
Allowed substitution hints:   𝑁(𝑓,𝑙)   𝑊(𝑓,𝑙)

Proof of Theorem cshfn
Dummy variables 𝑛 𝑤 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 eqeq1 2825 . . . 4 (𝑤 = 𝑊 → (𝑤 = ∅ ↔ 𝑊 = ∅))
21adantr 483 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 485 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 487 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6670 . . . . . . . 8 (𝑤 = 𝑊 → (♯‘𝑤) = (♯‘𝑊))
65adantr 483 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (♯‘𝑤) = (♯‘𝑊))
74, 6oveq12d 7174 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (♯‘𝑤)) = (𝑁 mod (♯‘𝑊)))
87, 6opeq12d 4811 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩ = ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩)
93, 8oveq12d 7174 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩))
103, 7oveq12d 7174 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 prefix (𝑛 mod (♯‘𝑤))) = (𝑊 prefix (𝑁 mod (♯‘𝑊))))
119, 10oveq12d 7174 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤)))) = ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))))
122, 11ifbieq2d 4492 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
13 df-csh 14151 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))))
14 0ex 5211 . . 3 ∅ ∈ V
15 ovex 7189 . . 3 ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))) ∈ V
1614, 15ifex 4515 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))) ∈ V
1712, 13, 16ovmpoa 7305 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 208  wa 398   = wceq 1537  wcel 2114  {cab 2799  wrex 3139  c0 4291  ifcif 4467  cop 4573   Fn wfn 6350  cfv 6355  (class class class)co 7156  0cc0 10537  0cn0 11898  cz 11982  ..^cfzo 13034   mod cmo 13238  chash 13691   ++ cconcat 13922   substr csubstr 14002   prefix cpfx 14032   cyclShift ccsh 14150
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1796  ax-4 1810  ax-5 1911  ax-6 1970  ax-7 2015  ax-8 2116  ax-9 2124  ax-10 2145  ax-11 2161  ax-12 2177  ax-ext 2793  ax-sep 5203  ax-nul 5210  ax-pr 5330
This theorem depends on definitions:  df-bi 209  df-an 399  df-or 844  df-3an 1085  df-tru 1540  df-ex 1781  df-nf 1785  df-sb 2070  df-mo 2622  df-eu 2654  df-clab 2800  df-cleq 2814  df-clel 2893  df-nfc 2963  df-ral 3143  df-rex 3144  df-rab 3147  df-v 3496  df-sbc 3773  df-dif 3939  df-un 3941  df-in 3943  df-ss 3952  df-nul 4292  df-if 4468  df-sn 4568  df-pr 4570  df-op 4574  df-uni 4839  df-br 5067  df-opab 5129  df-id 5460  df-xp 5561  df-rel 5562  df-cnv 5563  df-co 5564  df-dm 5565  df-iota 6314  df-fun 6357  df-fv 6363  df-ov 7159  df-oprab 7160  df-mpo 7161  df-csh 14151
This theorem is referenced by:  cshword  14153
  Copyright terms: Public domain W3C validator