Metamath Proof Explorer


Theorem efgsval2

Description: Value of the auxiliary function S defining a sequence of extensions. (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 efgsval2 ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ∧ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ∈ dom 𝑆 ) → ( 𝑆 ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = 𝐵 )

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 efgsval ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ∈ dom 𝑆 → ( 𝑆 ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) − 1 ) ) )
8 s1cl ( 𝐵𝑊 → ⟨“ 𝐵 ”⟩ ∈ Word 𝑊 )
9 ccatlen ( ( 𝐴 ∈ Word 𝑊 ∧ ⟨“ 𝐵 ”⟩ ∈ Word 𝑊 ) → ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = ( ( ♯ ‘ 𝐴 ) + ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) )
10 8 9 sylan2 ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = ( ( ♯ ‘ 𝐴 ) + ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) )
11 s1len ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) = 1
12 11 oveq2i ( ( ♯ ‘ 𝐴 ) + ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) = ( ( ♯ ‘ 𝐴 ) + 1 )
13 10 12 eqtrdi ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = ( ( ♯ ‘ 𝐴 ) + 1 ) )
14 13 oveq1d ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) − 1 ) = ( ( ( ♯ ‘ 𝐴 ) + 1 ) − 1 ) )
15 lencl ( 𝐴 ∈ Word 𝑊 → ( ♯ ‘ 𝐴 ) ∈ ℕ0 )
16 15 nn0cnd ( 𝐴 ∈ Word 𝑊 → ( ♯ ‘ 𝐴 ) ∈ ℂ )
17 ax-1cn 1 ∈ ℂ
18 pncan ( ( ( ♯ ‘ 𝐴 ) ∈ ℂ ∧ 1 ∈ ℂ ) → ( ( ( ♯ ‘ 𝐴 ) + 1 ) − 1 ) = ( ♯ ‘ 𝐴 ) )
19 16 17 18 sylancl ( 𝐴 ∈ Word 𝑊 → ( ( ( ♯ ‘ 𝐴 ) + 1 ) − 1 ) = ( ♯ ‘ 𝐴 ) )
20 16 addid2d ( 𝐴 ∈ Word 𝑊 → ( 0 + ( ♯ ‘ 𝐴 ) ) = ( ♯ ‘ 𝐴 ) )
21 19 20 eqtr4d ( 𝐴 ∈ Word 𝑊 → ( ( ( ♯ ‘ 𝐴 ) + 1 ) − 1 ) = ( 0 + ( ♯ ‘ 𝐴 ) ) )
22 21 adantr ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( ( ♯ ‘ 𝐴 ) + 1 ) − 1 ) = ( 0 + ( ♯ ‘ 𝐴 ) ) )
23 14 22 eqtrd ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) − 1 ) = ( 0 + ( ♯ ‘ 𝐴 ) ) )
24 23 fveq2d ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) − 1 ) ) = ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( 0 + ( ♯ ‘ 𝐴 ) ) ) )
25 simpl ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → 𝐴 ∈ Word 𝑊 )
26 8 adantl ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ⟨“ 𝐵 ”⟩ ∈ Word 𝑊 )
27 1nn 1 ∈ ℕ
28 11 27 eqeltri ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ∈ ℕ
29 lbfzo0 ( 0 ∈ ( 0 ..^ ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) ↔ ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ∈ ℕ )
30 28 29 mpbir 0 ∈ ( 0 ..^ ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) )
31 30 a1i ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → 0 ∈ ( 0 ..^ ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) )
32 ccatval3 ( ( 𝐴 ∈ Word 𝑊 ∧ ⟨“ 𝐵 ”⟩ ∈ Word 𝑊 ∧ 0 ∈ ( 0 ..^ ( ♯ ‘ ⟨“ 𝐵 ”⟩ ) ) ) → ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( 0 + ( ♯ ‘ 𝐴 ) ) ) = ( ⟨“ 𝐵 ”⟩ ‘ 0 ) )
33 25 26 31 32 syl3anc ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( 0 + ( ♯ ‘ 𝐴 ) ) ) = ( ⟨“ 𝐵 ”⟩ ‘ 0 ) )
34 s1fv ( 𝐵𝑊 → ( ⟨“ 𝐵 ”⟩ ‘ 0 ) = 𝐵 )
35 34 adantl ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ⟨“ 𝐵 ”⟩ ‘ 0 ) = 𝐵 )
36 24 33 35 3eqtrd ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) → ( ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ‘ ( ( ♯ ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) − 1 ) ) = 𝐵 )
37 7 36 sylan9eqr ( ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ) ∧ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ∈ dom 𝑆 ) → ( 𝑆 ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = 𝐵 )
38 37 3impa ( ( 𝐴 ∈ Word 𝑊𝐵𝑊 ∧ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ∈ dom 𝑆 ) → ( 𝑆 ‘ ( 𝐴 ++ ⟨“ 𝐵 ”⟩ ) ) = 𝐵 )