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

Theorem cshfn 13333
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 2613 . . . 4 (𝑤 = 𝑊 → (𝑤 = ∅ ↔ 𝑊 = ∅))
21adantr 479 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 = ∅ ↔ 𝑊 = ∅))
3 simpl 471 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑤 = 𝑊)
4 simpr 475 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → 𝑛 = 𝑁)
5 fveq2 6088 . . . . . . . 8 (𝑤 = 𝑊 → (#‘𝑤) = (#‘𝑊))
65adantr 479 . . . . . . 7 ((𝑤 = 𝑊𝑛 = 𝑁) → (#‘𝑤) = (#‘𝑊))
74, 6oveq12d 6545 . . . . . 6 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑛 mod (#‘𝑤)) = (𝑁 mod (#‘𝑊)))
87, 6opeq12d 4342 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩ = ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩)
93, 8oveq12d 6545 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) = (𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩))
107opeq2d 4341 . . . . 5 ((𝑤 = 𝑊𝑛 = 𝑁) → ⟨0, (𝑛 mod (#‘𝑤))⟩ = ⟨0, (𝑁 mod (#‘𝑊))⟩)
113, 10oveq12d 6545 . . . 4 ((𝑤 = 𝑊𝑛 = 𝑁) → (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩) = (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))
129, 11oveq12d 6545 . . 3 ((𝑤 = 𝑊𝑛 = 𝑁) → ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩)) = ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩)))
132, 12ifbieq2d 4060 . 2 ((𝑤 = 𝑊𝑛 = 𝑁) → if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩))) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))))
14 df-csh 13332 . 2 cyclShift = (𝑤 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)}, 𝑛 ∈ ℤ ↦ if(𝑤 = ∅, ∅, ((𝑤 substr ⟨(𝑛 mod (#‘𝑤)), (#‘𝑤)⟩) ++ (𝑤 substr ⟨0, (𝑛 mod (#‘𝑤))⟩))))
15 0ex 4713 . . 3 ∅ ∈ V
16 ovex 6555 . . 3 ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩)) ∈ V
1715, 16ifex 4105 . 2 if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))) ∈ V
1813, 14, 17ovmpt2a 6667 1 ((𝑊 ∈ {𝑓 ∣ ∃𝑙 ∈ ℕ0 𝑓 Fn (0..^𝑙)} ∧ 𝑁 ∈ ℤ) → (𝑊 cyclShift 𝑁) = if(𝑊 = ∅, ∅, ((𝑊 substr ⟨(𝑁 mod (#‘𝑊)), (#‘𝑊)⟩) ++ (𝑊 substr ⟨0, (𝑁 mod (#‘𝑊))⟩))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 194  wa 382   = wceq 1474  wcel 1976  {cab 2595  wrex 2896  c0 3873  ifcif 4035  cop 4130   Fn wfn 5785  cfv 5790  (class class class)co 6527  0cc0 9792  0cn0 11139  cz 11210  ..^cfzo 12289   mod cmo 12485  #chash 12934   ++ cconcat 13094   substr csubstr 13096   cyclShift ccsh 13331
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1712  ax-4 1727  ax-5 1826  ax-6 1874  ax-7 1921  ax-9 1985  ax-10 2005  ax-11 2020  ax-12 2032  ax-13 2232  ax-ext 2589  ax-sep 4703  ax-nul 4712  ax-pr 4828
This theorem depends on definitions:  df-bi 195  df-or 383  df-an 384  df-3an 1032  df-tru 1477  df-ex 1695  df-nf 1700  df-sb 1867  df-eu 2461  df-mo 2462  df-clab 2596  df-cleq 2602  df-clel 2605  df-nfc 2739  df-ral 2900  df-rex 2901  df-rab 2904  df-v 3174  df-sbc 3402  df-dif 3542  df-un 3544  df-in 3546  df-ss 3553  df-nul 3874  df-if 4036  df-sn 4125  df-pr 4127  df-op 4131  df-uni 4367  df-br 4578  df-opab 4638  df-id 4943  df-xp 5034  df-rel 5035  df-cnv 5036  df-co 5037  df-dm 5038  df-iota 5754  df-fun 5792  df-fv 5798  df-ov 6530  df-oprab 6531  df-mpt2 6532  df-csh 13332
This theorem is referenced by:  cshword  13334  cshword2  40105
  Copyright terms: Public domain W3C validator