Commit db08223a by Robbert Krebbers

### Define shorthand EqDecision A := (∀ x y : A, Decision (x = y)).

parent 52cdec56
 ... @@ -26,8 +26,7 @@ Inductive Pmap_raw (A : Type) : Type := ... @@ -26,8 +26,7 @@ Inductive Pmap_raw (A : Type) : Type := Arguments PLeaf {_}. Arguments PLeaf {_}. Arguments PNode {_} _ _ _. Arguments PNode {_} _ _ _. Instance Pmap_raw_eq_dec `{∀ x y : A, Decision (x = y)} (x y : Pmap_raw A) : Instance Pmap_raw_eq_dec `{EqDecision A} : EqDecision (Pmap_raw A). Decision (x = y). Proof. solve_decision. Defined. Proof. solve_decision. Defined. Fixpoint Pmap_wf {A} (t : Pmap_raw A) : bool := Fixpoint Pmap_wf {A} (t : Pmap_raw A) : bool := ... @@ -266,8 +265,7 @@ Proof. ... @@ -266,8 +265,7 @@ Proof. split; [by intros ->|intros]; destruct m1 as [t1 ?], m2 as [t2 ?]. split; [by intros ->|intros]; destruct m1 as [t1 ?], m2 as [t2 ?]. simplify_eq/=; f_equal; apply proof_irrel. simplify_eq/=; f_equal; apply proof_irrel. Qed. Qed. Instance Pmap_eq_dec `{∀ x y : A, Decision (x = y)} Instance Pmap_eq_dec `{EqDecision A} : EqDecision (Pmap A) := λ m1 m2, (m1 m2 : Pmap A) : Decision (m1 = m2) := match Pmap_raw_eq_dec (pmap_car m1) (pmap_car m2) with match Pmap_raw_eq_dec (pmap_car m1) (pmap_car m2) with | left H => left (proj2 (Pmap_eq m1 m2) H) | left H => left (proj2 (Pmap_eq m1 m2) H) | right H => right (H ∘ proj1 (Pmap_eq m1 m2)) | right H => right (H ∘ proj1 (Pmap_eq m1 m2)) ... ...
 ... @@ -16,10 +16,10 @@ Infix "+:+" := String.append (at level 60, right associativity) : C_scope. ... @@ -16,10 +16,10 @@ Infix "+:+" := String.append (at level 60, right associativity) : C_scope. Arguments String.append _ _ : simpl never. Arguments String.append _ _ : simpl never. (** * Decision of equality *) (** * Decision of equality *) Instance assci_eq_dec : ∀ a1 a2, Decision (a1 = a2) := ascii_dec. Instance assci_eq_dec : EqDecision ascii := ascii_dec. Instance string_eq_dec (s1 s2 : string) : Decision (s1 = s2). Instance string_eq_dec : EqDecision string. Proof. solve_decision. Defined. Proof. solve_decision. Defined. Instance: Inj (=) (=) (String.append s1). Instance string_app_inj : Inj (=) (=) (String.append s1). Proof. intros s1 ???. induction s1; simplify_eq/=; f_equal/=; auto. Qed. Proof. intros s1 ???. induction s1; simplify_eq/=; f_equal/=; auto. Qed. (* Reverse *) (* Reverse *) ... ...
 ... @@ -35,7 +35,7 @@ Coercion fin_to_nat : fin >-> nat. ... @@ -35,7 +35,7 @@ Coercion fin_to_nat : fin >-> nat. Notation fin_of_nat := Fin.of_nat_lt. Notation fin_of_nat := Fin.of_nat_lt. Notation fin_rect2 := Fin.rect2. Notation fin_rect2 := Fin.rect2. Instance fin_dec {n} : ∀ i j : fin n, Decision (i = j). Instance fin_dec {n} : EqDecision (fin n). Proof. Proof. refine (fin_rect2 refine (fin_rect2 (λ n (i j : fin n), { i = j } + { i ≠ j }) (λ n (i j : fin n), { i = j } + { i ≠ j }) ... @@ -163,8 +163,7 @@ Proof. ... @@ -163,8 +163,7 @@ Proof. - apply IH. intros i. apply (Hi (FS i)). - apply IH. intros i. apply (Hi (FS i)). Qed. Qed. Instance vec_dec {A} {dec : ∀ x y : A, Decision (x = y)} {n} : Instance vec_dec {A} {dec : EqDecision A} {n} : EqDecision (vec A n). ∀ v w : vec A n, Decision (v = w). Proof. Proof. refine (vec_rect2 refine (vec_rect2 (λ n (v w : vec A n), { v = w } + { v ≠ w }) (λ n (v w : vec A n), { v = w } + { v ≠ w }) ... ...
 ... @@ -13,14 +13,13 @@ Arguments Zmap_pos {_} _. ... @@ -13,14 +13,13 @@ Arguments Zmap_pos {_} _. Arguments Zmap_neg {_} _. Arguments Zmap_neg {_} _. Arguments ZMap {_} _ _ _. Arguments ZMap {_} _ _ _. Instance Zmap_eq_dec `{∀ x y : A, Decision (x = y)} (t1 t2 : Zmap A) : Instance Zmap_eq_dec `{EqDecision A} : EqDecision (Zmap A). Decision (t1 = t2). Proof. Proof. refine refine (λ t1 t2, match t1, t2 with match t1, t2 with | ZMap x t1 t1', ZMap y t2 t2' => | ZMap x t1 t1', ZMap y t2 t2' => cast_if_and3 (decide (x = y)) (decide (t1 = t2)) (decide (t1' = t2')) cast_if_and3 (decide (x = y)) (decide (t1 = t2)) (decide (t1' = t2')) end; abstract congruence. end); abstract congruence. Defined. Defined. Instance Zempty {A} : Empty (Zmap A) := ZMap None ∅ ∅. Instance Zempty {A} : Empty (Zmap A) := ZMap None ∅ ∅. Instance Zlookup {A} : Lookup Z A (Zmap A) := λ i t, Instance Zlookup {A} : Lookup Z A (Zmap A) := λ i t, ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment