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 33477
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 33476 . 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 14572 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽𝑠 ∈ Word 𝐽)
119, 10syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ∈ Word 𝐽)
12 eqidd 2766 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘𝑊))
13 wrdpmtrlast.3 . . . . . . . . . . . . . . 15 (𝜑𝑊 ∈ Word 𝑆)
1413ad2antrr 739 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊 ∈ Word 𝑆)
1512, 14wrdfd 14574 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:(0..^(♯‘𝑊))⟶𝑆)
161feq2i 6701 . . . . . . . . . . . . 13 (𝑊:𝐽𝑆𝑊:(0..^(♯‘𝑊))⟶𝑆)
1715, 16sylibr 237 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:𝐽𝑆)
18 lenco 14893 . . . . . . . . . . . 12 ((𝑠 ∈ Word 𝐽𝑊:𝐽𝑆) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
1911, 17, 18syl2anc 596 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
209ffund 6714 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → Fun 𝑠)
21 hashfundm 14497 . . . . . . . . . . . . 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 2875 . . . . . . . . . . . . . . . 16 (𝜑𝐼 ∈ (0..^(♯‘𝑊)))
2625ad2antrr 739 . . . . . . . . . . . . . . 15 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝐼 ∈ (0..^(♯‘𝑊)))
27 elfzo0 13746 . . . . . . . . . . . . . . . 16 (𝐼 ∈ (0..^(♯‘𝑊)) ↔ (𝐼 ∈ ℕ0 ∧ (♯‘𝑊) ∈ ℕ ∧ 𝐼 < (♯‘𝑊)))
2827simp2bi 1164 . . . . . . . . . . . . . . 15 (𝐼 ∈ (0..^(♯‘𝑊)) → (♯‘𝑊) ∈ ℕ)
2926, 28syl 18 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ)
3029nnnn0d 12580 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ0)
31 hashfzo0 14485 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ0 → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3230, 31syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3322, 24, 323eqtrd 2804 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑠) = (♯‘𝑊))
3419, 33eqtr2d 2801 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘(𝑊𝑠)))
3534oveq1d 7434 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) = ((♯‘(𝑊𝑠)) − 1))
3635oveq2d 7435 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((𝑊𝑠) prefix ((♯‘𝑊) − 1)) = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
375, 36eqtrid 2812 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑈 = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
3826ne0d 4295 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (0..^(♯‘𝑊)) ≠ ∅)
39 f0dom0 6766 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) = ∅ ↔ 𝑠 = ∅))
4039necon3bid 3004 . . . . . . . . . . . 12 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) ≠ ∅ ↔ 𝑠 ≠ ∅))
4140biimpa 482 . . . . . . . . . . 11 ((𝑠:(0..^(♯‘𝑊))⟶𝐽 ∧ (0..^(♯‘𝑊)) ≠ ∅) → 𝑠 ≠ ∅)
429, 38, 41syl2anc 596 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ≠ ∅)
43 lswco 14900 . . . . . . . . . 10 ((𝑠 ∈ Word 𝐽𝑠 ≠ ∅ ∧ 𝑊:𝐽𝑆) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
4411, 42, 17, 43syl3anc 1398 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
45 lsw 14619 . . . . . . . . . . . 12 (𝑠 ∈ Word 𝐽 → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4611, 45syl 18 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4733oveq1d 7434 . . . . . . . . . . . 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 2804 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = 𝐼)
5150fveq2d 6889 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊‘(lastS‘𝑠)) = (𝑊𝐼))
5244, 51eqtr2d 2801 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝐼) = (lastS‘(𝑊𝑠)))
5352s1eqd 14658 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ⟨“(𝑊𝐼)”⟩ = ⟨“(lastS‘(𝑊𝑠))”⟩)
5437, 53oveq12d 7437 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑈 ++ ⟨“(𝑊𝐼)”⟩) = (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩))
551, 4, 14wrdpmcl 33328 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ∈ Word 𝑆)
56 fzo0end 13804 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5729, 56syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5857, 1eleqtrrdi 2876 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ 𝐽)
5917fdmd 6720 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → dom 𝑊 = 𝐽)
6058, 59eleqtrrd 2868 . . . . . . . . . 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 2868 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ ran 𝑠)
6560, 64elind 4153 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (dom 𝑊 ∩ ran 𝑠))
6665ne0d 4295 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
67 coeq0 6259 . . . . . . . . 9 ((𝑊𝑠) = ∅ ↔ (dom 𝑊 ∩ ran 𝑠) = ∅)
6867necon3bii 3012 . . . . . . . 8 ((𝑊𝑠) ≠ ∅ ↔ (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
6966, 68sylibr 237 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ≠ ∅)
70 pfxlswccat 14772 . . . . . . 7 (((𝑊𝑠) ∈ Word 𝑆 ∧ (𝑊𝑠) ≠ ∅) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7155, 69, 70syl2anc 596 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7254, 71eqtr2d 2801 . . . . 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 2960  cin 3905  c0 4286   class class class wbr 5111  dom cdm 5663  ran crn 5664  ccom 5667  Fun wfun 6534  wf 6536  1-1wf1 6537  1-1-ontowf1o 6539  cfv 6540  (class class class)co 7419  0cc0 11115  1c1 11116   < clt 11258  cmin 11456  cn 12248  0cn0 12519  ..^cfzo 13699  chash 14384  Word cword 14568  lastSclsw 14617   ++ cconcat 14625  ⟨“cs1 14652   prefix cpfx 14730
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 2737  ax-rep 5240  ax-sep 5259  ax-nul 5271  ax-pow 5338  ax-pr 5406  ax-un 7742  ax-cnex 11171  ax-resscn 11172  ax-1cn 11173  ax-icn 11174  ax-addcl 11175  ax-addrcl 11176  ax-mulcl 11177  ax-mulrcl 11178  ax-mulcom 11179  ax-addass 11180  ax-mulass 11181  ax-distr 11182  ax-i2m1 11183  ax-1ne0 11184  ax-1rid 11185  ax-rnegex 11186  ax-rrecex 11187  ax-cnre 11188  ax-pre-lttri 11189  ax-pre-lttrn 11190  ax-pre-ltadd 11191  ax-pre-mulgt0 11192
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 2569  df-eu 2599  df-clab 2744  df-cleq 2757  df-clel 2840  df-nfc 2914  df-ne 2961  df-nel 3067  df-ral 3082  df-rex 3092  df-reu 3372  df-rab 3419  df-v 3459  df-sbc 3747  df-csb 3855  df-dif 3909  df-un 3911  df-in 3913  df-ss 3923  df-pss 3926  df-nul 4287  df-if 4490  df-pw 4566  df-sn 4592  df-pr 4594  df-op 4598  df-uni 4875  df-int 4915  df-iun 4960  df-br 5112  df-opab 5176  df-mpt 5195  df-tr 5221  df-id 5558  df-eprel 5563  df-po 5571  df-so 5572  df-fr 5616  df-we 5618  df-xp 5669  df-rel 5670  df-cnv 5671  df-co 5672  df-dm 5673  df-rn 5674  df-res 5675  df-ima 5676  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 7376  df-ov 7422  df-oprab 7423  df-mpo 7424  df-om 7869  df-1st 7992  df-2nd 7993  df-frecs 8284  df-wrecs 8315  df-recs 8364  df-rdg 8403  df-1o 8459  df-2o 8460  df-oadd 8463  df-er 8700  df-en 8950  df-dom 8951  df-sdom 8952  df-fin 8953  df-dju 9903  df-card 9941  df-pnf 11260  df-mnf 11261  df-xr 11262  df-ltxr 11263  df-le 11264  df-sub 11458  df-neg 11459  df-nn 12249  df-2 12318  df-n0 12520  df-xnn0 12593  df-z 12607  df-uz 12879  df-fz 13552  df-fzo 13700  df-hash 14385  df-word 14569  df-lsw 14618  df-concat 14626  df-s1 14653  df-substr 14699  df-pfx 14731  df-pmtr 19556
This theorem is used by:  1arithidom  33891
  Copyright terms: Public domain W3C validator