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

Theorem cshfn 13536
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.)
Assertion
Ref Expression
cshfn ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 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 2626 . . . 4 (𝑤 = 𝑊 → (𝑤 = ∅ ↔ 𝑊 = ∅))
21adantr 481 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 473 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 477 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6191 . . . . . . . 8 (𝑤 = 𝑊 → (#‘𝑤) = (#‘𝑊))
65adantr 481 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (#‘𝑤) = (#‘𝑊))
74, 6oveq12d 6668 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (#‘𝑤)) = (𝑁 mod (#‘𝑊)))
87, 6opeq12d 4410 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩ = ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩)
93, 8oveq12d 6668 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩))
107opeq2d 4409 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨0, (𝑛 mod (#‘𝑤))⟩ = ⟨0, (𝑁 mod (#‘𝑊))⟩)
113, 10oveq12d 6668 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩) = (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))
129, 11oveq12d 6668 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩)) = ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩)))
132, 12ifbieq2d 4111 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))))
14 df-csh 13535 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩))))
15 0ex 4790 . . 3 ∅ ∈ V
16 ovex 6678 . . 3 ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩)) ∈ V
1715, 16ifex 4156 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))) ∈ V
1813, 14, 17ovmpt2a 6791 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 196  wa 384   = wceq 1483  wcel 1990  {cab 2608  wrex 2913  c0 3915  ifcif 4086  cop 4183   Fn wfn 5883  cfv 5888  (class class class)co 6650  0cc0 9936  0cn0 11292  cz 11377  ..^cfzo 12465   mod cmo 12668  #chash 13117   ++ cconcat 13293   substr csubstr 13295   cyclShift ccsh 13534
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1722  ax-4 1737  ax-5 1839  ax-6 1888  ax-7 1935  ax-9 1999  ax-10 2019  ax-11 2034  ax-12 2047  ax-13 2246  ax-ext 2602  ax-sep 4781  ax-nul 4789  ax-pr 4906
This theorem depends on definitions:  df-bi 197  df-or 385  df-an 386  df-3an 1039  df-tru 1486  df-ex 1705  df-nf 1710  df-sb 1881  df-eu 2474  df-mo 2475  df-clab 2609  df-cleq 2615  df-clel 2618  df-nfc 2753  df-ral 2917  df-rex 2918  df-rab 2921  df-v 3202  df-sbc 3436  df-dif 3577  df-un 3579  df-in 3581  df-ss 3588  df-nul 3916  df-if 4087  df-sn 4178  df-pr 4180  df-op 4184  df-uni 4437  df-br 4654  df-opab 4713  df-id 5024  df-xp 5120  df-rel 5121  df-cnv 5122  df-co 5123  df-dm 5124  df-iota 5851  df-fun 5890  df-fv 5896  df-ov 6653  df-oprab 6654  df-mpt2 6655  df-csh 13535
This theorem is referenced by:  cshword  13537  cshword2  41437
  Copyright terms: Public domain W3C validator