(* Insert an element *) 
Fixpoint insert (a : A) (l : list A) {struct l} : list A :=
  match l with
  | nil => a :: nil
  | b :: l1 =>
      match order_fun a b with
      | true => a :: l
      | false => b :: insert a l1
      end
  end.

(* Specifications: *)
Theorem insert_ordered : forall l : list A, ordered order l -> forall a : A, ordered order (insert a l).
Theorem insert_permutation : forall (L : list A) (a : A), permutation (a :: L) (insert a L).