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

Theorem cshfn 14503
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 481 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 483 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 485 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6774 . . . . . . . 8 (𝑤 = 𝑊 → (♯‘𝑤) = (♯‘𝑊))
65adantr 481 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (♯‘𝑤) = (♯‘𝑊))
74, 6oveq12d 7293 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (♯‘𝑤)) = (𝑁 mod (♯‘𝑊)))
87, 6opeq12d 4812 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩ = ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩)
93, 8oveq12d 7293 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩))
103, 7oveq12d 7293 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 prefix (𝑛 mod (♯‘𝑤))) = (𝑊 prefix (𝑁 mod (♯‘𝑊))))
119, 10oveq12d 7293 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤)))) = ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))))
122, 11ifbieq2d 4485 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
13 df-csh 14502 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 prefix (𝑛 mod (♯‘𝑤))))))
14 0ex 5231 . . 3 ∅ ∈ V
15 ovex 7308 . . 3 ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊)))) ∈ V
1614, 15ifex 4509 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))) ∈ V
1712, 13, 16ovmpoa 7428 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 prefix (𝑁 mod (♯‘𝑊))))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 205  wa 396   = wceq 1539  wcel 2106  {cab 2715  wrex 3065  c0 4256  ifcif 4459  cop 4567   Fn wfn 6428  cfv 6433  (class class class)co 7275  0cc0 10871  0cn0 12233  cz 12319  ..^cfzo 13382   mod cmo 13589  chash 14044   ++ cconcat 14273   substr csubstr 14353   prefix cpfx 14383   cyclShift ccsh 14501
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1798  ax-4 1812  ax-5 1913  ax-6 1971  ax-7 2011  ax-8 2108  ax-9 2116  ax-10 2137  ax-11 2154  ax-12 2171  ax-ext 2709  ax-sep 5223  ax-nul 5230  ax-pr 5352
This theorem depends on definitions:  df-bi 206  df-an 397  df-or 845  df-3an 1088  df-tru 1542  df-fal 1552  df-ex 1783  df-nf 1787  df-sb 2068  df-mo 2540  df-eu 2569  df-clab 2716  df-cleq 2730  df-clel 2816  df-nfc 2889  df-ral 3069  df-rex 3070  df-rab 3073  df-v 3434  df-sbc 3717  df-dif 3890  df-un 3892  df-in 3894  df-ss 3904  df-nul 4257  df-if 4460  df-sn 4562  df-pr 4564  df-op 4568  df-uni 4840  df-br 5075  df-opab 5137  df-id 5489  df-xp 5595  df-rel 5596  df-cnv 5597  df-co 5598  df-dm 5599  df-iota 6391  df-fun 6435  df-fv 6441  df-ov 7278  df-oprab 7279  df-mpo 7280  df-csh 14502
This theorem is referenced by:  cshword  14504
  Copyright terms: Public domain W3C validator