Leading signs and variations of lists #
The first nonzero sign determines the change in sign variations when a nonzero entry is prepended to a list.
The sign of the first nonzero entry of a list, or 0 if every entry is zero.
Equations
- l.firstSign = (Option.map (⇑SignType.sign) (List.filter (fun (v : R) => decide (v ≠ 0)) l).head?).getD 0
Instances For
@[simp]
@[simp]
theorem
List.firstSign_cons_of_ne_zero
{R : Type u_1}
[Zero R]
[LinearOrder R]
{a : R}
(l : List R)
(ha : a ≠ 0)
:
Prepending an entry a adds one sign variation exactly when its sign is
opposite the sign of the next surviving entry.