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

Theorem 2swrdeqwrdeq 13399
Description: Two words are equal if and only if they have the same prefix and the same suffix. (Contributed by Alexander van der Vekens, 23-Sep-2018.)
Assertion
Ref Expression
2swrdeqwrdeq ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))))

Proof of Theorem 2swrdeqwrdeq
Dummy variable 𝑖 is distinct from all other variables.
StepHypRef Expression
1 eqwrd 13293 . . 3 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
213adant3 1079 . 2 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
3 elfzofz 12434 . . . . . . . . 9 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ∈ (0...(#‘𝑊)))
4 fzosplit 12450 . . . . . . . . 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 3136 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ ∀𝑖 ∈ ((0..^𝐼) ∪ (𝐼..^(#‘𝑊)))(𝑊𝑖) = (𝑆𝑖)))
9 ralunb 3777 . . . . 5 (∀𝑖 ∈ ((0..^𝐼) ∪ (𝐼..^(#‘𝑊)))(𝑊𝑖) = (𝑆𝑖) ↔ (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)))
108, 9syl6bb 276 . . . 4 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖))))
11 3simpa 1056 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉))
1211adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉))
13 elfzonn0 12461 . . . . . . . . 9 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ∈ ℕ0)
14133ad2ant3 1082 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → 𝐼 ∈ ℕ0)
1514adantr 481 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 ∈ ℕ0)
16 0nn0 11259 . . . . . . 7 0 ∈ ℕ0
1715, 16jctil 559 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (0 ∈ ℕ0𝐼 ∈ ℕ0))
18 elfzo0le 12460 . . . . . . . 8 (𝐼 ∈ (0..^(#‘𝑊)) → 𝐼 ≤ (#‘𝑊))
19183ad2ant3 1082 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → 𝐼 ≤ (#‘𝑊))
2019adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 ≤ (#‘𝑊))
21 breq2 4622 . . . . . . . 8 ((#‘𝑊) = (#‘𝑆) → (𝐼 ≤ (#‘𝑊) ↔ 𝐼 ≤ (#‘𝑆)))
2221adantl 482 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝐼 ≤ (#‘𝑊) ↔ 𝐼 ≤ (#‘𝑆)))
2320, 22mpbid 222 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → 𝐼 ≤ (#‘𝑆))
24 swrdspsleq 13395 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (0 ∈ ℕ0𝐼 ∈ ℕ0) ∧ (𝐼 ≤ (#‘𝑊) ∧ 𝐼 ≤ (#‘𝑆))) → ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ↔ ∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖)))
2524bicomd 213 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (0 ∈ ℕ0𝐼 ∈ ℕ0) ∧ (𝐼 ≤ (#‘𝑊) ∧ 𝐼 ≤ (#‘𝑆))) → (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩)))
2612, 17, 20, 23, 25syl112anc 1327 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩)))
27 lencl 13271 . . . . . . . . 9 (𝑊 ∈ Word 𝑉 → (#‘𝑊) ∈ ℕ0)
28273ad2ant1 1080 . . . . . . . 8 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (#‘𝑊) ∈ ℕ0)
2914, 28jca 554 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0))
3029adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0))
31 nn0re 11253 . . . . . . . . . 10 ((#‘𝑊) ∈ ℕ0 → (#‘𝑊) ∈ ℝ)
3231leidd 10546 . . . . . . . . 9 ((#‘𝑊) ∈ ℕ0 → (#‘𝑊) ≤ (#‘𝑊))
3327, 32syl 17 . . . . . . . 8 (𝑊 ∈ Word 𝑉 → (#‘𝑊) ≤ (#‘𝑊))
34333ad2ant1 1080 . . . . . . 7 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (#‘𝑊) ≤ (#‘𝑊))
3534adantr 481 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (#‘𝑊) ≤ (#‘𝑊))
36 breq2 4622 . . . . . . . 8 ((#‘𝑊) = (#‘𝑆) → ((#‘𝑊) ≤ (#‘𝑊) ↔ (#‘𝑊) ≤ (#‘𝑆)))
3736adantl 482 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → ((#‘𝑊) ≤ (#‘𝑊) ↔ (#‘𝑊) ≤ (#‘𝑆)))
3835, 37mpbid 222 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (#‘𝑊) ≤ (#‘𝑆))
39 swrdspsleq 13395 . . . . . . 7 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0) ∧ ((#‘𝑊) ≤ (#‘𝑊) ∧ (#‘𝑊) ≤ (#‘𝑆))) → ((𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩) ↔ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)))
4039bicomd 213 . . . . . 6 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉) ∧ (𝐼 ∈ ℕ0 ∧ (#‘𝑊) ∈ ℕ0) ∧ ((#‘𝑊) ≤ (#‘𝑊) ∧ (#‘𝑊) ≤ (#‘𝑆))) → (∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))
4112, 30, 35, 38, 40syl112anc 1327 . . . . 5 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))
4226, 41anbi12d 746 . . . 4 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → ((∀𝑖 ∈ (0..^𝐼)(𝑊𝑖) = (𝑆𝑖) ∧ ∀𝑖 ∈ (𝐼..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)) ↔ ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩))))
4310, 42bitrd 268 . . 3 (((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) ∧ (#‘𝑊) = (#‘𝑆)) → (∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖) ↔ ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩))))
4443pm5.32da 672 . 2 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (((#‘𝑊) = (#‘𝑆) ∧ ∀𝑖 ∈ (0..^(#‘𝑊))(𝑊𝑖) = (𝑆𝑖)) ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ∧ (𝑊 substr ⟨𝐼, (#‘𝑊)⟩) = (𝑆 substr ⟨𝐼, (#‘𝑊)⟩)))))
452, 44bitrd 268 1 ((𝑊 ∈ Word 𝑉𝑆 ∈ Word 𝑉𝐼 ∈ (0..^(#‘𝑊))) → (𝑊 = 𝑆 ↔ ((#‘𝑊) = (#‘𝑆) ∧ ((𝑊 substr ⟨0, 𝐼⟩) = (𝑆 substr ⟨0, 𝐼⟩) ∧ (𝑊 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 3557  cop 4159   class class class wbr 4618  cfv 5852  (class class class)co 6610  0cc0 9888  cle 10027  0cn0 11244  ...cfz 12276  ..^cfzo 12414  #chash 13065  Word cword 13238   substr csubstr 13242
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 4736  ax-sep 4746  ax-nul 4754  ax-pow 4808  ax-pr 4872  ax-un 6909  ax-cnex 9944  ax-resscn 9945  ax-1cn 9946  ax-icn 9947  ax-addcl 9948  ax-addrcl 9949  ax-mulcl 9950  ax-mulrcl 9951  ax-mulcom 9952  ax-addass 9953  ax-mulass 9954  ax-distr 9955  ax-i2m1 9956  ax-1ne0 9957  ax-1rid 9958  ax-rnegex 9959  ax-rrecex 9960  ax-cnre 9961  ax-pre-lttri 9962  ax-pre-lttrn 9963  ax-pre-ltadd 9964  ax-pre-mulgt0 9965
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 3191  df-sbc 3422  df-csb 3519  df-dif 3562  df-un 3564  df-in 3566  df-ss 3573  df-pss 3575  df-nul 3897  df-if 4064  df-pw 4137  df-sn 4154  df-pr 4156  df-tp 4158  df-op 4160  df-uni 4408  df-int 4446  df-iun 4492  df-br 4619  df-opab 4679  df-mpt 4680  df-tr 4718  df-eprel 4990  df-id 4994  df-po 5000  df-so 5001  df-fr 5038  df-we 5040  df-xp 5085  df-rel 5086  df-cnv 5087  df-co 5088  df-dm 5089  df-rn 5090  df-res 5091  df-ima 5092  df-pred 5644  df-ord 5690  df-on 5691  df-lim 5692  df-suc 5693  df-iota 5815  df-fun 5854  df-fn 5855  df-f 5856  df-f1 5857  df-fo 5858  df-f1o 5859  df-fv 5860  df-riota 6571  df-ov 6613  df-oprab 6614  df-mpt2 6615  df-om 7020  df-1st 7120  df-2nd 7121  df-wrecs 7359  df-recs 7420  df-rdg 7458  df-1o 7512  df-oadd 7516  df-er 7694  df-en 7908  df-dom 7909  df-sdom 7910  df-fin 7911  df-card 8717  df-pnf 10028  df-mnf 10029  df-xr 10030  df-ltxr 10031  df-le 10032  df-sub 10220  df-neg 10221  df-nn 10973  df-n0 11245  df-z 11330  df-uz 11640  df-fz 12277  df-fzo 12415  df-hash 13066  df-word 13246  df-substr 13250
This theorem is referenced by:  2swrd1eqwrdeq  13400  2swrd2eqwrdeq  13638
  Copyright terms: Public domain W3C validator