(* == Tri bubble *)

Fixpoint bubble_aux (x : list nat) : nat -> list nat :=
  fun n : nat =>
  match x with
  | Nil => Cons nat n (Nil nat)
  | Cons n0 l =>
      si (list nat) (inf_egal n n0) (Cons nat n (bubble_aux l n0))
        (Cons nat n0 (bubble_aux l n))
  end.Definition bubble (x : list nat) : list nat :=
  match x with
  | Nil => Nil nat
  | Cons n l => bubble_aux l n
  end.

(* Specifications: *)
Lemma bubble_eq1 : bubble (Nil nat) = Nil nat.
Lemma bubble_eq2 : forall n : nat, bubble (Cons nat n (Nil nat)) = Cons nat n (Nil nat).
Lemma bubble_eq3 : forall (n m : nat) (x : list nat), bubble (Cons nat n (Cons nat m x)) = si (list nat) (inf_egal n m) (Cons nat n (bubble (Cons nat m x))) (Cons nat m (bubble (Cons nat n x))).