Metamath Proof Explorer


Theorem signstlen

Description: Length of the zero skipping sign 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 signstlen ( 𝐹 ∈ Word ℝ → ( ♯ ‘ ( 𝑇𝐹 ) ) = ( ♯ ‘ 𝐹 ) )

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 ovex ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) ∈ V
6 eqid ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) ) = ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) )
7 5 6 fnmpti ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) ) Fn ( 0 ..^ ( ♯ ‘ 𝐹 ) )
8 1 2 3 4 signstfv ( 𝐹 ∈ Word ℝ → ( 𝑇𝐹 ) = ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) ) )
9 8 fneq1d ( 𝐹 ∈ Word ℝ → ( ( 𝑇𝐹 ) Fn ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↔ ( 𝑛 ∈ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ↦ ( 𝑊 Σg ( 𝑖 ∈ ( 0 ... 𝑛 ) ↦ ( sgn ‘ ( 𝐹𝑖 ) ) ) ) ) Fn ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) )
10 7 9 mpbiri ( 𝐹 ∈ Word ℝ → ( 𝑇𝐹 ) Fn ( 0 ..^ ( ♯ ‘ 𝐹 ) ) )
11 hashfn ( ( 𝑇𝐹 ) Fn ( 0 ..^ ( ♯ ‘ 𝐹 ) ) → ( ♯ ‘ ( 𝑇𝐹 ) ) = ( ♯ ‘ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) )
12 10 11 syl ( 𝐹 ∈ Word ℝ → ( ♯ ‘ ( 𝑇𝐹 ) ) = ( ♯ ‘ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) )
13 lencl ( 𝐹 ∈ Word ℝ → ( ♯ ‘ 𝐹 ) ∈ ℕ0 )
14 hashfzo0 ( ( ♯ ‘ 𝐹 ) ∈ ℕ0 → ( ♯ ‘ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) = ( ♯ ‘ 𝐹 ) )
15 13 14 syl ( 𝐹 ∈ Word ℝ → ( ♯ ‘ ( 0 ..^ ( ♯ ‘ 𝐹 ) ) ) = ( ♯ ‘ 𝐹 ) )
16 12 15 eqtrd ( 𝐹 ∈ Word ℝ → ( ♯ ‘ ( 𝑇𝐹 ) ) = ( ♯ ‘ 𝐹 ) )