Skip to content

Commit 80aa3a0

Browse files
authored
Merge pull request #770 from MetaCoq/fix-float-ops-8.14
Fix float ops
2 parents 755c691 + 00ca6c9 commit 80aa3a0

File tree

1 file changed

+17
-39
lines changed

1 file changed

+17
-39
lines changed

pcuic/theories/utils/PCUICPrimitive.v

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -53,39 +53,8 @@ Proof.
5353
now destruct (uip p q).
5454
Qed.
5555

56-
#[global]
57-
Instance reflect_eq_Z : ReflectEq Z := EqDec_ReflectEq _.
58-
59-
Local Obligation Tactic := idtac.
60-
#[program]
61-
#[global]
62-
Instance reflect_eq_uint63 : ReflectEq uint63_model :=
63-
{ eqb x y := Z.eqb (proj1_sig x) (proj1_sig y) }.
64-
Next Obligation.
65-
cbn -[eqb].
66-
intros x y.
67-
elim: Z.eqb_spec. constructor.
68-
now apply exist_irrel_eq.
69-
intros neq; constructor => H'; apply neq; now subst x.
70-
Qed.
71-
7256
#[global]
7357
Instance reflect_eq_spec_float : ReflectEq SpecFloat.spec_float := EqDec_ReflectEq _.
74-
75-
(* #[program]
76-
#[global]
77-
Instance reflect_eq_float64 : ReflectEq float64_model :=
78-
{ eqb x y := eqb (proj1_sig x) (proj1_sig y) }.
79-
Next Obligation.
80-
cbn -[eqb].
81-
intros x y.
82-
elim: eqb_spec. constructor.
83-
now apply exist_irrel_eq.
84-
intros neq; constructor => H'; apply neq; now subst x.
85-
Qed. *)
86-
87-
(** Propositional UIP is needed below *)
88-
Set Equations With UIP.
8958

9059
Equations eqb_prim_model {term} {t : prim_tag} (x y : prim_model term t) : bool :=
9160
| primIntModel x, primIntModel y := ReflectEq.eqb x y
@@ -101,20 +70,29 @@ Next Obligation.
10170
Qed.
10271

10372
#[global]
104-
Instance prim_model_eqdec {term} (*e : EqDec term*) : forall p : prim_tag, EqDec (prim_model term p) := _.
73+
Instance prim_model_eqdec {term} : forall p : prim_tag, EqDec (prim_model term p) := _.
74+
75+
Equations eqb_prim_val {term} (x y : prim_val term) : bool :=
76+
| (primInt; i), (primInt; i') := ReflectEq.eqb i i'
77+
| (primFloat; f), (primFloat; f') := ReflectEq.eqb f f'
78+
| x, y := false.
10579

106-
#[global]
107-
Instance prim_tag_model_eqdec term : EqDec (prim_val term).
108-
Proof. eqdec_proof. Defined.
80+
#[global, program]
81+
Instance prim_val_reflect_eq {term} : ReflectEq (prim_val term) :=
82+
{| ReflectEq.eqb := eqb_prim_val |}.
83+
Next Obligation.
84+
intros. funelim (eqb_prim_val x y); simp eqb_prim_val.
85+
case: ReflectEq.eqb_spec; constructor; subst; auto. intros H; noconf H. cbn in n. auto.
86+
constructor. intros H; noconf H; auto.
87+
constructor. intros H; noconf H; auto.
88+
case: ReflectEq.eqb_spec; constructor; subst; auto. intros H; noconf H; auto.
89+
Qed.
10990

11091
#[global]
111-
Instance prim_val_reflect_eq term : ReflectEq (prim_val term) := EqDec_ReflectEq _.
92+
Instance prim_tag_model_eqdec term : EqDec (prim_val term) := _.
11293

11394
(** Printing *)
11495

115-
Definition string_of_float64_model (f : float64_model) :=
116-
"<>".
117-
11896
Definition string_of_prim {term} (soft : term -> string) (p : prim_val term) : string :=
11997
match p.π2 return string with
12098
| primIntModel f => "(int: " ^ string_of_prim_int f ^ ")"

0 commit comments

Comments
 (0)