Users' Mathboxes Mathbox for BTernaryTau < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >   Mathboxes  >  swrdrevpfx Structured version   Visualization version   GIF version

Theorem swrdrevpfx 32383
Description: A subword expressed in terms of reverses and prefixes. (Contributed by BTernaryTau, 3-Dec-2023.)
Assertion
Ref Expression
swrdrevpfx ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (𝑊 substr ⟨𝐹, 𝐿⟩) = (reverse‘((reverse‘(𝑊 prefix 𝐿)) prefix (𝐿𝐹))))

Proof of Theorem swrdrevpfx
StepHypRef Expression
1 fznn0sub2 13009 . . . . . 6 (𝐹 ∈ (0...𝐿) → (𝐿𝐹) ∈ (0...𝐿))
2 pfxcl 14030 . . . . . . . . 9 (𝑊 ∈ Word 𝑉 → (𝑊 prefix 𝐿) ∈ Word 𝑉)
3 revcl 14114 . . . . . . . . 9 ((𝑊 prefix 𝐿) ∈ Word 𝑉 → (reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉)
42, 3syl 17 . . . . . . . 8 (𝑊 ∈ Word 𝑉 → (reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉)
543ad2ant1 1130 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → (reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉)
6 simp3 1135 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → (𝐿𝐹) ∈ (0...𝐿))
7 revlen 14115 . . . . . . . . . . . . 13 ((𝑊 prefix 𝐿) ∈ Word 𝑉 → (♯‘(reverse‘(𝑊 prefix 𝐿))) = (♯‘(𝑊 prefix 𝐿)))
82, 7syl 17 . . . . . . . . . . . 12 (𝑊 ∈ Word 𝑉 → (♯‘(reverse‘(𝑊 prefix 𝐿))) = (♯‘(𝑊 prefix 𝐿)))
98adantr 484 . . . . . . . . . . 11 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → (♯‘(reverse‘(𝑊 prefix 𝐿))) = (♯‘(𝑊 prefix 𝐿)))
10 pfxlen 14036 . . . . . . . . . . 11 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → (♯‘(𝑊 prefix 𝐿)) = 𝐿)
119, 10eqtrd 2859 . . . . . . . . . 10 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → (♯‘(reverse‘(𝑊 prefix 𝐿))) = 𝐿)
12113adant3 1129 . . . . . . . . 9 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → (♯‘(reverse‘(𝑊 prefix 𝐿))) = 𝐿)
1312oveq2d 7156 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → (0...(♯‘(reverse‘(𝑊 prefix 𝐿)))) = (0...𝐿))
146, 13eleqtrrd 2919 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → (𝐿𝐹) ∈ (0...(♯‘(reverse‘(𝑊 prefix 𝐿)))))
155, 14jca 515 . . . . . 6 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ (𝐿𝐹) ∈ (0...𝐿)) → ((reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉 ∧ (𝐿𝐹) ∈ (0...(♯‘(reverse‘(𝑊 prefix 𝐿))))))
161, 15syl3an3 1162 . . . . 5 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊)) ∧ 𝐹 ∈ (0...𝐿)) → ((reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉 ∧ (𝐿𝐹) ∈ (0...(♯‘(reverse‘(𝑊 prefix 𝐿))))))
17163com23 1123 . . . 4 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉 ∧ (𝐿𝐹) ∈ (0...(♯‘(reverse‘(𝑊 prefix 𝐿))))))
18 revpfxsfxrev 32382 . . . 4 (((reverse‘(𝑊 prefix 𝐿)) ∈ Word 𝑉 ∧ (𝐿𝐹) ∈ (0...(♯‘(reverse‘(𝑊 prefix 𝐿))))) → (reverse‘((reverse‘(𝑊 prefix 𝐿)) prefix (𝐿𝐹))) = ((reverse‘(reverse‘(𝑊 prefix 𝐿))) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩))
1917, 18syl 17 . . 3 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (reverse‘((reverse‘(𝑊 prefix 𝐿)) prefix (𝐿𝐹))) = ((reverse‘(reverse‘(𝑊 prefix 𝐿))) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩))
20 revrev 14120 . . . . . 6 ((𝑊 prefix 𝐿) ∈ Word 𝑉 → (reverse‘(reverse‘(𝑊 prefix 𝐿))) = (𝑊 prefix 𝐿))
212, 20syl 17 . . . . 5 (𝑊 ∈ Word 𝑉 → (reverse‘(reverse‘(𝑊 prefix 𝐿))) = (𝑊 prefix 𝐿))
2221oveq1d 7155 . . . 4 (𝑊 ∈ Word 𝑉 → ((reverse‘(reverse‘(𝑊 prefix 𝐿))) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩) = ((𝑊 prefix 𝐿) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩))
23223ad2ant1 1130 . . 3 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((reverse‘(reverse‘(𝑊 prefix 𝐿))) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩) = ((𝑊 prefix 𝐿) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩))
2411oveq1d 7155 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → ((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)) = (𝐿 − (𝐿𝐹)))
25243adant2 1128 . . . . . 6 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)) = (𝐿 − (𝐿𝐹)))
26 elfzel2 12900 . . . . . . . . 9 (𝐹 ∈ (0...𝐿) → 𝐿 ∈ ℤ)
2726zcnd 12076 . . . . . . . 8 (𝐹 ∈ (0...𝐿) → 𝐿 ∈ ℂ)
28 elfzelz 12902 . . . . . . . . 9 (𝐹 ∈ (0...𝐿) → 𝐹 ∈ ℤ)
2928zcnd 12076 . . . . . . . 8 (𝐹 ∈ (0...𝐿) → 𝐹 ∈ ℂ)
3027, 29nncand 10989 . . . . . . 7 (𝐹 ∈ (0...𝐿) → (𝐿 − (𝐿𝐹)) = 𝐹)
31303ad2ant2 1131 . . . . . 6 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (𝐿 − (𝐿𝐹)) = 𝐹)
3225, 31eqtrd 2859 . . . . 5 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)) = 𝐹)
33113adant2 1128 . . . . 5 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (♯‘(reverse‘(𝑊 prefix 𝐿))) = 𝐿)
3432, 33opeq12d 4794 . . . 4 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩ = ⟨𝐹, 𝐿⟩)
3534oveq2d 7156 . . 3 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 prefix 𝐿) substr ⟨((♯‘(reverse‘(𝑊 prefix 𝐿))) − (𝐿𝐹)), (♯‘(reverse‘(𝑊 prefix 𝐿)))⟩) = ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩))
3619, 23, 353eqtrd 2863 . 2 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (reverse‘((reverse‘(𝑊 prefix 𝐿)) prefix (𝐿𝐹))) = ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩))
37 elfzuz3 12899 . . . . . . . 8 (𝐹 ∈ (0...𝐿) → 𝐿 ∈ (ℤ𝐹))
38 eluzfz2 12910 . . . . . . . 8 (𝐿 ∈ (ℤ𝐹) → 𝐿 ∈ (𝐹...𝐿))
3937, 38syl 17 . . . . . . 7 (𝐹 ∈ (0...𝐿) → 𝐿 ∈ (𝐹...𝐿))
4039ancli 552 . . . . . 6 (𝐹 ∈ (0...𝐿) → (𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (𝐹...𝐿)))
41403ad2ant2 1131 . . . . 5 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (𝐹...𝐿)))
42 swrdpfx 14060 . . . . 5 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → ((𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (𝐹...𝐿)) → ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩) = (𝑊 substr ⟨𝐹, 𝐿⟩)))
4341, 42syl5 34 . . . 4 ((𝑊 ∈ Word 𝑉𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩) = (𝑊 substr ⟨𝐹, 𝐿⟩)))
44433adant2 1128 . . 3 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩) = (𝑊 substr ⟨𝐹, 𝐿⟩)))
4544pm2.43i 52 . 2 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → ((𝑊 prefix 𝐿) substr ⟨𝐹, 𝐿⟩) = (𝑊 substr ⟨𝐹, 𝐿⟩))
4636, 45eqtr2d 2860 1 ((𝑊 ∈ Word 𝑉𝐹 ∈ (0...𝐿) ∧ 𝐿 ∈ (0...(♯‘𝑊))) → (𝑊 substr ⟨𝐹, 𝐿⟩) = (reverse‘((reverse‘(𝑊 prefix 𝐿)) prefix (𝐿𝐹))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wa 399  w3a 1084   = wceq 1538  wcel 2115  cop 4554  cfv 6338  (class class class)co 7140  0cc0 10524  cmin 10857  cuz 12231  ...cfz 12885  chash 13686  Word cword 13857   substr csubstr 13993   prefix cpfx 14023  reversecreverse 14111
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1797  ax-4 1811  ax-5 1912  ax-6 1971  ax-7 2016  ax-8 2117  ax-9 2125  ax-10 2146  ax-11 2162  ax-12 2179  ax-ext 2796  ax-rep 5173  ax-sep 5186  ax-nul 5193  ax-pow 5249  ax-pr 5313  ax-un 7446  ax-cnex 10580  ax-resscn 10581  ax-1cn 10582  ax-icn 10583  ax-addcl 10584  ax-addrcl 10585  ax-mulcl 10586  ax-mulrcl 10587  ax-mulcom 10588  ax-addass 10589  ax-mulass 10590  ax-distr 10591  ax-i2m1 10592  ax-1ne0 10593  ax-1rid 10594  ax-rnegex 10595  ax-rrecex 10596  ax-cnre 10597  ax-pre-lttri 10598  ax-pre-lttrn 10599  ax-pre-ltadd 10600  ax-pre-mulgt0 10601
This theorem depends on definitions:  df-bi 210  df-an 400  df-or 845  df-3or 1085  df-3an 1086  df-tru 1541  df-ex 1782  df-nf 1786  df-sb 2071  df-mo 2624  df-eu 2655  df-clab 2803  df-cleq 2817  df-clel 2896  df-nfc 2964  df-ne 3014  df-nel 3118  df-ral 3137  df-rex 3138  df-reu 3139  df-rab 3141  df-v 3481  df-sbc 3758  df-csb 3866  df-dif 3921  df-un 3923  df-in 3925  df-ss 3935  df-pss 3937  df-nul 4275  df-if 4449  df-pw 4522  df-sn 4549  df-pr 4551  df-tp 4553  df-op 4555  df-uni 4822  df-int 4860  df-iun 4904  df-br 5050  df-opab 5112  df-mpt 5130  df-tr 5156  df-id 5443  df-eprel 5448  df-po 5457  df-so 5458  df-fr 5497  df-we 5499  df-xp 5544  df-rel 5545  df-cnv 5546  df-co 5547  df-dm 5548  df-rn 5549  df-res 5550  df-ima 5551  df-pred 6131  df-ord 6177  df-on 6178  df-lim 6179  df-suc 6180  df-iota 6297  df-fun 6340  df-fn 6341  df-f 6342  df-f1 6343  df-fo 6344  df-f1o 6345  df-fv 6346  df-riota 7098  df-ov 7143  df-oprab 7144  df-mpo 7145  df-om 7566  df-1st 7674  df-2nd 7675  df-wrecs 7932  df-recs 7993  df-rdg 8031  df-1o 8087  df-oadd 8091  df-er 8274  df-en 8495  df-dom 8496  df-sdom 8497  df-fin 8498  df-card 9354  df-pnf 10664  df-mnf 10665  df-xr 10666  df-ltxr 10667  df-le 10668  df-sub 10859  df-neg 10860  df-nn 11626  df-n0 11886  df-z 11970  df-uz 12232  df-fz 12886  df-fzo 13029  df-hash 13687  df-word 13858  df-substr 13994  df-pfx 14024  df-reverse 14112
This theorem is referenced by:  swrdwlk  32393
  Copyright terms: Public domain W3C validator