Metamath Proof Explorer


Theorem efgredeu

Description: There is a unique reduced word equivalent to a given word. (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 ) ) )
Assertion efgredeu ( 𝐴𝑊 → ∃! 𝑑𝐷 𝑑 𝐴 )

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 1 2 3 4 5 6 efgsfo 𝑆 : dom 𝑆onto𝑊
8 foelrn ( ( 𝑆 : dom 𝑆onto𝑊𝐴𝑊 ) → ∃ 𝑎 ∈ dom 𝑆 𝐴 = ( 𝑆𝑎 ) )
9 7 8 mpan ( 𝐴𝑊 → ∃ 𝑎 ∈ dom 𝑆 𝐴 = ( 𝑆𝑎 ) )
10 1 2 3 4 5 6 efgsdm ( 𝑎 ∈ dom 𝑆 ↔ ( 𝑎 ∈ ( Word 𝑊 ∖ { ∅ } ) ∧ ( 𝑎 ‘ 0 ) ∈ 𝐷 ∧ ∀ 𝑖 ∈ ( 1 ..^ ( ♯ ‘ 𝑎 ) ) ( 𝑎𝑖 ) ∈ ran ( 𝑇 ‘ ( 𝑎 ‘ ( 𝑖 − 1 ) ) ) ) )
11 10 simp2bi ( 𝑎 ∈ dom 𝑆 → ( 𝑎 ‘ 0 ) ∈ 𝐷 )
12 1 2 3 4 5 6 efgsrel ( 𝑎 ∈ dom 𝑆 → ( 𝑎 ‘ 0 ) ( 𝑆𝑎 ) )
13 12 adantl ( ( 𝐴𝑊𝑎 ∈ dom 𝑆 ) → ( 𝑎 ‘ 0 ) ( 𝑆𝑎 ) )
14 breq1 ( 𝑑 = ( 𝑎 ‘ 0 ) → ( 𝑑 ( 𝑆𝑎 ) ↔ ( 𝑎 ‘ 0 ) ( 𝑆𝑎 ) ) )
15 14 rspcev ( ( ( 𝑎 ‘ 0 ) ∈ 𝐷 ∧ ( 𝑎 ‘ 0 ) ( 𝑆𝑎 ) ) → ∃ 𝑑𝐷 𝑑 ( 𝑆𝑎 ) )
16 11 13 15 syl2an2 ( ( 𝐴𝑊𝑎 ∈ dom 𝑆 ) → ∃ 𝑑𝐷 𝑑 ( 𝑆𝑎 ) )
17 breq2 ( 𝐴 = ( 𝑆𝑎 ) → ( 𝑑 𝐴𝑑 ( 𝑆𝑎 ) ) )
18 17 rexbidv ( 𝐴 = ( 𝑆𝑎 ) → ( ∃ 𝑑𝐷 𝑑 𝐴 ↔ ∃ 𝑑𝐷 𝑑 ( 𝑆𝑎 ) ) )
19 16 18 syl5ibrcom ( ( 𝐴𝑊𝑎 ∈ dom 𝑆 ) → ( 𝐴 = ( 𝑆𝑎 ) → ∃ 𝑑𝐷 𝑑 𝐴 ) )
20 19 rexlimdva ( 𝐴𝑊 → ( ∃ 𝑎 ∈ dom 𝑆 𝐴 = ( 𝑆𝑎 ) → ∃ 𝑑𝐷 𝑑 𝐴 ) )
21 9 20 mpd ( 𝐴𝑊 → ∃ 𝑑𝐷 𝑑 𝐴 )
22 1 2 efger Er 𝑊
23 22 a1i ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → Er 𝑊 )
24 simprl ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → 𝑑 𝐴 )
25 simprr ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → 𝑐 𝐴 )
26 23 24 25 ertr4d ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → 𝑑 𝑐 )
27 1 2 3 4 5 6 efgrelex ( 𝑑 𝑐 → ∃ 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∃ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) )
28 fofn ( 𝑆 : dom 𝑆onto𝑊𝑆 Fn dom 𝑆 )
29 fniniseg ( 𝑆 Fn dom 𝑆 → ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ↔ ( 𝑎 ∈ dom 𝑆 ∧ ( 𝑆𝑎 ) = 𝑑 ) ) )
30 7 28 29 mp2b ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ↔ ( 𝑎 ∈ dom 𝑆 ∧ ( 𝑆𝑎 ) = 𝑑 ) )
31 30 simplbi ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) → 𝑎 ∈ dom 𝑆 )
32 31 ad2antrl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → 𝑎 ∈ dom 𝑆 )
33 1 2 3 4 5 6 efgsval ( 𝑎 ∈ dom 𝑆 → ( 𝑆𝑎 ) = ( 𝑎 ‘ ( ( ♯ ‘ 𝑎 ) − 1 ) ) )
34 32 33 syl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑎 ) = ( 𝑎 ‘ ( ( ♯ ‘ 𝑎 ) − 1 ) ) )
35 30 simprbi ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) → ( 𝑆𝑎 ) = 𝑑 )
36 35 ad2antrl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑎 ) = 𝑑 )
37 simpllr ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑑𝐷𝑐𝐷 ) )
38 37 simpld ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → 𝑑𝐷 )
39 36 38 eqeltrd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑎 ) ∈ 𝐷 )
40 1 2 3 4 5 6 efgs1b ( 𝑎 ∈ dom 𝑆 → ( ( 𝑆𝑎 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝑎 ) = 1 ) )
41 32 40 syl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( 𝑆𝑎 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝑎 ) = 1 ) )
42 39 41 mpbid ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ♯ ‘ 𝑎 ) = 1 )
43 42 oveq1d ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( ♯ ‘ 𝑎 ) − 1 ) = ( 1 − 1 ) )
44 1m1e0 ( 1 − 1 ) = 0
45 43 44 eqtrdi ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( ♯ ‘ 𝑎 ) − 1 ) = 0 )
46 45 fveq2d ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑎 ‘ ( ( ♯ ‘ 𝑎 ) − 1 ) ) = ( 𝑎 ‘ 0 ) )
47 34 36 46 3eqtr3rd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑎 ‘ 0 ) = 𝑑 )
48 fniniseg ( 𝑆 Fn dom 𝑆 → ( 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ↔ ( 𝑏 ∈ dom 𝑆 ∧ ( 𝑆𝑏 ) = 𝑐 ) ) )
49 7 28 48 mp2b ( 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ↔ ( 𝑏 ∈ dom 𝑆 ∧ ( 𝑆𝑏 ) = 𝑐 ) )
50 49 simplbi ( 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) → 𝑏 ∈ dom 𝑆 )
51 50 ad2antll ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → 𝑏 ∈ dom 𝑆 )
52 1 2 3 4 5 6 efgsval ( 𝑏 ∈ dom 𝑆 → ( 𝑆𝑏 ) = ( 𝑏 ‘ ( ( ♯ ‘ 𝑏 ) − 1 ) ) )
53 51 52 syl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑏 ) = ( 𝑏 ‘ ( ( ♯ ‘ 𝑏 ) − 1 ) ) )
54 49 simprbi ( 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) → ( 𝑆𝑏 ) = 𝑐 )
55 54 ad2antll ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑏 ) = 𝑐 )
56 37 simprd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → 𝑐𝐷 )
57 55 56 eqeltrd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑆𝑏 ) ∈ 𝐷 )
58 1 2 3 4 5 6 efgs1b ( 𝑏 ∈ dom 𝑆 → ( ( 𝑆𝑏 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝑏 ) = 1 ) )
59 51 58 syl ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( 𝑆𝑏 ) ∈ 𝐷 ↔ ( ♯ ‘ 𝑏 ) = 1 ) )
60 57 59 mpbid ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ♯ ‘ 𝑏 ) = 1 )
61 60 oveq1d ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( ♯ ‘ 𝑏 ) − 1 ) = ( 1 − 1 ) )
62 61 44 eqtrdi ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( ♯ ‘ 𝑏 ) − 1 ) = 0 )
63 62 fveq2d ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑏 ‘ ( ( ♯ ‘ 𝑏 ) − 1 ) ) = ( 𝑏 ‘ 0 ) )
64 53 55 63 3eqtr3rd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( 𝑏 ‘ 0 ) = 𝑐 )
65 47 64 eqeq12d ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) ↔ 𝑑 = 𝑐 ) )
66 65 biimpd ( ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) ∧ ( 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∧ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ) ) → ( ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) → 𝑑 = 𝑐 ) )
67 66 rexlimdvva ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → ( ∃ 𝑎 ∈ ( 𝑆 “ { 𝑑 } ) ∃ 𝑏 ∈ ( 𝑆 “ { 𝑐 } ) ( 𝑎 ‘ 0 ) = ( 𝑏 ‘ 0 ) → 𝑑 = 𝑐 ) )
68 27 67 syl5 ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → ( 𝑑 𝑐𝑑 = 𝑐 ) )
69 26 68 mpd ( ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) ∧ ( 𝑑 𝐴𝑐 𝐴 ) ) → 𝑑 = 𝑐 )
70 69 ex ( ( 𝐴𝑊 ∧ ( 𝑑𝐷𝑐𝐷 ) ) → ( ( 𝑑 𝐴𝑐 𝐴 ) → 𝑑 = 𝑐 ) )
71 70 ralrimivva ( 𝐴𝑊 → ∀ 𝑑𝐷𝑐𝐷 ( ( 𝑑 𝐴𝑐 𝐴 ) → 𝑑 = 𝑐 ) )
72 breq1 ( 𝑑 = 𝑐 → ( 𝑑 𝐴𝑐 𝐴 ) )
73 72 reu4 ( ∃! 𝑑𝐷 𝑑 𝐴 ↔ ( ∃ 𝑑𝐷 𝑑 𝐴 ∧ ∀ 𝑑𝐷𝑐𝐷 ( ( 𝑑 𝐴𝑐 𝐴 ) → 𝑑 = 𝑐 ) ) )
74 21 71 73 sylanbrc ( 𝐴𝑊 → ∃! 𝑑𝐷 𝑑 𝐴 )