Users' Mathboxes Mathbox for Alexander van der Vekens < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >   Mathboxes  >  pfxsuffeqwrdeq Structured version   Visualization version   GIF version

Theorem pfxsuffeqwrdeq 40721
Description: Two words are equal if and only if they have the same prefix and the same suffix. Could replace 2swrdeqwrdeq 13394. (Contributed by AV, 5-May-2020.)
Assertion
Ref Expression
pfxsuffeqwrdeq ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))))

Proof of Theorem pfxsuffeqwrdeq
Dummy variable 𝑖 is distinct from all other variables.
StepHypRef Expression
1 eqwrd 13288 . . 3 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
213adant3 1079 . 2 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
3 elfzofz 12429 . . . . . . . . 9 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ∈ (0...(#‘𝑊)))
4 fzosplit 12445 . . . . . . . . 9 (𝐼 ∈ (0...(#‘𝑊)) → (0..^(#‘𝑊)) = ((0..^𝐼) ∪ (𝐼..^(#‘𝑊))))
53, 4syl 17 . . . . . . . 8 (𝐼 ∈ (0..^(#‘𝑊)) → (0..^(#‘𝑊)) = ((0..^𝐼) ∪ (𝐼..^(#‘𝑊))))
653ad2ant3 1082 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (0..^(#‘𝑊)) = ((0..^𝐼) ∪ (𝐼..^(#‘𝑊))))
76adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (0..^(#‘𝑊)) = ((0..^𝐼) ∪ (𝐼..^(#‘𝑊))))
87raleqdv 3133 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ ∀𝑖 ∈ ((0..^𝐼) ∪ (𝐼..^(#‘𝑊)))(𝑊𝑖) = (𝑆𝑖)))
9 ralunb 3774 . . . . 5 (∀𝑖 ∈ ((0..^𝐼) ∪ (𝐼..^(#‘𝑊)))(𝑊𝑖) = (𝑆𝑖) ↔ (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)))
108, 9syl6bb 276 . . . 4 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
11 eqidd 2622 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 = 𝐼)
1211biantrurd 529 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ↔ (𝐼 = 𝐼 ∧ ∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖))))
13 3simpa 1056 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉))
1413adantr 481 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉))
15 elfzonn0 12456 . . . . . . . . . 10 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ∈ ℕ0)
1615, 15jca 554 . . . . . . . . 9 (𝐼 ∈ (0..^(#‘𝑊)) → (𝐼 ∈ ℕ0𝐼 ∈ ℕ0))
17163ad2ant3 1082 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝐼 ∈ ℕ0𝐼 ∈ ℕ0))
1817adantr 481 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝐼 ∈ ℕ0𝐼 ∈ ℕ0))
19 elfzo0le 12455 . . . . . . . . 9 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ≤ (#‘𝑊))
20193ad2ant3 1082 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → 𝐼 ≤ (#‘𝑊))
2120adantr 481 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 ≤ (#‘𝑊))
22 breq2 4619 . . . . . . . . . 10 ((#‘𝑆) = (#‘𝑊) → (𝐼 ≤ (#‘𝑆) ↔ 𝐼 ≤ (#‘𝑊)))
2322eqcoms 2629 . . . . . . . . 9 ((#‘𝑊) = (#‘𝑆) → (𝐼 ≤ (#‘𝑆) ↔ 𝐼 ≤ (#‘𝑊)))
2423adantl 482 . . . . . . . 8 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝐼 ≤ (#‘𝑆) ↔ 𝐼 ≤ (#‘𝑊)))
2521, 24mpbird 247 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 ≤ (#‘𝑆))
26 pfxeq 40719 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (𝐼 ∈ ℕ0𝐼 ∈ ℕ0) ∧ (𝐼 ≤ (#‘𝑊) ∧ 𝐼 ≤ (#‘𝑆))) → ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ↔ (𝐼 = 𝐼 ∧ ∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖))))
2714, 18, 21, 25, 26syl112anc 1327 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ↔ (𝐼 = 𝐼 ∧ ∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖))))
2812, 27bitr4d 271 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 prefix 𝐼) = (𝑆 prefix 𝐼)))
29 lencl 13266 . . . . . . . . . 10 (𝑊 ∈ Word 𝑉 → (#‘𝑊) ∈ ℕ0)
3029, 15anim12i 589 . . . . . . . . 9 ((𝑊 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → ((#‘𝑊) ∈ ℕ0𝐼 ∈ ℕ0))
31303adant2 1078 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → ((#‘𝑊) ∈ ℕ0𝐼 ∈ ℕ0))
3231ancomd 467 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0))
3332adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0))
3429nn0red 11299 . . . . . . . . 9 (𝑊 ∈ Word 𝑉 → (#‘𝑊) ∈ ℝ)
3534leidd 10541 . . . . . . . 8 (𝑊 ∈ Word 𝑉 → (#‘𝑊) ≤ (#‘𝑊))
36353ad2ant1 1080 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (#‘𝑊) ≤ (#‘𝑊))
3736adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (#‘𝑊) ≤ (#‘𝑊))
38343ad2ant1 1080 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (#‘𝑊) ∈ ℝ)
39 eqle 10086 . . . . . . 7 (((#‘𝑊) ∈ ℝ ∧ (#‘𝑊) = (#‘𝑆)) → (#‘𝑊) ≤ (#‘𝑆))
4038, 39sylan 488 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (#‘𝑊) ≤ (#‘𝑆))
41 swrdspsleq 13390 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0) ∧ ((#‘𝑊) ≤ (#‘𝑊) ∧ (#‘𝑊) ≤ (#‘𝑆))) → ((𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩) ↔ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)))
4241bicomd 213 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0) ∧ ((#‘𝑊) ≤ (#‘𝑊) ∧ (#‘𝑊) ≤ (#‘𝑆))) → (∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))
4314, 33, 37, 40, 42syl112anc 1327 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))
4428, 43anbi12d 746 . . . 4 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → ((∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)) ↔ ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩))))
4510, 44bitrd 268 . . 3 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩))))
4645pm5.32da 672 . 2 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)) ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))))
472, 46bitrd 268 1 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 prefix 𝐼) = (𝑆 prefix 𝐼) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 196  wa 384  w3a 1036   = wceq 1480  wcel 1987  wral 2907  cun 3554  cop 4156   class class class wbr 4615  cfv 5849  (class class class)co 6607  cr 9882  0cc0 9883  cle 10022  0cn0 11239  ...cfz 12271  ..^cfzo 12409  #chash 13060  Word cword 13233   substr csubstr 13237   prefix cpfx 40696
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1719  ax-4 1734  ax-5 1836  ax-6 1885  ax-7 1932  ax-8 1989  ax-9 1996  ax-10 2016  ax-11 2031  ax-12 2044  ax-13 2245  ax-ext 2601  ax-rep 4733  ax-sep 4743  ax-nul 4751  ax-pow 4805  ax-pr 4869  ax-un 6905  ax-cnex 9939  ax-resscn 9940  ax-1cn 9941  ax-icn 9942  ax-addcl 9943  ax-addrcl 9944  ax-mulcl 9945  ax-mulrcl 9946  ax-mulcom 9947  ax-addass 9948  ax-mulass 9949  ax-distr 9950  ax-i2m1 9951  ax-1ne0 9952  ax-1rid 9953  ax-rnegex 9954  ax-rrecex 9955  ax-cnre 9956  ax-pre-lttri 9957  ax-pre-lttrn 9958  ax-pre-ltadd 9959  ax-pre-mulgt0 9960
This theorem depends on definitions:  df-bi 197  df-or 385  df-an 386  df-3or 1037  df-3an 1038  df-tru 1483  df-fal 1486  df-ex 1702  df-nf 1707  df-sb 1878  df-eu 2473  df-mo 2474  df-clab 2608  df-cleq 2614  df-clel 2617  df-nfc 2750  df-ne 2791  df-nel 2894  df-ral 2912  df-rex 2913  df-reu 2914  df-rab 2916  df-v 3188  df-sbc 3419  df-csb 3516  df-dif 3559  df-un 3561  df-in 3563  df-ss 3570  df-pss 3572  df-nul 3894  df-if 4061  df-pw 4134  df-sn 4151  df-pr 4153  df-tp 4155  df-op 4157  df-uni 4405  df-int 4443  df-iun 4489  df-br 4616  df-opab 4676  df-mpt 4677  df-tr 4715  df-eprel 4987  df-id 4991  df-po 4997  df-so 4998  df-fr 5035  df-we 5037  df-xp 5082  df-rel 5083  df-cnv 5084  df-co 5085  df-dm 5086  df-rn 5087  df-res 5088  df-ima 5089  df-pred 5641  df-ord 5687  df-on 5688  df-lim 5689  df-suc 5690  df-iota 5812  df-fun 5851  df-fn 5852  df-f 5853  df-f1 5854  df-fo 5855  df-f1o 5856  df-fv 5857  df-riota 6568  df-ov 6610  df-oprab 6611  df-mpt2 6612  df-om 7016  df-1st 7116  df-2nd 7117  df-wrecs 7355  df-recs 7416  df-rdg 7454  df-1o 7508  df-oadd 7512  df-er 7690  df-en 7903  df-dom 7904  df-sdom 7905  df-fin 7906  df-card 8712  df-pnf 10023  df-mnf 10024  df-xr 10025  df-ltxr 10026  df-le 10027  df-sub 10215  df-neg 10216  df-nn 10968  df-n0 11240  df-z 11325  df-uz 11635  df-fz 12272  df-fzo 12410  df-hash 13061  df-word 13241  df-substr 13245  df-pfx 40697
This theorem is referenced by:  pfxsuff1eqwrdeq  40722
  Copyright terms: Public domain W3C validator