(** * Results on joining lists and the necessary algebras *)

Fixpoint joinlist {A} {JA : Join A} (l : list A) (x : A) :=
  match l with
  | nil => identity x
  | h :: l => exists y, joinlist l y /\ join h y x
  end.

(* Specifications: *)
Lemma joinlist_inj {A} {JA : Join A} {PA : Perm_alg A} l r1 r2 : l <> nil -> joinlist l r1 -> joinlist l r2 -> r1 = r2.
Lemma joinlist_permutation {A} {JA : Join A} {PA : Perm_alg A} l1 l2 r : Permutation l1 l2 -> joinlist l1 r -> joinlist l2 r.