fact stringlengths 14 11.5k | type stringclasses 22
values | library stringclasses 7
values | imports listlengths 0 7 | filename stringclasses 136
values | symbolic_name stringlengths 1 36 | docstring stringclasses 1
value |
|---|---|---|---|---|---|---|
Leaf_Tau_inv : forall E R (u : itree E R) b, b ∈ Tau u -> b ∈ u. Proof. intros * IN; inv IN; cbn in *; try congruence. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_Tau_inv | |
Leaf_Vis_inv : forall E X Y (e : E X) (k : _ -> itree E Y) b, b ∈ Vis e k -> exists x, b ∈ k x. Proof. intros * IN *; inv IN; cbn in *; try congruence. revert x H0. refine (match H in _ = u return match u with VisF e0 k0 => _ | RetF _ | TauF _ => False end with eq_refl => _ end). eauto. Qed. (** Closure under [eutt] Ge... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_Vis_inv | |
Leaf_eutt_l {E A B R}: forall (t : itree E A) (u : itree E B) (a : A), eutt R t u -> a ∈ t -> exists b, b ∈ u /\ R a b. Proof. intros * EQ FIN; revert u EQ. induction FIN; intros u2 EQ. - punfold EQ. red in EQ; rewrite H in EQ; clear H t. remember (RetF a); genobs u2 ou. hinduction EQ before R; intros; try now discrimi... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_eutt_l | |
Leaf_eutt_r {E A B R}: forall (t : itree E A) (u : itree E B) (b : B), eutt R t u -> b ∈ u -> exists a, a ∈ t /\ R a b. Proof. intros * EQ FIN. apply eqit_flip in EQ. revert EQ FIN. apply @Leaf_eutt_l. Qed. #[global] Instance Leaf_eutt {E A}: Proper (eq ==> eutt eq ==> iff) (@Leaf E A). Proof. apply proper_sym_impl_iff... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_eutt_r | |
Leaf_bind : forall {E R S} (t : itree E R) (k : R -> itree E S) a b, b ∈ t -> a ∈ k b -> a ∈ t >>= k. Proof. intros * INt INk; induction INt. - rewrite (itree_eta t), H, bind_ret_l; auto. - rewrite (itree_eta t), H, tau_eutt; auto. - rewrite (itree_eta t), H, bind_vis. apply Leaf_Vis with x; auto. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_bind | |
Leaf_bind_inv : forall {E R S} (t : itree E R) (k : R -> itree E S) a, a ∈ t >>= k -> exists b, b ∈ t /\ a ∈ k b. Proof. intros * FIN; remember (ITree.bind t k) as u. revert t k Hequ. induction FIN; intros t' k' ->; rename t' into t. - unfold observe in H; cbn in H. desobs t EQ; cbn in *; try congruence. exists r; auto... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_bind_inv | |
eqit_Leaf_bind_clo b1 b2 (r : itree E R -> itree E S -> Prop) : itree E R -> itree E S -> Prop := | pbc_intro_h U1 U2 (RU : U1 -> U2 -> Prop) (t1 : itree E U1) (t2 : itree E U2) (k1 : U1 -> itree E R) (k2 : U2 -> itree E S) (EQV: eqit RU b1 b2 t1 t2) (REL: forall u1 u2, u1 ∈ t1 -> u2 ∈ t2 -> RU u1 u2 -> r (k1 u1) (k2 u... | Inductive | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eqit_Leaf_bind_clo | |
eqit_Leaf_clo_bind (RS : R -> S -> Prop) b1 b2 vclo (MON: monotone2 vclo) (CMP: compose (eqitC RS b1 b2) vclo <3= compose vclo (eqitC RS b1 b2)) (ID: id <3= vclo): eqit_Leaf_bind_clo b1 b2 <3= gupaco2 (eqit_ RS b1 b2 vclo) (eqitC RS b1 b2). Proof. gcofix CIH. intros. destruct PR. guclo eqit_clo_trans. econstructor; aut... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eqit_Leaf_clo_bind | |
eqit_clo_bind_gen : forall {E} {R1 R2} (RR : R1 -> R2 -> Prop) {U1 U2} {UU : U1 -> U2 -> Prop} b1 b2 (t1 : itree E U1) (t2 : itree E U2) (k1 : U1 -> itree E R1) (k2 : U2 -> itree E R2), eqit UU b1 b2 t1 t2 -> (forall (u1 : U1) (u2 : U2), u1 ∈ t1 -> u2 ∈ t2 -> UU u1 u2 -> eqit RR b1 b2 (k1 u1) (k2 u2)) -> eqit RR b1 b2 ... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eqit_clo_bind_gen | |
eutt_clo_bind_gen : forall {E} {R1 R2} (RR : R1 -> R2 -> Prop) {U1 U2} {UU : U1 -> U2 -> Prop} (t1 : itree E U1) (t2 : itree E U2) (k1 : U1 -> itree E R1) (k2 : U2 -> itree E R2), eutt UU t1 t2 -> (forall (u1 : U1) (u2 : U2), u1 ∈ t1 -> u2 ∈ t2 -> UU u1 u2 -> eutt RR (k1 u1) (k2 u2)) -> eutt RR (x <- t1;; k1 x) (x <- t... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eutt_clo_bind_gen | |
eutt_eq_bind_gen {E R S T} (RS : R -> S -> Prop) (t: itree E T) (k1: T -> itree E R) (k2 : T -> itree E S) : (forall u, u ∈ t -> eutt RS (k1 u) (k2 u)) -> eutt RS (t >>= k1) (t >>= k2). Proof. intros; eapply eutt_clo_bind_gen. reflexivity. intros * IN _ <-; eauto. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eutt_eq_bind_gen | |
eqit_bind_Leaf_inv {E} {R S T} (RS : R -> S -> Prop) (t : itree E T) (k1: T -> itree E R) (k2 : T -> itree E S) : (eutt RS (ITree.bind t k1) (ITree.bind t k2)) -> (forall r, Leaf r t -> eutt RS (k1 r) (k2 r)). Proof. intros EQIT r HRET. revert k1 k2 EQIT. induction HRET; intros; rewrite 2 unfold_bind, H in EQIT. - assu... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | eqit_bind_Leaf_inv | |
has_post_Leaf {E R} (t: itree E R) Q r: has_post t Q -> r ∈ t -> Q r. Proof. intros Hcond Himage. rewrite has_post_post_strong in Hcond. destruct (Leaf_eutt_l t t r Hcond Himage). intuition; now subst. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | has_post_Leaf | |
has_post_Leaf_equiv {E R} (t: itree E R) Q: has_post t Q <-> (forall r, r ∈ t -> Q r). Proof. intuition. eapply has_post_Leaf; eauto. revert t H. pcofix CIH; intros t Hpost. pstep; red. setoid_rewrite (itree_eta t) in Hpost. desobs t Ht; clear t Ht. - constructor. apply Hpost, Leaf_Ret. - constructor. right; apply CIH.... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | has_post_Leaf_equiv | |
Leaf_iter_inv {E R I}: forall (body: I -> itree E (I + R)) (entry: I) (Inv: I -> Prop) (Q: R -> Prop), (forall i r, Inv i -> r ∈ body i -> sum_pred Inv Q r) -> Inv entry -> forall r, r ∈ (ITree.iter body entry) -> Q r. Proof. intros * Hinv Hentry. rewrite <- has_post_Leaf_equiv. eapply has_post_iter_strong; eauto. seto... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_iter_inv | |
Leaf_interp_iter_inv {E F R I} (h: E ~> itree F): forall (body: I -> itree E (I + R)) (entry: I) (Inv: I -> Prop) (Q: R -> Prop), (forall i r, Inv i -> r ∈ interp h (body i) -> sum_pred Inv Q r) -> Inv entry -> forall r, r ∈ interp h (ITree.iter body entry) -> Q r. Proof. intros * Hbody Hentry r Hr. apply (Leaf_iter_in... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_iter_inv | |
Leaf_interp_state_iter_inv {E F S R I}: forall (h: E ~> Monads.stateT S (itree F)) (body: I -> itree E (I + R)) (RS: S -> Prop) (RI: I -> Prop) (RR: R -> Prop) (s: S) (i: I), (forall s i, RS s -> RI i -> (forall sx', sx' ∈ interp_state h (body i) s -> prod_pred RS (sum_pred RI RR) sx')) -> RS s -> RI i -> forall sr', s... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_state_iter_inv | |
subtree {E R}: itree E R -> itree E R -> Prop := | SubtreeRefl u t: u ≅ t -> subtree u t | SubtreeTau u t: subtree (Tau u) t -> subtree u t | SubtreeVis {T} u (e: E T) k x t: u ≅ k x -> subtree (Vis e k) t -> subtree u t. #[global] Instance subtree_cong_eqitree {E R}: Proper (eq_itree eq ==> eq_itree eq ==> flip impl) ... | Inductive | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | subtree | |
subtree_image {E R} (t u: itree E R) x: subtree u t -> x ∈ u -> x ∈ t. Proof. intros * Hsub. induction Hsub; intros. - intros. rewrite <- H; auto. - apply IHHsub, Leaf_Tau, H. - eapply IHHsub, Leaf_Vis. rewrite H in H0; eauto. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | subtree_image | |
Leaf_interp_subtree_inv {E F R} (h: E ~> itree F) (t u: itree E R): subtree u t -> has_post (interp h u) (fun x : R => x ∈ t). Proof. revert t u. ginit. gcofix CIH; intros * Hsub. rewrite (itree_eta u) in Hsub. rewrite ! unfold_interp. desobs u Hu; clear u Hu; cbn. - gstep; red. constructor. eapply subtree_image; eauto... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_subtree_inv | |
Leaf_interp_state_subtree_inv {E F S R} (h: E ~> Monads.stateT S (itree F)) (t u: itree E R) (s: S): subtree u t -> has_post (interp_state h u s) (fun x => snd x ∈ t). Proof. revert t u s. ginit. gcofix CIH; intros * Hsub. rewrite (itree_eta u) in Hsub. rewrite ! unfold_interp_state. desobs u Hu; clear u Hu; cbn. - gst... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_state_subtree_inv | |
Leaf_interp_inv {E F R} (h: E ~> itree F) (t: itree E R) x: x ∈ interp h t -> x ∈ t. Proof. intros Hleaf. apply (has_post_Leaf (interp h t) (fun x => x ∈ t)); auto. apply Leaf_interp_subtree_inv. apply SubtreeRefl; reflexivity. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_inv | |
Leaf_interp_state_inv {E F S R} (h: E ~> Monads.stateT S (itree F)) (t: itree E R) s x: x ∈ interp_state h t s -> snd x ∈ t. Proof. intros Hleaf. apply (has_post_Leaf (interp_state h t s) (fun x => snd x ∈ t)); auto. apply Leaf_interp_state_subtree_inv. apply SubtreeRefl; reflexivity. Qed. (** Inversion through transla... | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_interp_state_inv | |
Leaf_translate_inv {E F R} `{Inj: E -< F}: forall (t: itree E R) v, v ∈ translate (@subevent E F _) t -> v ∈ t. Proof. intros. rewrite translate_to_interp in H. eapply Leaf_interp_inv; eauto. Qed. | Lemma | theories | [
"From ITree Require Import\n Basics.",
"From Paco Require Import paco.",
"From Coq Require Import Morphisms Basics Program."
] | theories/Props/Leaf.v | Leaf_translate_inv | |
loopy : stmt := WHILE 1 DO Skip. | Definition | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | loopy | |
run {A} (n : nat) (t : itree void1 A) : option A := match n, observe t with | O, _ => None | S _, RetF a => Some a | S n, TauF t => run n t | S _, VisF e _ => match e with end end. | Fixpoint | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | run | |
run_ (n : N) (s : stmt) : option env := option_map fst (run (N.to_nat n) (eval_imp s)). Require Extraction. Require ExtrOcamlBasic. Require ExtrOcamlString. Require ExtrOcamlNatInt. | Definition | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | run_ | |
io : Type. Extract Inlined Constant io => "(unit -> unit)". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | io | |
seq : io -> io -> io. Extract Constant seq => "fun a b () -> a (); b ()". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | seq | |
print_binding : var -> nat -> io. Extract Constant print_binding => "fun v n () -> let to_string l = let l_ = ref l in String.init (List.length l) (fun _ -> match !l_ with | h :: t -> l_ := t; h | [] -> assert false) in let v = to_string v in print_string v; print_string "":=""; print_int n; print_string "";""". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | print_binding | |
print_newline : io. Extract Inlined Constant print_newline => "print_newline". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | print_newline | |
nit : Type. Extract Inlined Constant nit => "unit". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | nit | |
run_io : io -> nit. Extract Constant run_io => "fun w -> w ()". | Parameter | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | run_io | |
print_env (e : env) : io := match e with | nil => print_newline | cons (v, n) e => seq (print_binding v n) (print_env e) end. | Fixpoint | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | print_env | |
run' (n : N) (s : stmt) : io := match run_ n s with | None => print_newline | Some e => print_env e end. | Definition | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | run' | |
test : nit := run_io ( seq (run' 100 loopy) (run' 1000 (fact "X" "Y" 10)%string) ). Set Warnings "-extraction-default-directory". Extraction "imp_test.ml" test. | Definition | tutorial | [
"From ITree Require Import ITree.",
"From ITreeTutorial Require Import Imp.",
"From Coq Require Import NArith String."
] | tutorial/extract-imptest/ImpTest.v | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.