set "baseuri" "cic:/matita/Z/z".
+include "datatypes/bool.ma".
include "nat/nat.ma".
-include "higher_order_defs/functions.ma".
inductive Z : Set \def
OZ : Z
[ O \Rightarrow OZ
| (S n)\Rightarrow pos n].
-coercion Z_of_nat.
+coercion cic:/matita/Z/z/Z_of_nat.con.
definition neg_Z_of_nat \def
\lambda n. match n with
theorem OZ_test_to_Prop :\forall z:Z.
match OZ_test z with
[true \Rightarrow z=OZ
-|false \Rightarrow \lnot (z=OZ)].
+|false \Rightarrow z \neq OZ].
intros.elim z.
simplify.reflexivity.
-simplify.intros [H].
+simplify. unfold Not. intros (H).
discriminate H.
-simplify.intros [H].
+simplify. unfold Not. intros (H).
discriminate H.
qed.
(* discrimination *)
theorem injective_pos: injective nat Z pos.
-simplify.
+unfold injective.
intros.
-change with abs (pos x) = abs (pos y).
+change with (abs (pos x) = abs (pos y)).
apply eq_f.assumption.
qed.
\def injective_pos.
theorem injective_neg: injective nat Z neg.
-simplify.
+unfold injective.
intros.
-change with abs (neg x) = abs (neg y).
+change with (abs (neg x) = abs (neg y)).
apply eq_f.assumption.
qed.
variant inj_neg : \forall n,m:nat. neg n = neg m \to n = m
\def injective_neg.
-theorem not_eq_OZ_pos: \forall n:nat. \lnot (OZ = (pos n)).
-simplify.intros [n; H].
+theorem not_eq_OZ_pos: \forall n:nat. OZ \neq pos n.
+unfold Not.intros (n H).
discriminate H.
qed.
-theorem not_eq_OZ_neg :\forall n:nat. \lnot (OZ = (neg n)).
-simplify.intros [n; H].
+theorem not_eq_OZ_neg :\forall n:nat. OZ \neq neg n.
+unfold Not.intros (n H).
discriminate H.
qed.
-theorem not_eq_pos_neg :\forall n,m:nat. \lnot ((pos n) = (neg m)).
-simplify.intros [n; m; H].
+theorem not_eq_pos_neg :\forall n,m:nat. pos n \neq neg m.
+unfold Not.intros (n m H).
discriminate H.
qed.
theorem decidable_eq_Z : \forall x,y:Z. decidable (x=y).
-intros.simplify.
+intros.unfold decidable.
elim x.
(* goal: x=OZ *)
elim y.
(* goal: x=pos *)
elim y.
(* goal: x=pos y=OZ *)
- right.intro.
- apply not_eq_OZ_pos n. symmetry. assumption.
+ right.unfold Not.intro.
+ apply (not_eq_OZ_pos n). symmetry. assumption.
(* goal: x=pos y=pos *)
- elim (decidable_eq_nat n n1:(Or (n=n1) ((n=n1) \to False))).
+ elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))).
left.apply eq_f.assumption.
- right.intros [H_inj].apply H. injection H_inj. assumption.
+ right.unfold Not.intros (H_inj).apply H. injection H_inj. assumption.
(* goal: x=pos y=neg *)
- right.intro.apply not_eq_pos_neg n n1. assumption.
+ right.unfold Not.intro.apply (not_eq_pos_neg n n1). assumption.
(* goal: x=neg *)
elim y.
(* goal: x=neg y=OZ *)
- right.intro.
- apply not_eq_OZ_neg n. symmetry. assumption.
+ right.unfold Not.intro.
+ apply (not_eq_OZ_neg n). symmetry. assumption.
(* goal: x=neg y=pos *)
- right. intro. apply not_eq_pos_neg n1 n. symmetry. assumption.
+ right. unfold Not.intro. apply (not_eq_pos_neg n1 n). symmetry. assumption.
(* goal: x=neg y=neg *)
- elim (decidable_eq_nat n n1:(Or (n=n1) ((n=n1) \to False))).
+ elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))).
left.apply eq_f.assumption.
- right.intro.apply H.apply injective_neg.assumption.
+ right.unfold Not.intro.apply H.apply injective_neg.assumption.
qed.
(* end discrimination *)