Skip to content

Instantly share code, notes, and snippets.

@relrod
Created May 26, 2016 17:15
Show Gist options
  • Save relrod/974caa89639e30d27f2d5e0835f41691 to your computer and use it in GitHub Desktop.
Save relrod/974caa89639e30d27f2d5e0835f41691 to your computer and use it in GitHub Desktop.
Lemma ap_pres_comp : forall {t u} (pu : parser (t -> u)) (pv : parser (t -> t)) pw,
((ret compose <*> pu) <*> pv) <*> pw = pu <*> (pv <*> pw).
Proof.
intros.
unfold ap.
unfold flatmap.
extensionality x.
simpl.
destruct (pu x).
destruct p.
unfold ret.
destruct (pv s).
destruct pw.
assumption.
destruct p.
destruct (pw s0).
destruct p.
reflexivity.
reflexivity.
destruct p.
destruct (pw s0).
destruct p.
reflexivity.
reflexivity.
reflexivity.
reflexivity.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment