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

Lemma joinlist_inj {A} {JA : Join A} {PA : Perm_alg A} l r1 r2 : l <> nil -> joinlist l r1 -> joinlist l r2 -> r1 = r2.