Inductive list (X : Set) : Set :=
  | Nil : list X
  | Cons : X -> list X -> list X.Inductive list (X : Set) : Set :=
  | Nil : list X
  | Cons : X -> list X -> list X.Inductive list (X : Set) : Set :=
  | Nil : list X
  | Cons : X -> list X -> list X.Definition cdr (X : Set) (l : list X) :=
  match l with
  | Nil => Nil X
  | Cons _ xs => xs
  end.Fixpoint length (X : Set) (l : list X) {struct l} : nat :=
  match l with
  | Nil => 0
  | Cons _ xs => S (length X xs)
  end.(* append x y = yx *)
Fixpoint append (X : Set) (ys xs : list X) {struct xs} : 
 list X :=
  match xs with
  | Nil => ys
  | Cons x xs' => Cons X x (append X ys xs')
  end.(* == Proprietes d'un tri == *)

Fixpoint sorted (l : list nat) : Prop :=
  match l with
  | Cons n (Cons m x as l) => inf_egal n m = true /\ sorted l
  | _ => True
  end.

Lemma sorted_eq3 : forall (n m : nat) (x : list nat), sorted (Cons nat n (Cons nat m x)) = (inf_egal n m = true /\ sorted (Cons nat m x)).