-
Notifications
You must be signed in to change notification settings - Fork 0
/
IndexedSum1.v
37 lines (32 loc) · 1.06 KB
/
IndexedSum1.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From ExtensibleCompiler.Theory Require Import
IndexedFunctor
.
Declare Scope IndexedSum1.
Delimit Scope IndexedSum1 with IndexedSum1.
Open Scope IndexedSum1.
Variant IndexedSum1 I (F G : I-indexedPropFunctor) (A : I-indexedProp) (i : I) : Prop :=
| iinl1 : F A i -> (F + G)%IndexedSum1 A i
| iinr1 : G A i -> (F + G)%IndexedSum1 A i
where "F + G" := (IndexedSum1 _ F G) : IndexedSum1.
Arguments iinl1 {I F G A i}.
Arguments iinr1 {I F G A i}.
Global Instance IndexedFunctorSum1
{I} {F G : I-indexedPropFunctor} `{IndexedFunctor I F} `{IndexedFunctor I G}
: IndexedFunctor I (F + G)
| 0 :=
{|
indexedFmap
:= fun A B i f fg =>
match fg with
| iinl1 fa => iinl1 (indexedFmap i f fa)
| iinr1 ga => iinr1 (indexedFmap i f ga)
end;
|}.
Definition indexedSum1Dispatch
{I} {A : I -> Prop} {L R : I-indexedPropFunctor} {O : I -> Prop} {i}
(fl : L A i -> O i) (fr : R A i -> O i) v :=
match v with
| iinl1 l => fl l
| iinr1 r => fr r
end.
Notation "f || g" := (indexedSum1Dispatch f g) : IndexedSum1.