(*
    List extension of the relation ltA
    see relation ">_red" [1] for which the transitive closure is the multiset ordering [1, Lemma 2]

    [1] Solange Coupet-Grimal, William Delobel:
        An effective proof of the well-foundedness of the multiset path ordering.
        Applicable Algebra in Engineering, Communication and Computing 17(6): 453-469 (2006)

    Intuition: to reduce a list, replace one element with zero or more smaller elements.
        For example, with Nat.lt, [2, 2] > [1, 1, 0, 2] > [1, 1, 0] > [1, 0] > [0, 0, 0] > [0, 0] > [0] > [].
  *)
  Inductive list_ext : list A -> list A -> Prop :=
    | list_ext_intro a (bs : list A) l1 l2 :
        Forall (fun b => ltA b a) bs -> list_ext (l1 ++ bs ++ l2) (l1 ++ a :: l2).(*
    List extension of the relation ltA
    see relation ">_red" [1] for which the transitive closure is the multiset ordering [1, Lemma 2]

    [1] Solange Coupet-Grimal, William Delobel:
        An effective proof of the well-foundedness of the multiset path ordering.
        Applicable Algebra in Engineering, Communication and Computing 17(6): 453-469 (2006)

    Intuition: to reduce a list, replace one element with zero or more smaller elements.
        For example, with Nat.lt, [2, 2] > [1, 1, 0, 2] > [1, 1, 0] > [1, 0] > [0, 0, 0] > [0, 0] > [0] > [].
  *)
  Inductive list_ext : list A -> list A -> Prop :=
    | list_ext_intro a (bs : list A) l1 l2 :
        Forall (fun b => ltA b a) bs -> list_ext (l1 ++ bs ++ l2) (l1 ++ a :: l2).

Lemma list_ext_inv l l' : list_ext l l' -> exists a bs l1 l2, l = l1 ++ bs ++ l2 /\ l' = l1 ++ a :: l2 /\ Forall (fun b => ltA b a) bs.