-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelective.v
53 lines (48 loc) · 1.6 KB
/
Selective.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Require Import Hask.Prelude.
Require Import Reasoning.
Require Import Data.Functor.
Require Import Data.Either.
Require Import Control.Applicative.
Require Import Control.Selective.
Require Import FunctionalExtensionality.
Require Import Omega.
Require Import Equations.Equations.
Require Import Coq.Logic.FunctionalExtensionality.
Require Import Coq.Setoids.Setoid.
Require Import Coq.Classes.Morphisms.
Require Import Hask.Control.Selective.Rigid.
Require Import Hask.Control.Selective.Rigid.Parametricity.
Require Import Hask.Control.Selective.Rigid.Proofs.Functor.
Require Import Hask.Control.Selective.Rigid.Proofs.Applicative.
Import FunctorLaws.
Import ApplicativeLaws.
Section WithF.
Context (F : Set -> Set).
Context (FFunctor : Functor F).
Context (FFunctorLaws : FunctorLaws F).
(* -- P1id (Identity): select x (pure id) == either id id <$> x *)
Theorem Select_Selective_law1 `{Functor F} :
forall (A B : Set) (x : Select F (A + B)) (y : A -> B),
Select_select x (Pure y) = Select_map (either y id) x.
Proof.
intros A B x y.
rewrite Select_select_equation_1. now simpl.
Qed.
Lemma Select_pure_right :
forall (A B : Set) (x : B) (z : Select F A) (f : A -> (A -> B)),
(* select (pure (Right x)) y = const x <$> y. *)
select (pure (Right x)) (f <$> z) =
const x <$> (f <$> z).
(* select (pure (Right x)) (rev_f_ap <$> z). *)
Proof.
Admitted.
Theorem select_selective_law3_assoc :
forall (A B C : Set)
(x : Select F (B + C))
(y : Select F (A + (B -> C)))
(z : Select F (A -> B -> C)),
x <*? (y <*? z) =
((fmap law3_f x) <*? (fmap law3_g y)) <*? (fmap law3_h z).
Proof.
Admitted.
End WithF.