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

Theorem cshfn 13736
 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 2764 . . . 4 (𝑤 = 𝑊 → (𝑤 = ∅ ↔ 𝑊 = ∅))
21adantr 472 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 474 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 479 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6352 . . . . . . . 8 (𝑤 = 𝑊 → (♯‘𝑤) = (♯‘𝑊))
65adantr 472 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (♯‘𝑤) = (♯‘𝑊))
74, 6oveq12d 6831 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (♯‘𝑤)) = (𝑁 mod (♯‘𝑊)))
87, 6opeq12d 4561 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩ = ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩)
93, 8oveq12d 6831 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩))
107opeq2d 4560 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨0, (𝑛 mod (♯‘𝑤))⟩ = ⟨0, (𝑁 mod (♯‘𝑊))⟩)
113, 10oveq12d 6831 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨0, (𝑛 mod (♯‘𝑤))⟩) = (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩))
129, 11oveq12d 6831 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (♯‘𝑤))⟩)) = ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩)))
132, 12ifbieq2d 4255 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (♯‘𝑤))⟩))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩))))
14 df-csh 13735 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (♯‘𝑤)), (♯‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (♯‘𝑤))⟩))))
15 0ex 4942 . . 3 ∅ ∈ V
16 ovex 6841 . . 3 ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩)) ∈ V
1715, 16ifex 4300 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩))) ∈ V
1813, 14, 17ovmpt2a 6956 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (♯‘𝑊)), (♯‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (♯‘𝑊))⟩))))
 Colors of variables: wff setvar class Syntax hints:   → wi 4   ↔ wb 196   ∧ wa 383   = wceq 1632   ∈ wcel 2139  {cab 2746  ∃wrex 3051  ∅c0 4058  ifcif 4230  ⟨cop 4327   Fn wfn 6044  ‘cfv 6049  (class class class)co 6813  0cc0 10128  ℕ0cn0 11484  ℤcz 11569  ..^cfzo 12659   mod cmo 12862  ♯chash 13311   ++ cconcat 13479   substr csubstr 13481   cyclShift ccsh 13734 This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1871  ax-4 1886  ax-5 1988  ax-6 2054  ax-7 2090  ax-9 2148  ax-10 2168  ax-11 2183  ax-12 2196  ax-13 2391  ax-ext 2740  ax-sep 4933  ax-nul 4941  ax-pr 5055 This theorem depends on definitions:  df-bi 197  df-or 384  df-an 385  df-3an 1074  df-tru 1635  df-ex 1854  df-nf 1859  df-sb 2047  df-eu 2611  df-mo 2612  df-clab 2747  df-cleq 2753  df-clel 2756  df-nfc 2891  df-ral 3055  df-rex 3056  df-rab 3059  df-v 3342  df-sbc 3577  df-dif 3718  df-un 3720  df-in 3722  df-ss 3729  df-nul 4059  df-if 4231  df-sn 4322  df-pr 4324  df-op 4328  df-uni 4589  df-br 4805  df-opab 4865  df-id 5174  df-xp 5272  df-rel 5273  df-cnv 5274  df-co 5275  df-dm 5276  df-iota 6012  df-fun 6051  df-fv 6057  df-ov 6816  df-oprab 6817  df-mpt2 6818  df-csh 13735 This theorem is referenced by:  cshword  13737  cshword2  41947
 Copyright terms: Public domain W3C validator