Lemma plus_assoc : forall n m p:nat, (plus n (plus m p))=(plus (plus n m) p).
intros n ; elim n.
simpl ; trivial.
intros n0 IH.
intros m p.
simpl.
rewrite IH.
trivial.
Qed.

Section def.
Variable A: Set.

Inductive tree: Set :=
  Tip: tree
| Node: tree -> A -> tree -> tree.
(* we indicate the returned type (useful for dependent types) *)

Lemma l1: forall l:tree, forall x:A, forall r:tree, Tip<>(Node l x r).
intros l x r.
unfold not.
intros H.
discriminate H.
Qed.

Fixpoint mirror (t: tree) {struct t} : tree :=
  match t with
| Tip => Tip
| Node l x r => Node (mirror r) x (mirror l)
  end.

Lemma mirror2_idem: forall t:tree, mirror (mirror t)=t.
intros t.
elim t.
simpl;trivial.
intros t1 IH1 a t2 IH2.
simpl.
rewrite IH1.
rewrite IH2.
trivial.
Qed.

Inductive le (n:nat) : nat -> Prop :=
  le_n: (le n n)
| le_S: forall m:nat, le n m -> le n (S m).

(*
le_ind
     : forall (n : nat) (P : nat -> Prop),
       P n ->
       (forall m : nat, le n m -> P m -> P (S m)) ->
       forall n0 : nat, le n n0 -> P n0
*)

Lemma le_trans : forall n m p:nat, le n m -> le m p -> le n p.
intros n m p H1 H2.
elim H2.
apply H1.
intros m0 Ha Hb.
apply le_S.
apply Hb.
Defined.


Lemma mirror2_idem: forall t:tree, mirror (mirror t)=t.
intros t ; elim t.
trivial.
intros t1 IH1 a t2 IH2.
simpl.
rewrite IH1.
rewrite IH2.
trivial.
Qed.