(*
    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).

(* Specifications: *)
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.
Lemma list_ext_nil_r l : not (list_ext l []).
Lemma Acc_list_ext_app l1 l2 : Acc list_ext l1 -> Acc list_ext l2 -> Acc list_ext (l1 ++ l2).
Lemma Acc_list_ext l : Forall (Acc ltA) l -> Acc list_ext l.
Theorem wf_list_ext : well_founded ltA -> well_founded list_ext.