Created
December 5, 2022 01:14
-
-
Save Blaisorblade/10af6ba28f28613a32ec07eb3967178d to your computer and use it in GitHub Desktop.
From stdlib's reflect to stdpp's Decision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import iris.prelude.prelude. | |
Definition reflect_bool_decide b {P} : reflect P b -> Decision P. | |
refine ( | |
match b with | |
| true => λ r, left _ | |
| false => λ r, right _ | |
end). | |
all: abstract by inversion r. | |
Defined. | |
#[global] Remove Hints Nat.eq_dec : typeclass_instances. | |
#[global] Instance nat_eqdec_reflect : EqDecision nat. | |
refine (λ x y, reflect_bool_decide (Nat.eqb x y) _). | |
abstract (exact: Nat.eqb_spec). | |
Defined. | |
Eval cbv in decide (5 = 6). | |
Eval cbv in bool_decide (5 = 6). | |
Eval cbv in bool_decide (5 = 5). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment