List.destutter and ++ #
Mathlib/Data/List/Destutter.lean has no lemma relating destutter to ++. The primitive is
the append decomposition List.destutter'_append: destuttering l ++ m from a destutters l
from a and then m from the last element kept. From it, destuttering the left operand first
changes nothing for any relation, and for (· ≠ ·) the same holds on the right, so
destutter (· ≠ ·) is a congruence for ++. Lemmas specific to (· ≠ ·) carry the _ne suffix
as in List.map_destutter_ne. [UPSTREAM] candidates for that file.
Main results #
List.head?_destutter',List.head?_destutter,List.destutter'_eq_cons: the running element stays in front, sodestutterpreserves the head.List.destutter'_append: the append decomposition.List.destutter_append_left,List.destutter_append_right_ne,List.destutter_append_destutter_ne: absorbing adestutterof either operand, and the++-congruence.List.destutter_replicate: a constant run fuses to one element when the relation is irreflexive at it.List.IsChain.length_destutter_ne_append: two chains concatenated and destuttered lose exactly one element when the seam matches, the numerical core of the autosegmental OCP quotient.
Destuttering from a keeps a in front.
destutter preserves the head.
The append decomposition: destuttering l ++ m from a destutters l from a, then
destutters m from the last element kept.
Destuttering the left operand before appending does not change the result.
destutter fuses a constant run whenever the relation is irreflexive at its element.
Destuttering from a is insensitive to a prior destutter (· ≠ ·) of the argument: after
collapsing, a either differs from the head or equals it, and both cases agree.
Destuttering the right operand before appending does not change the result. Unlike
List.destutter_append_left, this needs (· ≠ ·): a dropped element must behave like the
running one, which for (· ≠ ·) means being equal to it.
destutter (· ≠ ·) is a congruence for ++.
Two chains concatenated and destuttered merge only at the seam: the length is the sum of
lengths minus one exactly when the last element of l equals the first of m.