|
53 | 53 | now destruct (uip p q). |
54 | 54 | Qed. |
55 | 55 |
|
56 | | -#[global] |
57 | | -Instance reflect_eq_Z : ReflectEq Z := EqDec_ReflectEq _. |
58 | | - |
59 | 56 | Local Obligation Tactic := idtac. |
60 | 57 | #[program] |
61 | 58 | #[global] |
@@ -84,25 +81,43 @@ Next Obligation. |
84 | 81 | intros neq; constructor => H'; apply neq; now subst x. |
85 | 82 | Qed. *) |
86 | 83 |
|
87 | | -(** Propositional UIP is needed below *) |
88 | | -Set Equations With UIP. |
89 | | - |
90 | | -#[global] |
91 | | -Instance prim_model_eqdec {term} (*e : EqDec term*) : forall p : prim_tag, EqDec (prim_model term p). |
92 | | -Proof. eqdec_proof. Qed. |
| 84 | +Equations eqb_prim_model {term} {t : prim_tag} (x y : prim_model term t) : bool := |
| 85 | + | primIntModel x, primIntModel y := ReflectEq.eqb x y |
| 86 | + | primFloatModel x, primFloatModel y := ReflectEq.eqb x y. |
| 87 | + |
| 88 | +#[global, program] |
| 89 | +Instance prim_model_reflecteq {term} {p : prim_tag} : ReflectEq (prim_model term p) := |
| 90 | + {| ReflectEq.eqb := eqb_prim_model |}. |
| 91 | +Next Obligation. |
| 92 | + intros. depelim x; depelim y; simp eqb_prim_model. |
| 93 | + case: ReflectEq.eqb_spec; constructor; subst; auto. congruence. |
| 94 | + case: ReflectEq.eqb_spec; constructor; subst; auto. congruence. |
| 95 | +Qed. |
93 | 96 |
|
94 | 97 | #[global] |
95 | | -Instance prim_tag_model_eqdec term : EqDec (prim_val term). |
96 | | -Proof. eqdec_proof. Defined. |
| 98 | +Instance prim_model_eqdec {term} : forall p : prim_tag, EqDec (prim_model term p) := _. |
| 99 | + |
| 100 | +Equations eqb_prim_val {term} (x y : prim_val term) : bool := |
| 101 | + | (primInt; i), (primInt; i') := ReflectEq.eqb i i' |
| 102 | + | (primFloat; f), (primFloat; f') := ReflectEq.eqb f f' |
| 103 | + | x, y := false. |
| 104 | + |
| 105 | +#[global, program] |
| 106 | +Instance prim_val_reflect_eq {term} : ReflectEq (prim_val term) := |
| 107 | + {| ReflectEq.eqb := eqb_prim_val |}. |
| 108 | +Next Obligation. |
| 109 | + intros. funelim (eqb_prim_val x y); simp eqb_prim_val. |
| 110 | + case: ReflectEq.eqb_spec; constructor; subst; auto. intros H; noconf H. cbn in n. auto. |
| 111 | + constructor. intros H; noconf H; auto. |
| 112 | + constructor. intros H; noconf H; auto. |
| 113 | + case: ReflectEq.eqb_spec; constructor; subst; auto. intros H; noconf H; auto. |
| 114 | +Qed. |
97 | 115 |
|
98 | 116 | #[global] |
99 | | -Instance prim_val_reflect_eq term : ReflectEq (prim_val term) := EqDec_ReflectEq _. |
| 117 | +Instance prim_tag_model_eqdec term : EqDec (prim_val term) := _. |
100 | 118 |
|
101 | 119 | (** Printing *) |
102 | 120 |
|
103 | | -Definition string_of_float64_model (f : float64_model) := |
104 | | - "<>". |
105 | | - |
106 | 121 | Definition string_of_prim {term} (soft : term -> string) (p : prim_val term) : string := |
107 | 122 | match p.π2 return string with |
108 | 123 | | primIntModel f => "(int: " ^ string_of_prim_int f ^ ")" |
|
0 commit comments