Metamath Proof Explorer


Theorem signsvvfval

Description: The value of V , which represents the number of times the sign changes in a word. (Contributed by Thierry Arnoux, 7-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 signsvvfval ( 𝐹 ∈ Word ℝ → ( 𝑉𝐹 ) = Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝐹 ) ) if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 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 fveq2 ( 𝑓 = 𝐹 → ( ♯ ‘ 𝑓 ) = ( ♯ ‘ 𝐹 ) )
6 5 oveq2d ( 𝑓 = 𝐹 → ( 1 ..^ ( ♯ ‘ 𝑓 ) ) = ( 1 ..^ ( ♯ ‘ 𝐹 ) ) )
7 fveq2 ( 𝑓 = 𝐹 → ( 𝑇𝑓 ) = ( 𝑇𝐹 ) )
8 7 fveq1d ( 𝑓 = 𝐹 → ( ( 𝑇𝑓 ) ‘ 𝑗 ) = ( ( 𝑇𝐹 ) ‘ 𝑗 ) )
9 7 fveq1d ( 𝑓 = 𝐹 → ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) = ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) )
10 8 9 neeq12d ( 𝑓 = 𝐹 → ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) ↔ ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) ) )
11 10 ifbid ( 𝑓 = 𝐹 → if ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) = if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )
12 11 adantr ( ( 𝑓 = 𝐹𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝑓 ) ) ) → if ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) = if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )
13 6 12 sumeq12dv ( 𝑓 = 𝐹 → Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝑓 ) ) if ( ( ( 𝑇𝑓 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝑓 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) = Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝐹 ) ) if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )
14 sumex Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝐹 ) ) if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) ∈ V
15 13 4 14 fvmpt ( 𝐹 ∈ Word ℝ → ( 𝑉𝐹 ) = Σ 𝑗 ∈ ( 1 ..^ ( ♯ ‘ 𝐹 ) ) if ( ( ( 𝑇𝐹 ) ‘ 𝑗 ) ≠ ( ( 𝑇𝐹 ) ‘ ( 𝑗 − 1 ) ) , 1 , 0 ) )