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

Theorem wrdpmtrlast 33426
Description: Reorder a word, so that the symbol given at index 𝐼 is at the end. (Contributed by Thierry Arnoux, 27-May-2025.)
Hypotheses
Ref Expression
wrdpmtrlast.1 𝐽 = (0..^(♯‘𝑊))
wrdpmtrlast.2 (𝜑𝐼𝐽)
wrdpmtrlast.3 (𝜑𝑊 ∈ Word 𝑆)
wrdpmtrlast.4 𝑈 = ((𝑊𝑠) prefix ((♯‘𝑊) − 1))
Assertion
Ref Expression
wrdpmtrlast (𝜑 → ∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩)))
Distinct variable groups:   𝐼,𝑠   𝐽,𝑠   𝑊,𝑠   𝜑,𝑠
Allowed substitution hints:   𝑆(𝑠)   𝑈(𝑠)

Proof of Theorem wrdpmtrlast
StepHypRef Expression
1 wrdpmtrlast.1 . . 3 𝐽 = (0..^(♯‘𝑊))
2 wrdpmtrlast.2 . . 3 (𝜑𝐼𝐽)
31, 2fzo0pmtrlast 33425 . 2 (𝜑 → ∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼))
4 simplr 781 . . . . 5 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠:𝐽1-1-onto𝐽)
5 wrdpmtrlast.4 . . . . . . . 8 𝑈 = ((𝑊𝑠) prefix ((♯‘𝑊) − 1))
6 f1of 6824 . . . . . . . . . . . . . . 15 (𝑠:𝐽1-1-onto𝐽𝑠:𝐽𝐽)
71feq2i 6701 . . . . . . . . . . . . . . 15 (𝑠:𝐽𝐽𝑠:(0..^(♯‘𝑊))⟶𝐽)
86, 7sylib 221 . . . . . . . . . . . . . 14 (𝑠:𝐽1-1-onto𝐽𝑠:(0..^(♯‘𝑊))⟶𝐽)
94, 8syl 18 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠:(0..^(♯‘𝑊))⟶𝐽)
10 iswrdi 14565 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽𝑠 ∈ Word 𝐽)
119, 10syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ∈ Word 𝐽)
12 eqidd 2767 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘𝑊))
13 wrdpmtrlast.3 . . . . . . . . . . . . . . 15 (𝜑𝑊 ∈ Word 𝑆)
1413ad2antrr 739 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊 ∈ Word 𝑆)
1512, 14wrdfd 14567 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:(0..^(♯‘𝑊))⟶𝑆)
161feq2i 6701 . . . . . . . . . . . . 13 (𝑊:𝐽𝑆𝑊:(0..^(♯‘𝑊))⟶𝑆)
1715, 16sylibr 237 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:𝐽𝑆)
18 lenco 14880 . . . . . . . . . . . 12 ((𝑠 ∈ Word 𝐽𝑊:𝐽𝑆) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
1911, 17, 18syl2anc 596 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
209ffund 6714 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → Fun 𝑠)
21 hashfundm 14490 . . . . . . . . . . . . 13 ((𝑠 ∈ Word 𝐽 ∧ Fun 𝑠) → (♯‘𝑠) = (♯‘dom 𝑠))
2211, 20, 21syl2anc 596 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑠) = (♯‘dom 𝑠))
239fdmd 6720 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → dom 𝑠 = (0..^(♯‘𝑊)))
2423fveq2d 6889 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘dom 𝑠) = (♯‘(0..^(♯‘𝑊))))
252, 1eleqtrdi 2876 . . . . . . . . . . . . . . . 16 (𝜑𝐼 ∈ (0..^(♯‘𝑊)))
2625ad2antrr 739 . . . . . . . . . . . . . . 15 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝐼 ∈ (0..^(♯‘𝑊)))
27 elfzo0 13740 . . . . . . . . . . . . . . . 16 (𝐼 ∈ (0..^(♯‘𝑊)) ↔ (𝐼 ∈ ℕ0 ∧ (♯‘𝑊) ∈ ℕ ∧ 𝐼 < (♯‘𝑊)))
2827simp2bi 1164 . . . . . . . . . . . . . . 15 (𝐼 ∈ (0..^(♯‘𝑊)) → (♯‘𝑊) ∈ ℕ)
2926, 28syl 18 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ)
3029nnnn0d 12575 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ0)
31 hashfzo0 14478 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ0 → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3230, 31syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3322, 24, 323eqtrd 2805 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑠) = (♯‘𝑊))
3419, 33eqtr2d 2802 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘(𝑊𝑠)))
3534oveq1d 7431 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) = ((♯‘(𝑊𝑠)) − 1))
3635oveq2d 7432 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((𝑊𝑠) prefix ((♯‘𝑊) − 1)) = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
375, 36eqtrid 2813 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑈 = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
3826ne0d 4298 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (0..^(♯‘𝑊)) ≠ ∅)
39 f0dom0 6766 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) = ∅ ↔ 𝑠 = ∅))
4039necon3bid 3005 . . . . . . . . . . . 12 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) ≠ ∅ ↔ 𝑠 ≠ ∅))
4140biimpa 482 . . . . . . . . . . 11 ((𝑠:(0..^(♯‘𝑊))⟶𝐽 ∧ (0..^(♯‘𝑊)) ≠ ∅) → 𝑠 ≠ ∅)
429, 38, 41syl2anc 596 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ≠ ∅)
43 lswco 14887 . . . . . . . . . 10 ((𝑠 ∈ Word 𝐽𝑠 ≠ ∅ ∧ 𝑊:𝐽𝑆) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
4411, 42, 17, 43syl3anc 1398 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
45 lsw 14612 . . . . . . . . . . . 12 (𝑠 ∈ Word 𝐽 → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4611, 45syl 18 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4733oveq1d 7431 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑠) − 1) = ((♯‘𝑊) − 1))
4847fveq2d 6889 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠‘((♯‘𝑠) − 1)) = (𝑠‘((♯‘𝑊) − 1)))
49 simpr 490 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠‘((♯‘𝑊) − 1)) = 𝐼)
5046, 48, 493eqtrd 2805 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = 𝐼)
5150fveq2d 6889 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊‘(lastS‘𝑠)) = (𝑊𝐼))
5244, 51eqtr2d 2802 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝐼) = (lastS‘(𝑊𝑠)))
5352s1eqd 14650 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ⟨“(𝑊𝐼)”⟩ = ⟨“(lastS‘(𝑊𝑠))”⟩)
5437, 53oveq12d 7434 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑈 ++ ⟨“(𝑊𝐼)”⟩) = (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩))
551, 4, 14wrdpmcl 33273 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ∈ Word 𝑆)
56 fzo0end 13798 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5729, 56syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5857, 1eleqtrrdi 2877 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ 𝐽)
5917fdmd 6720 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → dom 𝑊 = 𝐽)
6058, 59eleqtrrd 2869 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ dom 𝑊)
61 dff1o5 6834 . . . . . . . . . . . . 13 (𝑠:𝐽1-1-onto𝐽 ↔ (𝑠:𝐽1-1𝐽 ∧ ran 𝑠 = 𝐽))
6261simprbi 503 . . . . . . . . . . . 12 (𝑠:𝐽1-1-onto𝐽 → ran 𝑠 = 𝐽)
634, 62syl 18 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ran 𝑠 = 𝐽)
6458, 63eleqtrrd 2869 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ ran 𝑠)
6560, 64elind 4156 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (dom 𝑊 ∩ ran 𝑠))
6665ne0d 4298 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
67 coeq0 6260 . . . . . . . . 9 ((𝑊𝑠) = ∅ ↔ (dom 𝑊 ∩ ran 𝑠) = ∅)
6867necon3bii 3013 . . . . . . . 8 ((𝑊𝑠) ≠ ∅ ↔ (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
6966, 68sylibr 237 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ≠ ∅)
70 pfxlswccat 14761 . . . . . . 7 (((𝑊𝑠) ∈ Word 𝑆 ∧ (𝑊𝑠) ≠ ∅) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7155, 69, 70syl2anc 596 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7254, 71eqtr2d 2802 . . . . 5 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩))
734, 72jca 521 . . . 4 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠:𝐽1-1-onto𝐽 ∧ (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩)))
7473expl 463 . . 3 (𝜑 → ((𝑠:𝐽1-1-onto𝐽 ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠:𝐽1-1-onto𝐽 ∧ (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩))))
7574eximdv 1950 . 2 (𝜑 → (∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩))))
763, 75mpd 16 1 (𝜑 → ∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑊𝑠) = (𝑈 ++ ⟨“(𝑊𝐼)”⟩)))
Colors of variables:    wff setvar class
This proof depends on syntax axioms:  wi 4  wa 401   = wceq 1570  wex 1812  wcel 2146  wne 2961  cin 3907  c0 4289   class class class wbr 5112  dom cdm 5664  ran crn 5665  ccom 5668  Fun wfun 6534  wf 6536  1-1wf1 6537  1-1-ontowf1o 6539  cfv 6540  (class class class)co 7416  0cc0 11110  1c1 11111   < clt 11253  cmin 11451  cn 12243  0cn0 12514  ..^cfzo 13693  chash 14377  Word cword 14561  lastSclsw 14610   ++ cconcat 14618  ⟨“cs1 14644   prefix cpfx 14719
This proof depends on axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1828  ax-4 1842  ax-5 1943  ax-6 2000  ax-7 2041  ax-8 2148  ax-9 2156  ax-10 2179  ax-11 2195  ax-12 2216  ax-ext 2738  ax-rep 5241  ax-sep 5260  ax-nul 5272  ax-pow 5339  ax-pr 5407  ax-un 7738  ax-cnex 11166  ax-resscn 11167  ax-1cn 11168  ax-icn 11169  ax-addcl 11170  ax-addrcl 11171  ax-mulcl 11172  ax-mulrcl 11173  ax-mulcom 11174  ax-addass 11175  ax-mulass 11176  ax-distr 11177  ax-i2m1 11178  ax-1ne0 11179  ax-1rid 11180  ax-rnegex 11181  ax-rrecex 11182  ax-cnre 11183  ax-pre-lttri 11184  ax-pre-lttrn 11185  ax-pre-ltadd 11186  ax-pre-mulgt0 11187
This proof depends on definitions:  df-bi 210  df-an 402  df-or 862  df-3or 1104  df-3an 1105  df-tru 1573  df-fal 1583  df-ex 1813  df-nf 1817  df-sb 2100  df-mo 2570  df-eu 2600  df-clab 2745  df-cleq 2758  df-clel 2841  df-nfc 2915  df-ne 2962  df-nel 3068  df-ral 3083  df-rex 3093  df-reu 3373  df-rab 3420  df-v 3460  df-sbc 3748  df-csb 3857  df-dif 3911  df-un 3913  df-in 3915  df-ss 3925  df-pss 3928  df-nul 4290  df-if 4491  df-pw 4567  df-sn 4593  df-pr 4595  df-op 4599  df-uni 4876  df-int 4916  df-iun 4961  df-br 5113  df-opab 5177  df-mpt 5196  df-tr 5222  df-id 5559  df-eprel 5564  df-po 5572  df-so 5573  df-fr 5617  df-we 5619  df-xp 5670  df-rel 5671  df-cnv 5672  df-co 5673  df-dm 5674  df-rn 5675  df-res 5676  df-ima 5677  df-pred 6306  df-ord 6367  df-on 6368  df-lim 6369  df-suc 6370  df-iota 6496  df-fun 6542  df-fn 6543  df-f 6544  df-f1 6545  df-fo 6546  df-f1o 6547  df-fv 6548  df-riota 7373  df-ov 7419  df-oprab 7420  df-mpo 7421  df-om 7865  df-1st 7988  df-2nd 7989  df-frecs 8280  df-wrecs 8311  df-recs 8360  df-rdg 8399  df-1o 8455  df-2o 8456  df-oadd 8459  df-er 8696  df-en 8946  df-dom 8947  df-sdom 8948  df-fin 8949  df-dju 9898  df-card 9936  df-pnf 11255  df-mnf 11256  df-xr 11257  df-ltxr 11258  df-le 11259  df-sub 11453  df-neg 11454  df-nn 12244  df-2 12313  df-n0 12515  df-xnn0 12588  df-z 12602  df-uz 12873  df-fz 13546  df-fzo 13694  df-hash 14378  df-word 14562  df-lsw 14611  df-concat 14619  df-s1 14645  df-substr 14690  df-pfx 14720  df-pmtr 19522
This theorem is used by:  1arithidom  33840
  Copyright terms: Public domain W3C validator