Metamath Proof Explorer


Theorem efgredlema

Description: The reduced word that forms the base of the sequence in efgsval is uniquely determined, given the ending representation. (Contributed by Mario Carneiro, 1-Oct-2015)

Ref Expression
Hypotheses efgval.w 𝑊 = ( I ‘ Word ( 𝐼 × 2o ) )
efgval.r = ( ~FG𝐼 )
efgval2.m 𝑀 = ( 𝑦𝐼 , 𝑧 ∈ 2o ↦ ⟨ 𝑦 , ( 1o𝑧 ) ⟩ )
efgval2.t 𝑇 = ( 𝑣𝑊 ↦ ( 𝑛 ∈ ( 0 ... ( ♯ ‘ 𝑣 ) ) , 𝑤 ∈ ( 𝐼 × 2o ) ↦ ( 𝑣 splice ⟨ 𝑛 , 𝑛 , ⟨“ 𝑤 ( 𝑀𝑤 ) ”⟩ ⟩ ) ) )
efgred.d 𝐷 = ( 𝑊 𝑥𝑊 ran ( 𝑇𝑥 ) )
efgred.s 𝑆 = ( 𝑚 ∈ { 𝑡 ∈ ( Word 𝑊 ∖ { ∅ } ) ∣ ( ( 𝑡 ‘ 0 ) ∈ 𝐷 ∧ ∀ 𝑘 ∈ ( 1 ..^ ( ♯ ‘ 𝑡 ) ) ( 𝑡𝑘 ) ∈ ran ( 𝑇 ‘ ( 𝑡 ‘ ( 𝑘 − 1 ) ) ) ) } ↦ ( 𝑚 ‘ ( ( ♯ ‘ 𝑚 ) − 1 ) ) )
efgredlem.1 ( 𝜑 → ∀ 𝑎 ∈ dom 𝑆𝑏 ∈ dom 𝑆 ( ( ♯ ‘ ( 𝑆𝑎 ) ) < ( ♯ ‘ ( 𝑆𝐴 ) ) → ( ( 𝑆𝑎 ) = ( 𝑆𝑏 ) → ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) ) ) )
efgredlem.2 ( 𝜑𝐴 ∈ dom 𝑆 )
efgredlem.3 ( 𝜑𝐵 ∈ dom 𝑆 )
efgredlem.4 ( 𝜑 → ( 𝑆𝐴 ) = ( 𝑆𝐵 ) )
efgredlem.5 ( 𝜑 → ¬ ( 𝐴 ‘ 0 ) = ( 𝐵 ‘ 0 ) )
Assertion efgredlema ( 𝜑 → ( ( ( ♯ ‘ 𝐴 ) − 1 ) ∈ ℕ ∧ ( ( ♯ ‘ 𝐵 ) − 1 ) ∈ ℕ ) )

Proof

