(* *)
(**************************************************************************)
-set "baseuri" "cic:/matita/decidable_kit/eqtype/".
-
include "decidable_kit/decidable.ma".
include "datatypes/constructors.ma".
(* XXX le coercion nel cast non vengono inserite *)
definition nat_canonical_eqType : nat → nat_eqType :=
λn : nat.(n : sort nat_eqType).
-coercion cic:/matita/decidable_kit/eqtype/nat_canonical_eqType.con.
+coercion nat_canonical_eqType.
definition bcmp ≝ λx,y:bool. match x with [ true ⇒ y | false => notb y ].
definition bool_eqType : eqType ≝ mk_eqType ? ? bcmpP.
definition bool_canonical_eqType : bool → bool_eqType :=
λb : bool.(b : sort bool_eqType).
-coercion cic:/matita/decidable_kit/eqtype/bool_canonical_eqType.con.
+coercion bool_canonical_eqType.
(* ### subtype of an eqType ### *)
[1: constructor 1; generalize in match ps; rewrite > Est; intros (pt');
rewrite < (pirrel ? ? ? pt pt' (eqType_decidable bool_eqType)); reflexivity;
|2: constructor 2; unfold Not; intros (H); destruct H;
- cases (Est); assumption;]
+ cases (Est); reflexivity]
qed.
definition sub_eqType ≝ λd : eqType.λp. mk_eqType ? ? (sigma_eq_dec d p).
|2,3,5: destruct H;
|4: rewrite > (b2pT ? ? (eqP d ? ?) H); reflexivity;
|6,7: unfold Not; intros (H1); destruct H1
-|8: unfold Not; intros (H1); destruct H1;
- rewrite > Hcut in H; rewrite > cmp_refl in H; destruct H;]
+|8: unfold Not; intros (H1); destruct H1;rewrite > cmp_refl in H; destruct H;]
qed.
definition option_eqType : eqType → eqType ≝ λd:eqType.mk_eqType ? ? (ocmpP d).
definition option_canonical_eqType : ∀d:eqType.d → option_eqType d ≝
λd:eqType.λx:d.(Some ? x : sort (option_eqType d)).
-coercion cic:/matita/decidable_kit/eqtype/option_canonical_eqType.con.
+coercion option_canonical_eqType.
(* belle le coercions! *)
definition test_canonical_option_eqType ≝