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

Theorem cshfn 14431
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 2742 . . . 4 (𝑤 = 𝑊 → (𝑤 = ∅ ↔ 𝑊 = ∅))
21adantr 480 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 482 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 484 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6756 . . . . . . . 8 (𝑤 = 𝑊 → (♯‘𝑤) = (♯‘𝑊))
65adantr 480 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (♯‘𝑤) = (♯‘𝑊))
74, 6oveq12d 7273 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (♯‘𝑤)) = (𝑁 mod (♯‘𝑊)))
87, 6opeq12d 4809 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩ = ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩)
93, 8oveq12d 7273 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩))
103, 7oveq12d 7273 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 prefix (𝑛 mod (♯‘𝑤))) = (𝑊 prefix (𝑁 mod (♯‘𝑊))))
119, 10oveq12d 7273 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤)))) = ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))))
122, 11ifbieq2d 4482 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
13 df-csh 14430 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))))
14 0ex 5226 . . 3 ∅ ∈ V
15 ovex 7288 . . 3 ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))) ∈ V
1614, 15ifex 4506 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))) ∈ V
1712, 13, 16ovmpoa 7406 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 205  wa 395   = wceq 1539  wcel 2108  {cab 2715  wrex 3064  c0 4253  ifcif 4456  cop 4564   Fn wfn 6413  cfv 6418  (class class class)co 7255  0cc0 10802  0cn0 12163  cz 12249  ..^cfzo 13311   mod cmo 13517  chash 13972   ++ cconcat 14201   substr csubstr 14281   prefix cpfx 14311   cyclShift ccsh 14429
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1799  ax-4 1813  ax-5 1914  ax-6 1972  ax-7 2012  ax-8 2110  ax-9 2118  ax-10 2139  ax-11 2156  ax-12 2173  ax-ext 2709  ax-sep 5218  ax-nul 5225  ax-pr 5347
This theorem depends on definitions:  df-bi 206  df-an 396  df-or 844  df-3an 1087  df-tru 1542  df-fal 1552  df-ex 1784  df-nf 1788  df-sb 2069  df-mo 2540  df-eu 2569  df-clab 2716  df-cleq 2730  df-clel 2817  df-nfc 2888  df-ral 3068  df-rex 3069  df-rab 3072  df-v 3424  df-sbc 3712  df-dif 3886  df-un 3888  df-in 3890  df-ss 3900  df-nul 4254  df-if 4457  df-sn 4559  df-pr 4561  df-op 4565  df-uni 4837  df-br 5071  df-opab 5133  df-id 5480  df-xp 5586  df-rel 5587  df-cnv 5588  df-co 5589  df-dm 5590  df-iota 6376  df-fun 6420  df-fv 6426  df-ov 7258  df-oprab 7259  df-mpo 7260  df-csh 14430
This theorem is referenced by:  cshword  14432
  Copyright terms: Public domain W3C validator