File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed
Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change 11Require Import ExtLib.Structures.Functor.
22Require Import ExtLib.Structures.Applicative.
3+ Require Import ExtLib.Tactics.Injection.
34
45Set Printing Universes .
56
@@ -11,6 +12,45 @@ Section poption.
1112 | pSome : T -> poption
1213 | pNone.
1314
15+ Global Polymorphic Instance Injective_pSome a b
16+ : Injective (pSome a = pSome b) :=
17+ { result := a = b
18+ ; injection := fun pf =>
19+ match pf in _ = X
20+ return a = match X with
21+ | pSome y => y
22+ | _ => a
23+ end
24+ with
25+ | eq_refl => eq_refl
26+ end }.
27+
28+ Global Polymorphic Instance Injective_pSome_pNone a
29+ : Injective (pSome a = pNone) :=
30+ { result := False
31+ ; injection := fun pf =>
32+ match pf in _ = X
33+ return match X with
34+ | pSome y => True
35+ | _ => False
36+ end
37+ with
38+ | eq_refl => I
39+ end }.
40+
41+ Global Polymorphic Instance Injective_pNone_pSome a
42+ : Injective (pNone = pSome a) :=
43+ { result := False
44+ ; injection := fun pf =>
45+ match pf in _ = X
46+ return match X with
47+ | pNone => True
48+ | _ => False
49+ end
50+ with
51+ | eq_refl => I
52+ end }.
53+
1454End poption.
1555
1656Arguments pSome {_} _.
@@ -45,4 +85,4 @@ Existing Instance Functor_poption.
4585Polymorphic Definition Applicative_poption@{i} : Applicative@{i i} poption@{i} :=
4686{| pure := @pSome@{i}
4787 ; ap := @ap_poption |}.
48- Existing Instance Applicative_poption.
88+ Existing Instance Applicative_poption.
You can’t perform that action at this time.
0 commit comments