Metamath Proof Explorer


Theorem signstfvp

Description: Zero-skipping sign in a word compared to a shorter word. (Contributed by Thierry Arnoux, 8-Oct-2018)

Ref Expression
Hypotheses signsv.p = ( 𝑎 ∈ { - 1 , 0 , 1 } , 𝑏 ∈ { - 1 , 0 , 1 } ↦ if ( 𝑏 = 0 , 𝑎 , 𝑏 ) )
signsv.w 𝑊 = { ⟨ ( Base ‘ ndx ) , { - 1 , 0 , 1 } ⟩ , ⟨ ( +g ‘ ndx ) , ⟩ }
signsv.t 𝑇 = ( 𝑓 ∈ Word ℝ ↦ ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝑓 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝑓𝑖 ) ) ) ) ) )
signsv.v 𝑉 = ( 𝑓 ∈ Word ℝ ↦ Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝑓 ) ) if ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )
Assertion signstfvp ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝑇 ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ‘ 𝑁 ) = ( ( 𝑇𝐹 ) ‘ 𝑁 ) )

Proof

Step Hyp Ref Expression
1 signsv.p = ( 𝑎 ∈ { - 1 , 0 , 1 } , 𝑏 ∈ { - 1 , 0 , 1 } ↦ if ( 𝑏 = 0 , 𝑎 , 𝑏 ) )
2 signsv.w 𝑊 = { ⟨ ( Base ‘ ndx ) , { - 1 , 0 , 1 } ⟩ , ⟨ ( +g ‘ ndx ) , ⟩ }
3 signsv.t 𝑇 = ( 𝑓 ∈ Word ℝ ↦ ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝑓 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝑓𝑖 ) ) ) ) ) )
4 signsv.v 𝑉 = ( 𝑓 ∈ Word ℝ ↦ Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝑓 ) ) if ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )
5 simpl1 ( ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) ∧ 𝑖 ∈ ( 0 ... 𝑁 ) ) → 𝐹 ∈ Word ℝ )
6 s1cl ( 𝐾 ∈ ℝ → ⟨“ 𝐾 ”⟩ ∈ Word ℝ )
7 6 3ad2ant2 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ⟨“ 𝐾 ”⟩ ∈ Word ℝ )
8 7 adantr ( ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) ∧ 𝑖 ∈ ( 0 ... 𝑁 ) ) → ⟨“ 𝐾 ”⟩ ∈ Word ℝ )
9 fzssfzo ( 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) → ( 0 ... 𝑁 ) ⊆ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) )
10 9 3ad2ant3 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( 0 ... 𝑁 ) ⊆ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) )
11 10 sselda ( ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) ∧ 𝑖 ∈ ( 0 ... 𝑁 ) ) → 𝑖 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) )
12 ccatval1 ( ( 𝐹 ∈ Word ℝ ∧ ⟨“ 𝐾 ”⟩ ∈ Word ℝ ∧ 𝑖 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) = ( 𝐹𝑖 ) )
13 5 8 11 12 syl3anc ( ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) ∧ 𝑖 ∈ ( 0 ... 𝑁 ) ) → ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) = ( 𝐹𝑖 ) )
14 13 fveq2d ( ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) ∧ 𝑖 ∈ ( 0 ... 𝑁 ) ) → ( sgn ‘ ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) ) = ( sgn ‘ ( 𝐹𝑖 ) ) )
15 14 mpteq2dva ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) ) ) = ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) )
16 15 oveq2d ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) ) ) ) = ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) )
17 ccatws1cl ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ) → ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ∈ Word ℝ )
18 17 3adant3 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ∈ Word ℝ )
19 lencl ( 𝐹 ∈ Word ℝ → ( ♯ ‘ 𝐹 ) ∈ ℕ0 )
20 19 nn0zd ( 𝐹 ∈ Word ℝ → ( ♯ ‘ 𝐹 ) ∈ ℤ )
21 20 uzidd ( 𝐹 ∈ Word ℝ → ( ♯ ‘ 𝐹 ) ∈ ( ℤ ‘ ( ♯ ‘ 𝐹 ) ) )
22 peano2uz ( ( ♯ ‘ 𝐹 ) ∈ ( ℤ ‘ ( ♯ ‘ 𝐹 ) ) → ( ( ♯ ‘ 𝐹 ) + 1 ) ∈ ( ℤ ‘ ( ♯ ‘ 𝐹 ) ) )
23 fzoss2 ( ( ( ♯ ‘ 𝐹 ) + 1 ) ∈ ( ℤ ‘ ( ♯ ‘ 𝐹 ) ) → ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ⊆ ( 0 ..^ ( ( ♯ ‘ 𝐹 ) + 1 ) ) )
24 21 22 23 3syl ( 𝐹 ∈ Word ℝ → ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ⊆ ( 0 ..^ ( ( ♯ ‘ 𝐹 ) + 1 ) ) )
25 24 sselda ( ( 𝐹 ∈ Word ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → 𝑁 ∈ ( 0 ..^ ( ( ♯ ‘ 𝐹 ) + 1 ) ) )
26 25 3adant2 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → 𝑁 ∈ ( 0 ..^ ( ( ♯ ‘ 𝐹 ) + 1 ) ) )
27 ccatlen ( ( 𝐹 ∈ Word ℝ ∧ ⟨“ 𝐾 ”⟩ ∈ Word ℝ ) → ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) = ( ( ♯ ‘ 𝐹 ) + ( ♯ ‘ ⟨“ 𝐾 ”⟩ ) ) )
28 6 27 sylan2 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ) → ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) = ( ( ♯ ‘ 𝐹 ) + ( ♯ ‘ ⟨“ 𝐾 ”⟩ ) ) )
29 28 3adant3 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) = ( ( ♯ ‘ 𝐹 ) + ( ♯ ‘ ⟨“ 𝐾 ”⟩ ) ) )
30 s1len ( ♯ ‘ ⟨“ 𝐾 ”⟩ ) = 1
31 30 oveq2i ( ( ♯ ‘ 𝐹 ) + ( ♯ ‘ ⟨“ 𝐾 ”⟩ ) ) = ( ( ♯ ‘ 𝐹 ) + 1 )
32 29 31 eqtrdi ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) = ( ( ♯ ‘ 𝐹 ) + 1 ) )
33 32 oveq2d ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( 0 ..^ ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ) = ( 0 ..^ ( ( ♯ ‘ 𝐹 ) + 1 ) ) )
34 26 33 eleqtrrd ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → 𝑁 ∈ ( 0 ..^ ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ) )
35 1 2 3 4 signstfval ( ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ∈ Word ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ) ) → ( ( 𝑇 ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ‘ 𝑁 ) = ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) ) ) ) )
36 18 34 35 syl2anc ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝑇 ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ‘ 𝑁 ) = ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ‘ 𝑖 ) ) ) ) )
37 1 2 3 4 signstfval ( ( 𝐹 ∈ Word ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝑇𝐹 ) ‘ 𝑁 ) = ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) )
38 37 3adant2 ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝑇𝐹 ) ‘ 𝑁 ) = ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑁 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) )
39 16 36 38 3eqtr4d ( ( 𝐹 ∈ Word ℝ ∧ 𝐾 ∈ ℝ ∧ 𝑁 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) → ( ( 𝑇 ‘ ( 𝐹 ++ ⟨“ 𝐾 ”⟩ ) ) ‘ 𝑁 ) = ( ( 𝑇𝐹 ) ‘ 𝑁 ) )