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 33533
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 33532 . 2 (𝜑 → ∃𝑠(𝑠:𝐽1-1-onto𝐽 ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼))
4 simplr 781 . . . . 5 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠:𝐽1-1-onto𝐽)
5 wrdpmtrlast.4 . . . . . . . 8 𝑈 = ((𝑊𝑠) prefix ((♯‘𝑊) − 1))
6 f1of 6817 . . . . . . . . . . . . . . 15 (𝑠:𝐽1-1-onto𝐽𝑠:𝐽𝐽)
71feq2i 6694 . . . . . . . . . . . . . . 15 (𝑠:𝐽𝐽𝑠:(0..^(♯‘𝑊))⟶𝐽)
86, 7sylib 221 . . . . . . . . . . . . . 14 (𝑠:𝐽1-1-onto𝐽𝑠:(0..^(♯‘𝑊))⟶𝐽)
94, 8syl 18 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠:(0..^(♯‘𝑊))⟶𝐽)
10 iswrdi 14582 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽𝑠 ∈ Word 𝐽)
119, 10syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ∈ Word 𝐽)
12 eqidd 2761 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘𝑊))
13 wrdpmtrlast.3 . . . . . . . . . . . . . . 15 (𝜑𝑊 ∈ Word 𝑆)
1413ad2antrr 739 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊 ∈ Word 𝑆)
1512, 14wrdfd 14584 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:(0..^(♯‘𝑊))⟶𝑆)
161feq2i 6694 . . . . . . . . . . . . 13 (𝑊:𝐽𝑆𝑊:(0..^(♯‘𝑊))⟶𝑆)
1715, 16sylibr 237 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑊:𝐽𝑆)
18 lenco 14903 . . . . . . . . . . . 12 ((𝑠 ∈ Word 𝐽𝑊:𝐽𝑆) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
1911, 17, 18syl2anc 596 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(𝑊𝑠)) = (♯‘𝑠))
209ffund 6707 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → Fun 𝑠)
21 hashfundm 14507 . . . . . . . . . . . . 13 ((𝑠 ∈ Word 𝐽 ∧ Fun 𝑠) → (♯‘𝑠) = (♯‘dom 𝑠))
2211, 20, 21syl2anc 596 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑠) = (♯‘dom 𝑠))
239fdmd 6713 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → dom 𝑠 = (0..^(♯‘𝑊)))
2423fveq2d 6882 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘dom 𝑠) = (♯‘(0..^(♯‘𝑊))))
252, 1eleqtrdi 2870 . . . . . . . . . . . . . . . 16 (𝜑𝐼 ∈ (0..^(♯‘𝑊)))
2625ad2antrr 739 . . . . . . . . . . . . . . 15 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝐼 ∈ (0..^(♯‘𝑊)))
27 elfzo0 13756 . . . . . . . . . . . . . . . 16 (𝐼 ∈ (0..^(♯‘𝑊)) ↔ (𝐼 ∈ ℕ0 ∧ (♯‘𝑊) ∈ ℕ ∧ 𝐼 < (♯‘𝑊)))
2827simp2bi 1164 . . . . . . . . . . . . . . 15 (𝐼 ∈ (0..^(♯‘𝑊)) → (♯‘𝑊) ∈ ℕ)
2926, 28syl 18 . . . . . . . . . . . . . 14 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ)
3029nnnn0d 12589 . . . . . . . . . . . . 13 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) ∈ ℕ0)
31 hashfzo0 14495 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ0 → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3230, 31syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘(0..^(♯‘𝑊))) = (♯‘𝑊))
3322, 24, 323eqtrd 2799 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑠) = (♯‘𝑊))
3419, 33eqtr2d 2796 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (♯‘𝑊) = (♯‘(𝑊𝑠)))
3534oveq1d 7428 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) = ((♯‘(𝑊𝑠)) − 1))
3635oveq2d 7429 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((𝑊𝑠) prefix ((♯‘𝑊) − 1)) = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
375, 36eqtrid 2807 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑈 = ((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)))
3826ne0d 4288 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (0..^(♯‘𝑊)) ≠ ∅)
39 f0dom0 6759 . . . . . . . . . . . . 13 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) = ∅ ↔ 𝑠 = ∅))
4039necon3bid 2999 . . . . . . . . . . . 12 (𝑠:(0..^(♯‘𝑊))⟶𝐽 → ((0..^(♯‘𝑊)) ≠ ∅ ↔ 𝑠 ≠ ∅))
4140biimpa 482 . . . . . . . . . . 11 ((𝑠:(0..^(♯‘𝑊))⟶𝐽 ∧ (0..^(♯‘𝑊)) ≠ ∅) → 𝑠 ≠ ∅)
429, 38, 41syl2anc 596 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → 𝑠 ≠ ∅)
43 lswco 14910 . . . . . . . . . 10 ((𝑠 ∈ Word 𝐽𝑠 ≠ ∅ ∧ 𝑊:𝐽𝑆) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
4411, 42, 17, 43syl3anc 1398 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘(𝑊𝑠)) = (𝑊‘(lastS‘𝑠)))
45 lsw 14629 . . . . . . . . . . . 12 (𝑠 ∈ Word 𝐽 → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4611, 45syl 18 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = (𝑠‘((♯‘𝑠) − 1)))
4733oveq1d 7428 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑠) − 1) = ((♯‘𝑊) − 1))
4847fveq2d 6882 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠‘((♯‘𝑠) − 1)) = (𝑠‘((♯‘𝑊) − 1)))
49 simpr 490 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑠‘((♯‘𝑊) − 1)) = 𝐼)
5046, 48, 493eqtrd 2799 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (lastS‘𝑠) = 𝐼)
5150fveq2d 6882 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊‘(lastS‘𝑠)) = (𝑊𝐼))
5244, 51eqtr2d 2796 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝐼) = (lastS‘(𝑊𝑠)))
5352s1eqd 14668 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ⟨“(𝑊𝐼)”⟩ = ⟨“(lastS‘(𝑊𝑠))”⟩)
5437, 53oveq12d 7431 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑈 ++ ⟨“(𝑊𝐼)”⟩) = (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩))
551, 4, 14wrdpmcl 33384 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ∈ Word 𝑆)
56 fzo0end 13814 . . . . . . . . . . . . 13 ((♯‘𝑊) ∈ ℕ → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5729, 56syl 18 . . . . . . . . . . . 12 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (0..^(♯‘𝑊)))
5857, 1eleqtrrdi 2871 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ 𝐽)
5917fdmd 6713 . . . . . . . . . . 11 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → dom 𝑊 = 𝐽)
6058, 59eleqtrrd 2863 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ dom 𝑊)
61 dff1o5 6827 . . . . . . . . . . . . 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 2863 . . . . . . . . . 10 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ ran 𝑠)
6560, 64elind 4146 . . . . . . . . 9 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → ((♯‘𝑊) − 1) ∈ (dom 𝑊 ∩ ran 𝑠))
6665ne0d 4288 . . . . . . . 8 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
67 coeq0 6252 . . . . . . . . 9 ((𝑊𝑠) = ∅ ↔ (dom 𝑊 ∩ ran 𝑠) = ∅)
6867necon3bii 3007 . . . . . . . 8 ((𝑊𝑠) ≠ ∅ ↔ (dom 𝑊 ∩ ran 𝑠) ≠ ∅)
6966, 68sylibr 237 . . . . . . 7 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (𝑊𝑠) ≠ ∅)
70 pfxlswccat 14782 . . . . . . 7 (((𝑊𝑠) ∈ Word 𝑆 ∧ (𝑊𝑠) ≠ ∅) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7155, 69, 70syl2anc 596 . . . . . 6 (((𝜑𝑠:𝐽1-1-onto𝐽) ∧ (𝑠‘((♯‘𝑊) − 1)) = 𝐼) → (((𝑊𝑠) prefix ((♯‘(𝑊𝑠)) − 1)) ++ ⟨“(lastS‘(𝑊𝑠))”⟩) = (𝑊𝑠))
7254, 71eqtr2d 2796 . . . . 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 2145  wne 2955  cin 3898  c0 4279   class class class wbr 5103  dom cdm 5655  ran crn 5656  ccom 5659  Fun wfun 6527  wf 6529  1-1wf1 6530  1-1-ontowf1o 6532  cfv 6533  (class class class)co 7413  0cc0 11124  1c1 11125   < clt 11267  cmin 11465  cn 12257  0cn0 12528  ..^cfzo 13709  chash 14394  Word cword 14578  lastSclsw 14627   ++ cconcat 14635  ⟨“cs1 14662   prefix cpfx 14740
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 2147  ax-9 2155  ax-10 2178  ax-11 2194  ax-12 2213  ax-ext 2732  ax-rep 5232  ax-sep 5251  ax-nul 5263  ax-pow 5330  ax-pr 5398  ax-un 7736  ax-cnex 11180  ax-resscn 11181  ax-1cn 11182  ax-icn 11183  ax-addcl 11184  ax-addrcl 11185  ax-mulcl 11186  ax-mulrcl 11187  ax-mulcom 11188  ax-addass 11189  ax-mulass 11190  ax-distr 11191  ax-i2m1 11192  ax-1ne0 11193  ax-1rid 11194  ax-rnegex 11195  ax-rrecex 11196  ax-cnre 11197  ax-pre-lttri 11198  ax-pre-lttrn 11199  ax-pre-ltadd 11200  ax-pre-mulgt0 11201
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 2564  df-eu 2594  df-clab 2739  df-cleq 2752  df-clel 2835  df-nfc 2909  df-ne 2956  df-nel 3062  df-ral 3077  df-rex 3087  df-reu 3366  df-rab 3413  df-v 3452  df-sbc 3740  df-csb 3848  df-dif 3902  df-un 3904  df-in 3906  df-ss 3916  df-pss 3919  df-nul 4280  df-if 4483  df-pw 4559  df-sn 4585  df-pr 4587  df-op 4591  df-uni 4868  df-int 4908  df-iun 4953  df-br 5104  df-opab 5168  df-mpt 5187  df-tr 5213  df-id 5550  df-eprel 5555  df-po 5563  df-so 5564  df-fr 5608  df-we 5610  df-xp 5661  df-rel 5662  df-cnv 5663  df-co 5664  df-dm 5665  df-rn 5666  df-res 5667  df-ima 5668  df-pred 6299  df-ord 6360  df-on 6361  df-lim 6362  df-suc 6363  df-iota 6489  df-fun 6535  df-fn 6536  df-f 6537  df-f1 6538  df-fo 6539  df-f1o 6540  df-fv 6541  df-riota 7370  df-ov 7416  df-oprab 7417  df-mpo 7418  df-om 7863  df-1st 7986  df-2nd 7987  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 8953  df-dom 8954  df-sdom 8955  df-fin 8956  df-dju 9906  df-card 9944  df-pnf 11269  df-mnf 11270  df-xr 11271  df-ltxr 11272  df-le 11273  df-sub 11467  df-neg 11468  df-nn 12258  df-2 12327  df-n0 12529  df-xnn0 12602  df-z 12616  df-uz 12888  df-fz 13562  df-fzo 13710  df-hash 14395  df-word 14579  df-lsw 14628  df-concat 14636  df-s1 14663  df-substr 14709  df-pfx 14741  df-pmtr 19569
This theorem is used by:  1arithidom  33947
  Copyright terms: Public domain W3C validator