Step Hyp Ref Expression
1 efgval.w 𝑊 = ( I ‘ Word ( 𝐼 × 2o ) )
2 efgval.r = ( ~FG𝐼 )
3 efgval2.m 𝑀 = ( 𝑦𝐼 , 𝑧 ∈ 2o ↦ ⟨ 𝑦 , ( 1o𝑧 ) ⟩ )
4 efgval2.t 𝑇 = ( 𝑣𝑊 ↦ ( 𝑛 ∈ ( 0 ... ( ♯ ‘ 𝑣 ) ) , 𝑤 ∈ ( 𝐼 × 2o ) ↦ ( 𝑣 splice ⟨ 𝑛 , 𝑛 , ⟨“ 𝑤 ( 𝑀𝑤 ) ”⟩ ⟩ ) ) )
5 efgred.d 𝐷 = ( 𝑊 𝑥𝑊 ran ( 𝑇𝑥 ) )
6 efgred.s 𝑆 = ( 𝑚 ∈ { 𝑡 ∈ ( Word 𝑊 ∖ { ∅ } ) ∣ ( ( 𝑡 ‘ 0 ) ∈ 𝐷 ∧ ∀ 𝑘 ∈ ( 1 ..^ ( ♯ ‘ 𝑡 ) ) ( 𝑡𝑘 ) ∈ ran ( 𝑇 ‘ ( 𝑡 ‘ ( 𝑘 − 1 ) ) ) ) } ↦ ( 𝑚 ‘ ( ( ♯ ‘ 𝑚 ) − 1 ) ) )
7 efgredlem.1 ( 𝜑 → ∀ 𝑎 ∈ dom 𝑆𝑏 ∈ dom 𝑆 ( ( ♯ ‘ ( 𝑆𝑎 ) ) < ( ♯ ‘ ( 𝑆𝐴 ) ) → ( ( 𝑆𝑎 ) = ( 𝑆𝑏 ) → ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) ) ) )
8 efgredlem.2 ( 𝜑𝐴 ∈ dom 𝑆 )
9 efgredlem.3 ( 𝜑𝐵 ∈ dom 𝑆 )
10 efgredlem.4 ( 𝜑 → ( 𝑆𝐴 ) = ( 𝑆𝐵 ) )
11 efgredlem.5 ( 𝜑 → ¬ ( 𝐴 ‘ 0 ) = ( 𝐵 ‘ 0 ) )
12 1 2 3 4 5 6 efgsval ( 𝐵 ∈ dom 𝑆 → ( 𝑆𝐵 ) = ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) )
13 9 12 syl ( 𝜑 → ( 𝑆𝐵 ) = ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) )
14 1 2 3 4 5 6 efgsval ( 𝐴 ∈ dom 𝑆 → ( 𝑆𝐴 ) = ( 𝐴 ‘ ( ( ♯ ‘ 𝐴 ) − 1 ) ) )
15 8 14 syl ( 𝜑 → ( 𝑆𝐴 ) = ( 𝐴 ‘ ( ( ♯ ‘ 𝐴 ) − 1 ) ) )
16 10 15 eqtr3d ( 𝜑 → ( 𝑆𝐵 ) = ( 𝐴 ‘ ( ( ♯ ‘ 𝐴 ) − 1 ) ) )
17 13 16 eqtr3d ( 𝜑 → ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) = ( 𝐴 ‘ ( ( ♯ ‘ 𝐴 ) − 1 ) ) )
18 oveq1 ( ( ♯ ‘ 𝐴 ) = 1 → ( ( ♯ ‘ 𝐴 ) − 1 ) = ( 1 − 1 ) )
19 1m1e0 ( 1 − 1 ) = 0
20 18 19 eqtrdi ( ( ♯ ‘ 𝐴 ) = 1 → ( ( ♯ ‘ 𝐴 ) − 1 ) = 0 )
21 20 fveq2d ( ( ♯ ‘ 𝐴 ) = 1 → ( 𝐴 ‘ ( ( ♯ ‘ 𝐴 ) − 1 ) ) = ( 𝐴 ‘ 0 ) )
22 17 21 sylan9eq ( ( 𝜑 ∧ ( ♯ ‘ 𝐴 ) = 1 ) → ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) = ( 𝐴 ‘ 0 ) )
23 10 eleq1d ( 𝜑 → ( ( 𝑆𝐴 ) ∈ 𝐷 ↔ ( 𝑆𝐵 ) ∈ 𝐷 ) )
24 1 2 3 4 5 6 efgs1b ( 𝐴 ∈ dom 𝑆 → ( ( 𝑆𝐴 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝐴 ) = 1 ) )
25 8 24 syl ( 𝜑 → ( ( 𝑆𝐴 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝐴 ) = 1 ) )
26 1 2 3 4 5 6 efgs1b ( 𝐵 ∈ dom 𝑆 → ( ( 𝑆𝐵 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝐵 ) = 1 ) )
27 9 26 syl ( 𝜑 → ( ( 𝑆𝐵 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝐵 ) = 1 ) )
28 23 25 27 3bitr3d ( 𝜑 → ( ( ♯ ‘ 𝐴 ) = 1 ↔ ( ♯ ‘ 𝐵 ) = 1 ) )
29 28 biimpa ( ( 𝜑 ∧ ( ♯ ‘ 𝐴 ) = 1 ) → ( ♯ ‘ 𝐵 ) = 1 )
30 oveq1 ( ( ♯ ‘ 𝐵 ) = 1 → ( ( ♯ ‘ 𝐵 ) − 1 ) = ( 1 − 1 ) )
31 30 19 eqtrdi ( ( ♯ ‘ 𝐵 ) = 1 → ( ( ♯ ‘ 𝐵 ) − 1 ) = 0 )
32 31 fveq2d ( ( ♯ ‘ 𝐵 ) = 1 → ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) = ( 𝐵 ‘ 0 ) )
33 29 32 syl ( ( 𝜑 ∧ ( ♯ ‘ 𝐴 ) = 1 ) → ( 𝐵 ‘ ( ( ♯ ‘ 𝐵 ) − 1 ) ) = ( 𝐵 ‘ 0 ) )
34 22 33 eqtr3d ( ( 𝜑 ∧ ( ♯ ‘ 𝐴 ) = 1 ) → ( 𝐴 ‘ 0 ) = ( 𝐵 ‘ 0 ) )
35 11 34 mtand ( 𝜑 → ¬ ( ♯ ‘ 𝐴 ) = 1 )
36 1 2 3 4 5 6 efgsdm ( 𝐴 ∈ dom 𝑆 ↔ ( 𝐴 ∈ ( Word 𝑊 ∖ { ∅ } ) ∧ ( 𝐴 ‘ 0 ) ∈ 𝐷 ∧ ∀ 𝑢 ∈ ( 1 ..^ ( ♯ ‘ 𝐴 ) ) ( 𝐴𝑢 ) ∈ ran ( 𝑇 ‘ ( 𝐴 ‘ ( 𝑢 − 1 ) ) ) ) )
37 36 simp1bi ( 𝐴 ∈ dom 𝑆𝐴 ∈ ( Word 𝑊 ∖ { ∅ } ) )
38 eldifsn ( 𝐴 ∈ ( Word 𝑊 ∖ { ∅ } ) ↔ ( 𝐴 ∈ Word 𝑊𝐴 ≠ ∅ ) )
39 lennncl ( ( 𝐴 ∈ Word 𝑊𝐴 ≠ ∅ ) → ( ♯ ‘ 𝐴 ) ∈ ℕ )
40 38 39 sylbi ( 𝐴 ∈ ( Word 𝑊 ∖ { ∅ } ) → ( ♯ ‘ 𝐴 ) ∈ ℕ )
41 8 37 40 3syl ( 𝜑 → ( ♯ ‘ 𝐴 ) ∈ ℕ )
42 elnn1uz2 ( ( ♯ ‘ 𝐴 ) ∈ ℕ ↔ ( ( ♯ ‘ 𝐴 ) = 1 ∨ ( ♯ ‘ 𝐴 ) ∈ ( ℤ ‘ 2 ) ) )
43 41 42 sylib ( 𝜑 → ( ( ♯ ‘ 𝐴 ) = 1 ∨ ( ♯ ‘ 𝐴 ) ∈ ( ℤ ‘ 2 ) ) )
44 43 ord ( 𝜑 → ( ¬ ( ♯ ‘ 𝐴 ) = 1 → ( ♯ ‘ 𝐴 ) ∈ ( ℤ ‘ 2 ) ) )
45 35 44 mpd ( 𝜑 → ( ♯ ‘ 𝐴 ) ∈ ( ℤ ‘ 2 ) )
46 uz2m1nn ( ( ♯ ‘ 𝐴 ) ∈ ( ℤ ‘ 2 ) → ( ( ♯ ‘ 𝐴 ) − 1 ) ∈ ℕ )
47 45 46 syl ( 𝜑 → ( ( ♯ ‘ 𝐴 ) − 1 ) ∈ ℕ )
48 35 28 mtbid ( 𝜑 → ¬ ( ♯ ‘ 𝐵 ) = 1 )
49 1 2 3 4 5 6 efgsdm ( 𝐵 ∈ dom 𝑆 ↔ ( 𝐵 ∈ ( Word 𝑊 ∖ { ∅ } ) ∧ ( 𝐵 ‘ 0 ) ∈ 𝐷 ∧ ∀ 𝑢 ∈ ( 1 ..^ ( ♯ ‘ 𝐵 ) ) ( 𝐵𝑢 ) ∈ ran ( 𝑇 ‘ ( 𝐵 ‘ ( 𝑢 − 1 ) ) ) ) )
50 49 simp1bi ( 𝐵 ∈ dom 𝑆𝐵 ∈ ( Word 𝑊 ∖ { ∅ } ) )
51 eldifsn ( 𝐵 ∈ ( Word 𝑊 ∖ { ∅ } ) ↔ ( 𝐵 ∈ Word 𝑊𝐵 ≠ ∅ ) )
52 lennncl ( ( 𝐵 ∈ Word 𝑊𝐵 ≠ ∅ ) → ( ♯ ‘ 𝐵 ) ∈ ℕ )
53 51 52 sylbi ( 𝐵 ∈ ( Word 𝑊 ∖ { ∅ } ) → ( ♯ ‘ 𝐵 ) ∈ ℕ )
54 9 50 53 3syl ( 𝜑 → ( ♯ ‘ 𝐵 ) ∈ ℕ )
55 elnn1uz2 ( ( ♯ ‘ 𝐵 ) ∈ ℕ ↔ ( ( ♯ ‘ 𝐵 ) = 1 ∨ ( ♯ ‘ 𝐵 ) ∈ ( ℤ ‘ 2 ) ) )
56 54 55 sylib ( 𝜑 → ( ( ♯ ‘ 𝐵 ) = 1 ∨ ( ♯ ‘ 𝐵 ) ∈ ( ℤ ‘ 2 ) ) )
57 56 ord ( 𝜑 → ( ¬ ( ♯ ‘ 𝐵 ) = 1 → ( ♯ ‘ 𝐵 ) ∈ ( ℤ ‘ 2 ) ) )
58 48 57 mpd ( 𝜑 → ( ♯ ‘ 𝐵 ) ∈ ( ℤ ‘ 2 ) )
59 uz2m1nn ( ( ♯ ‘ 𝐵 ) ∈ ( ℤ ‘ 2 ) → ( ( ♯ ‘ 𝐵 ) − 1 ) ∈ ℕ )
60 58 59 syl ( 𝜑 → ( ( ♯ ‘ 𝐵 ) − 1 ) ∈ ℕ )
61 47 60 jca ( 𝜑 → ( ( ( ♯ ‘ 𝐴 ) − 1 ) ∈ ℕ ∧ ( ( ♯ ‘ 𝐵 ) − 1 ) ∈ ℕ ) )