Set Implicit Arguments.
(* nat misc *)
Definition ltb (x y: nat): bool := negb (leb y x).
Definition geb (x y: nat): bool := leb y x.
Ltac subst_tac x y z := (* todo: rename *)
match z with
| x => y
| ?l + ?r =>
let l' := subst_tac x y l in
let r' := subst_tac x y r in
constr: (l' + r')
| ?l * ?r =>
let l' := subst_tac x y l in
let r' := subst_tac x y r in
constr: (l' * r')
| _ => z
end.
Ltac deep_le_trans h :=
match type of h with
| ?n <= ?u =>
match goal with
| |- ?l <= _ =>
let q := subst_tac n u l
in apply le_trans with q
end
end.
Instance Transitive_le: Transitive le := le_trans.
Proof with auto with arith.
destruct a... destruct b...
intros. simpl. discriminate.
Qed.
Proof with auto with arith.
intros.
apply lt_S_n.
apply lt_trans with m...
Qed.
Proof with auto.
induction p.
exists 0...
destruct IHp.
exists (S x0).
subst...
Qed.
Proof with auto.
intros.
omega.
Qed.
Proof with auto with arith.
revert x y.
induction d.
simpl.
intros.
destruct x...
inversion H.
simpl.
intros.
destruct x.
destruct y...
elimtype False.
apply le_Sn_n with d...
rewrite H1.
apply le_minus.
destruct y.
elimtype False.
apply le_Sn_n with d.
rewrite <- H1.
apply le_minus.
apply eq_S.
apply IHd...
Qed.
Proof with auto with arith.
intros.
unfold sqrd.
autorewrite with arith_norm...
Qed.

Lemma sqrd_le x y: x <= y -> sqrd x <= sqrd y.