fact
stringlengths
17
6.18k
type
stringclasses
17 values
library
stringclasses
3 values
imports
listlengths
0
12
filename
stringclasses
115 values
symbolic_name
stringlengths
1
30
docstring
stringclasses
1 value
Transitive_Roption : Transitive R -> Transitive Roption. Proof. clear. compute. intros. destruct H0; auto. inversion H1. constructor; auto. subst. eapply H; eassumption. Qed. Global Instance Injective_Roption_None : Injective (Roption None None). refine {| result := True |}. auto. Defined. Global Instance Injective_Roption_None_Some a : Injective (Roption None (Some a)). refine {| result := False |}. inversion 1. Defined. Global Instance Injective_Roption_Some_None a : Injective (Roption (Some a) None). refine {| result := False |}. inversion 1. Defined. Global Instance Injective_Roption_Some_Some a b : Injective (Roption (Some a) (Some b)). refine {| result := R a b |}. inversion 1. auto. Defined. Global Instance Injective_Proper_Roption_Some x : Injective (Proper Roption (Some x)). refine {| result := R x x |}. abstract (inversion 1; assumption). Defined.
Lemma
theories
[ "Require Import Coq.", "Require Import Coq.", "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Option.v
Transitive_Roption
eq_option_eq : forall T (a b : T) (pf : a = b) (F : _ -> Type) val, match pf in _ = x return option (F x) with | eq_refl => val end = match val with | None => None | Some val => Some match pf in _ = x return F x with | eq_refl => val end end. Proof. destruct pf. destruct val; reflexivity. Defined. #[global] Hint Rewrite eq_option_eq : eq_rw.
Lemma
theories
[ "Require Import Coq.", "Require Import Coq.", "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Option.v
eq_option_eq
Eqpair : relation (T * U) := | Eqpair_both : forall a b c d, rT a b -> rU c d -> Eqpair (a,c) (b,d). Global Instance Reflexive_Eqpair {RrT : Reflexive rT} {RrU : Reflexive rU} : Reflexive Eqpair. Proof. red. destruct x. constructor; reflexivity. Qed. Global Instance Symmetric_Eqpair {RrT : Symmetric rT} {RrU : Symmetric rU} : Symmetric Eqpair. Proof. red. inversion 1; constructor; symmetry; assumption. Qed. Global Instance Transitive_Eqpair {RrT : Transitive rT} {RrU : Transitive rU} : Transitive Eqpair. Proof. red. inversion 1; inversion 1; constructor; etransitivity; eauto. Qed. Global Instance Injective_Eqpair a b c d : Injective (Eqpair (a,b) (c,d)). refine {| result := rT a c /\ rU b d |}. abstract (inversion 1; auto). Defined.
Inductive
theories
[ "Require Import Coq.", "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Pair.v
Eqpair
R_pair : T * U -> T * U -> Prop := | L : forall l l' r r', RT l l' -> R_pair (l,r) (l',r') | R : forall l r r', RU r r' -> R_pair (l,r) (l,r'). Hypothesis wf_RT : well_founded RT. Hypothesis wf_RU : well_founded RU.
Inductive
theories
[ "Require Import Coq.", "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Pair.v
R_pair
wf_R_pair : well_founded R_pair. Proof. red. intro x. destruct x. generalize dependent u. apply (well_founded_ind wf_RT (fun t => forall u : U, Acc R_pair (t, u))) . do 2 intro. apply (well_founded_ind wf_RU (fun u => Acc R_pair (x,u))). intros. constructor. destruct y. remember (t0,u). remember (x,x0). inversion 1; subst; inversion H4; inversion H3; clear H4 H3; subst; eauto. Defined.
Theorem
theories
[ "Require Import Coq.", "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Pair.v
wf_R_pair
pIn_split_l {A B : Type} (lst : plist (pprod A B)) (p : pprod A B) (H : pIn p lst) : (pIn (pfst p) (fst (split lst))). Proof. destruct p; simpl. induction lst; simpl in *. + destruct H. + destruct t; simpl. destruct (split lst); simpl. destruct H as [H | H]. { inv_all. tauto. } { tauto. } Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
pIn_split_l
pIn_split_r {A B : Type} (lst : plist (pprod A B)) (p : pprod A B) (H : pIn p lst) : (pIn (psnd p) (snd (split lst))). Proof. destruct p; simpl. induction lst; simpl in *. + destruct H. + destruct t; simpl. destruct (split lst); simpl. destruct H. { inv_all; tauto. } { tauto. } Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
pIn_split_r
pIn_app_iff (A : Type) (l l' : plist A) (a : A) : pIn a (app l l') <-> pIn a l \/ pIn a l'. Proof. induction l; simpl; intuition congruence. Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
pIn_app_iff
inb_sound (x : A) (lst : plist A) (H : inb x lst = true) : pIn x lst. Proof. induction lst; simpl in *; try congruence. consider (x ?[ eq ] t); intros; subst. + left; reflexivity. + right; apply IHlst; assumption. Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
inb_sound
inb_complete (x : A) (lst : plist A) (H : pIn x lst) : inb x lst = true. Proof. induction lst; simpl in *; try intuition congruence. consider (x ?[ eq ] t); intros; destruct H as [H | H]; try congruence. apply IHlst; assumption. Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
inb_complete
nodup_sound (lst : plist A) (H : nodup lst = true) : pNoDup lst. Proof. induction lst. + constructor. + simpl in *. rewrite andb_true_iff in H; destruct H as [H1 H2]. rewrite negb_true_iff in H1. constructor. * intro H. apply inb_complete in H. intuition congruence. * apply IHlst; assumption. Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
nodup_sound
nodup_complete (lst : plist A) (H : pNoDup lst) : nodup lst = true. Proof. induction lst. + constructor. + simpl in *. rewrite andb_true_iff. inversion H; subst; split; clear H. * apply eq_true_not_negb. intros H; apply H2. apply inb_sound; assumption. * apply IHlst; assumption. Qed.
Lemma
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
nodup_complete
Instance Functor_plist.
Existing
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import Coq." ]
theories/Data/PList.v
Instance
poption : Type@{i} := | pSome : T -> poption | pNone. Global Instance Injective_pSome@{} a b : Injective (pSome a = pSome b) := { result := a = b ; injection := fun pf => match pf in _ = X return a = match X with | pSome y => y | _ => a end with | eq_refl => eq_refl end }. Global Instance Injective_pSome_pNone a : Injective (pSome a = pNone) := { result := False ; injection := fun pf => match pf in _ = X return match X return Prop with | pSome y => True | _ => False end with | eq_refl => I end }. Global Instance Injective_pNone_pSome@{} a : Injective (pNone = pSome a) := { result := False ; injection := fun pf => match pf in _ = X return match X return Prop with | pNone => True | _ => False end with | eq_refl => I end }.
Inductive
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
poption
fmap_poption @{} (x : poption@{i} T) : poption@{j} U := match x with | pNone => pNone@{j} | pSome x => pSome@{j} (f x) end.
Definition
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
fmap_poption
ap_poption @{} (f : poption@{i} (T -> U)) (x : poption@{i} T) : poption@{j} U := match f , x with | pSome f , pSome x => pSome (f x) | _ , _ => pNone end.
Definition
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
ap_poption
Functor_poption @{i} : Functor@{i i} poption@{i} := {| fmap := @fmap_poption@{i i} |}. #[global]
Definition
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
Functor_poption
Instance Functor_poption.
Existing
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
Instance
Applicative_poption @{i} : Applicative@{i i} poption@{i} := {| pure := @pSome@{i} ; ap := @ap_poption |}. #[global]
Definition
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
Applicative_poption
Instance Applicative_poption.
Existing
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/POption.v
Instance
Fun @{d c} (A : Type@{d}) (B : Type@{c}) := A -> B.
Definition
theories
[ "From Coq.Classes Require Import Morphisms.", "From Coq.Relations Require Import Relations." ]
theories/Data/PreFun.v
Fun
compose @{uA uB uC} {A:Type@{uA}} {B:Type@{uB}} {C : Type@{uC}} (g : B -> C) (f : A -> B) : A -> C := fun x => g (f x).
Definition
theories
[ "From Coq.Classes Require Import Morphisms.", "From Coq.Relations Require Import Relations." ]
theories/Data/PreFun.v
compose
and_True_iff : forall P, (P /\ True) <-> P. Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_True_iff
and_and_iff : forall P, (P /\ P) <-> P. Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_and_iff
and_assoc : forall P Q R, (P /\ Q /\ R) <-> ((P /\ Q) /\ R). Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_assoc
and_comm : forall P Q, (P /\ Q) <-> (Q /\ P). Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_comm
and_False_iff : forall P, (P /\ False) <-> False. Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_False_iff
and_cancel : forall P Q R : Prop, (P -> (Q <-> R)) -> ((P /\ Q) <-> (P /\ R)). Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_cancel
and_iff : forall P Q R S : Prop, (P <-> R) -> (P -> (Q <-> S)) -> ((P /\ Q) <-> (R /\ S)). Proof. clear; intuition. Qed. (** Or/Disjunction **)
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
and_iff
or_False_iff : forall P, (P \/ False) <-> P. Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
or_False_iff
or_or_iff : forall P, (P \/ P) <-> P. Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
or_or_iff
or_assoc : forall P Q R, (P \/ Q \/ R) <-> ((P \/ Q) \/ R). Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
or_assoc
or_comm : forall P Q, (P \/ Q) <-> (Q \/ P). Proof. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
or_comm
or_True_iff : forall P, (P \/ True) <-> True. Proof. intuition. Qed. (** Implication **)
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
or_True_iff
impl_True_iff : forall (P : Prop), (True -> P) <-> P. Proof. clear; intros; tauto. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
impl_True_iff
impl_iff : forall P Q R S : Prop, (P <-> R) -> (P -> (Q <-> S)) -> ((P -> Q) <-> (R -> S)). Proof. clear. intuition. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
impl_iff
impl_eq : forall (P Q : Prop), P = Q -> (P -> Q). Proof. clear. intros; subst; auto. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
impl_eq
uncurry : forall (P Q R : Prop), (P /\ Q -> R) <-> (P -> Q -> R). Proof. clear. tauto. Qed. (** Forall **)
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
uncurry
forall_iff : forall T P Q, (forall x, P x <-> Q x) -> ((forall x : T, P x) <-> (forall x : T, Q x)). Proof. intros. setoid_rewrite H. reflexivity. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
forall_iff
forall_impl : forall {T} (P Q : T -> Prop), (forall x, P x -> Q x) -> (forall x, P x) -> (forall x, Q x). Proof. clear. intuition. Qed. (** Exists **)
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
forall_impl
exists_iff : forall T P Q, (forall x, P x <-> Q x) -> ((exists x : T, P x) <-> (exists x : T, Q x)). Proof. intros. setoid_rewrite H. reflexivity. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
exists_iff
exists_impl : forall {T} (P Q : T -> Prop), (forall x, P x -> Q x) -> (exists x, P x) -> (exists x, Q x). Proof. clear. intuition. destruct H0; eauto. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
exists_impl
iff_eq : forall (P Q : Prop), P = Q -> (P <-> Q). Proof. clear. intros; subst; reflexivity. Qed.
Lemma
theories
[ "From Coq Require Import Setoid." ]
theories/Data/Prop.v
iff_eq
eq_sigT_rw : forall T U F (a b : T) (pf : a = b) s, match pf in _ = x return @sigT U (F x) with | eq_refl => s end = @existT U (F b) (projT1 s) match pf in _ = x return F x (projT1 s) with | eq_refl => (projT2 s) end. Proof. destruct pf. destruct s; reflexivity. Qed. #[global] Hint Rewrite eq_sigT_rw : eq_rw.
Lemma
theories
[ "From Coq.Classes Require EquivDec.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/SigT.v
eq_sigT_rw
stream : Type := | snil : stream | scons : T -> stream -> stream.
CoInductive
theories
[]
theories/Data/Stream.v
stream
deprecated_bool_cmp (l r : bool) : comparison := match l , r with | true , false => Gt | false , true => Lt | true , true | false , false => Eq end. #[deprecated(since="8.12",note="Use Bool.compare instead.")]
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
deprecated_bool_cmp
bool_cmp := deprecated_bool_cmp.
Notation
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
bool_cmp
deprecated_ascii_cmp (l r : Ascii.ascii) : comparison := match l , r with | Ascii.Ascii l1 l2 l3 l4 l5 l6 l7 l8 , Ascii.Ascii r1 r2 r3 r4 r5 r6 r7 r8 => bool_cmp l8 r8 >> bool_cmp l7 r7 >> bool_cmp l6 r6 >> bool_cmp l5 r5 >> bool_cmp l4 r4 >> bool_cmp l3 r3 >> bool_cmp l2 r2 >> bool_cmp l1 r1 end. #[deprecated(since="8.15",note="Use Ascii.compare instead.")]
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
deprecated_ascii_cmp
ascii_cmp := deprecated_ascii_cmp. Global Instance RelDec_string : RelDec (@eq string) := {| rel_dec := String.eqb |}. Global Instance RelDec_Correct_string : RelDec_Correct RelDec_string. Proof. constructor; auto using String.eqb_eq. Qed. Global Instance Reflect_string_dec a b : Reflect (String.eqb a b) (a = b) (a <> b). Proof. apply iff_to_reflect; auto using String.eqb_eq. Qed.
Notation
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
ascii_cmp
deprecated_string_cmp (l r : string) : comparison := match l , r with | EmptyString , EmptyString => Eq | EmptyString , _ => Lt | _ , EmptyString => Gt | String l ls , String r rs => ascii_cmp l r >> deprecated_string_cmp ls rs end. #[deprecated(since="8.15",note="Use String.compare instead.")]
Fixpoint
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
deprecated_string_cmp
string_cmp := deprecated_string_cmp.
Notation
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
string_cmp
_xxx : forall m n, 1 < m -> ~ n < m -> 0 < n. Proof. destruct n; destruct m; intros. inversion H. exfalso. apply H0. etransitivity. 2: eassumption. repeat constructor. inversion H. now apply Nat.lt_0_succ. Qed.
Lemma
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
_xxx
Fixpoint nat2string (n:nat) {measure n}: string := match Nat.ltb n modulus as x return Nat.ltb n modulus = x -> string with | true => fun _ => String (digit2ascii n) EmptyString | false => fun pf => let m := Nat.div n modulus in append (nat2string m) (String (digit2ascii (n - modulus * m)) EmptyString) end (@Logic.eq_refl _ (Nat.ltb n modulus)).
Program
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
Fixpoint
Obligation . eapply Nat.div_lt; auto. consider (Nat.ltb n modulus); try congruence. intros. eapply _xxx; eassumption. Defined.
Next
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
Obligation
nat2string10 : nat -> string. refine (@nat2string 10 _). repeat constructor. Defined.
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
nat2string10
nat2string2 : nat -> string. refine (@nat2string 2 _). repeat constructor. Defined.
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
nat2string2
nat2string8 : nat -> string. refine (@nat2string 8 _). repeat constructor. Defined.
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
nat2string8
nat2string16 : nat -> string. refine (@nat2string 16 _). repeat constructor. Defined. Global Instance Foldable_string : Foldable string ascii := fun _ f base => fix go ls := match ls with | EmptyString => base | String l ls => f l (go ls) end.
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
nat2string16
R_string_len : string -> string -> Prop := | R_s_len : forall n m, length n < length m -> R_string_len n m.
Inductive
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
R_string_len
wf_R_string_len : well_founded R_string_len. Proof. constructor. intros. refine (@Fix _ _ wf_R_lt (fun n : nat => forall ls : string, n = length ls -> Acc R_string_len ls) (fun x rec ls pfls => Acc_intro _ _) _ _ refl_equal). refine ( match ls as ls return x = length ls -> forall z : string, R_string_len z ls -> Acc R_string_len z with | EmptyString => fun (pfls : x = 0) z pf => _ | String l ls => fun pfls z pf => rec _ (match pf in R_string_len xs ys return x = length ys -> R_nat_lt (length xs) x with | R_s_len n m pf' => fun pf_eq => match eq_sym pf_eq in _ = x return R_nat_lt (length n) x with | refl_equal => R_lt pf' end end pfls) _ eq_refl end pfls). clear - pf; abstract (inversion pf; subst; simpl in *; inversion H). Defined.
Theorem
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
wf_R_string_len
Monoid_string_append : Monoid string := {| monoid_plus := append ; monoid_unit := EmptyString |}.
Definition
theories
[ "From Coq Require Import String Program PeanoNat.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/String.v
Monoid_string_append
sum_eq : T + U -> T + U -> Prop := | Inl_eq : forall a b, eqT a b -> sum_eq (inl a) (inl b) | Inr_eq : forall a b, eqU a b -> sum_eq (inr a) (inr b). Variable EDT : RelDec eqT. Variable EDU : RelDec eqU. Global Instance RelDec_equ_sum : RelDec (sum_eq) := { rel_dec := fun x y => match x , y with | inl x , inl y => rel_dec x y | inr x , inr y => rel_dec x y | inl _ , inr _ => false | inr _ , inl _ => false end }. Variable EDCT : RelDec_Correct EDT. Variable EDCU : RelDec_Correct EDU. Global Instance RelDec_Correct_equ_sum : RelDec_Correct RelDec_equ_sum. Proof. constructor; destruct x; destruct y; split; simpl in *; intros; repeat match goal with | [ H : context [ rel_dec ?X ?Y ] |- _ ] => consider (rel_dec X Y); intros; subst | [ |- context [ rel_dec ?X ?Y ] ] => consider (rel_dec X Y); intros; subst end; intuition; try solve [ constructor; auto | congruence ]. + inversion H. intuition. + inversion H. + inversion H. + inversion H; intuition. Qed.
Inductive
theories
[ "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Data/Sum.v
sum_eq
pmap_lookup' (ts : pmap Type) (p : positive) : option Type := match p with | xH => pmap_here ts | xI p => pmap_lookup' (pmap_right ts) p | xO p => pmap_lookup' (pmap_left ts) p end.
Fixpoint
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
pmap_lookup'
OneOf (ts : pmap Type) : Type := mkOneOf { index : positive ; value : match pmap_lookup' ts index with | None => Empty_set | Some T => T end }.
Record
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
OneOf
Into {ts} {T : Type} (n : positive) (pf : pmap_lookup' ts n = Some T) : T -> OneOf ts := match pf in _ = X return match X with | Some T => T | None => Empty_set end -> OneOf ts with | eq_refl => @mkOneOf ts n end.
Definition
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
Into
asNth' {ts : pmap Type} (p p' : positive) : match pmap_lookup' ts p' with | None => Empty_set | Some T => T end -> option (match pmap_lookup' ts p with | None => Empty_set | Some T => T end) := match p as p , p' as p' return match pmap_lookup' ts p' with | None => Empty_set | Some T => T end -> option (match pmap_lookup' ts p with | None => Empty_set | Some T => T end) with | xH , xH => Some | xI p , xI p' => asNth' p p' | xO p , xO p' => asNth' p p' | _ , _ => fun _ => None end.
Fixpoint
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
asNth'
asNth {ts : pmap Type} (p : positive) (oe : OneOf ts) : option (match pmap_lookup' ts p with | None => Empty_set | Some T => T end) := @asNth' ts p oe.(index ts) oe.(value ts).
Definition
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
asNth
OutOf {ts} {T : Type} (n : positive) (pf : pmap_lookup' ts n = Some T) : OneOf ts -> option T := match pf in _ = X return OneOf ts -> option match X with | None => Empty_set:Type | Some T => T end with | eq_refl => @asNth ts n end.
Definition
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
OutOf
asNth'_get_lookup : forall p ts v, asNth' (ts:=ts) p p v = Some v. Proof. induction p; simpl; intros; auto. Qed.
Lemma
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
asNth'_get_lookup
Outof_Into : forall ts T p pf v, @OutOf ts T p pf (@Into ts T p pf v) = Some v. Proof using. unfold OutOf, Into. intros. repeat rewrite (eq_Arr_eq pf). repeat rewrite (eq_Const_eq pf). repeat rewrite (eq_Const_eq (eq_sym pf)). unfold asNth. simpl. rewrite asNth'_get_lookup. { generalize dependent (pmap_lookup' ts p). intros. subst. reflexivity. } Qed.
Theorem
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
Outof_Into
asNth_eq : forall ts p oe v, @asNth ts p oe = Some v -> oe = {| index := p ; value := v |}. Proof. unfold asNth. destruct oe; simpl. revert value0. revert index0. revert ts. induction p; destruct index0; simpl; intros; solve [ congruence | eapply IHp in H; inversion H; clear H IHp; subst; auto ]. Qed.
Theorem
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
asNth_eq
pmap_elim (R : Type) (ts : pmap T) : Type := match ts with | Empty => R | Branch None l r => pmap_elim (pmap_elim R r) l | Branch (Some x) l r => F x -> pmap_elim (pmap_elim R r) l end.
Fixpoint
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
pmap_elim
pmap_lookup'_Empty (p : positive) : pmap_lookup' Empty p = None := match p with | xH => eq_refl | xO p => pmap_lookup'_Empty p | xI p => pmap_lookup'_Empty p end.
Fixpoint
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
pmap_lookup'_Empty
OneOf_Empty (f : OneOf Empty) : False. Proof. destruct f. rewrite pmap_lookup'_Empty in *. intuition congruence. Defined.
Definition
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
OneOf_Empty
pmap_lookup'_eq p m : pmap_lookup p m = pmap_lookup' m p. Proof. generalize dependent m. induction p; intuition. simpl. destruct m. simpl. rewrite pmap_lookup'_Empty. reflexivity. simpl in *. apply IHp. simpl in *. destruct m. simpl. rewrite pmap_lookup'_Empty. reflexivity. simpl. apply IHp. Defined. Global Instance Injective_OneOf m i1 i2 v1 v2 : Injective (@eq (OneOf m) {| index := i1 ; value := v1 |} {| index := i2 ; value := v2 |}) := { result := exists pf : i2 = i1, v1 = match pf in _ = T return match pmap_lookup' m T with | None => Empty_set | Some T => T end with | eq_refl => v2 end ; injection := fun H => match H in _ = h return exists pf : index _ h = i1 , v1 = match pf in (_ = T) return match pmap_lookup' m T with | Some T0 => T0 | None => Empty_set end with | eq_refl => value _ h end with | eq_refl => @ex_intro _ _ eq_refl eq_refl end }.
Lemma
theories
[ "From Coq Require Import PArith.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "From Coq Require Import PArith." ]
theories/Data/SumN.v
pmap_lookup'_eq
vector (T : Type) (n : nat) : Type := match n with | 0 => unit | S n => prod T (vector T n) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
vector
get {T} {n : nat} (f : fin n) : vector T n -> T := match f in fin n return vector T n -> T with | F0 n => fun v : T * vector T n => fst v | FS n f => fun v : T * vector T n => get f (snd v) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
get
put {T} {n : nat} (f : fin n) (t : T) : vector T n -> vector T n := match f in fin n return vector T n -> vector T n with | F0 _ => fun v => (t, snd v) | FS _ f => fun v => (fst v, put f t (snd v)) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
put
get_put_eq : forall {T n} (v : vector T n) (f : fin n) val, get f (put f val v) = val. Proof. induction n. { inversion f. } { remember (S n). destruct f. inversion Heqn0; subst; intros; reflexivity. inversion Heqn0; subst; simpl; auto. } Qed.
Theorem
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
get_put_eq
get_put_neq : forall {T n} (v : vector T n) (f f' : fin n) val, f <> f' -> get f (put f' val v) = get f v. Proof. induction n. { inversion f. } { remember (S n); destruct f. { inversion Heqn0; clear Heqn0; subst; intros. destruct (fin_case f'); try congruence. destruct H0; subst. auto. } { inversion Heqn0; clear Heqn0; subst; intros. destruct (fin_case f'). subst; auto. destruct H0; subst. simpl. eapply IHn. congruence. } } Qed.
Theorem
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
get_put_neq
vector_tl {T : Type} {n : nat} (v : vector T (S n)) : vector T n := snd v.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
vector_tl
vector_hd {T : Type} {n : nat} (v : vector T (S n)) : T := fst v.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Tuple.v
vector_hd
vector T : nat -> Type := | Vnil : vector T 0 | Vcons : forall {n}, T -> vector T n -> vector T (S n).
Inductive
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector
vector_hd n (v : vector T (S n)) : T := match v in vector _ n' return match n' with | 0 => unit | S _ => T end with | Vnil => tt | Vcons _ x _ => x end.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_hd
vector_tl n (v : vector T (S n)) : vector T n := match v in vector _ n' return match n' with | 0 => unit | S n => vector T n end with | Vnil => tt | Vcons _ _ x => x end.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_tl
vector_eta : forall n (v : vector T n), v = match n as n return vector T n -> vector T n with | 0 => fun _ => Vnil _ | S n => fun v => Vcons (vector_hd v) (vector_tl v) end v. Proof. destruct v; auto. Qed.
Theorem
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_eta
get {n : nat} (f : fin n) : vector T n -> T := match f in fin n return vector T n -> T with | F0 n => @vector_hd _ | FS n f => fun v => get f (vector_tl v) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
get
put {n : nat} (f : fin n) (t : T) : vector T n -> vector T n := match f in fin n return vector T n -> vector T n with | F0 _ => fun v => Vcons t (vector_tl v) | FS _ f => fun v => Vcons (vector_hd v) (put f t (vector_tl v)) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
put
get_put_eq : forall {n} (v : vector T n) (f : fin n) val, get f (put f val v) = val. Proof. induction n. { inversion f. } { remember (S n). destruct f. inversion Heqn0; subst; intros; reflexivity. inversion Heqn0; subst; simpl; auto. } Qed.
Theorem
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
get_put_eq
get_put_neq : forall {n} (v : vector T n) (f f' : fin n) val, f <> f' -> get f (put f' val v) = get f v. Proof. induction n. { inversion f. } { remember (S n); destruct f. { inversion Heqn0; clear Heqn0; subst; intros. destruct (fin_case f'); try congruence. destruct H0; subst. auto. } { inversion Heqn0; clear Heqn0; subst; intros. destruct (fin_case f'). subst; auto. destruct H0; subst. simpl. eapply IHn. congruence. } } Qed.
Theorem
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
get_put_neq
ForallV : forall n, vector T n -> Prop := | ForallV_nil : ForallV (Vnil _) | ForallV_cons : forall n e es, P e -> @ForallV n es -> ForallV (Vcons e es).
Inductive
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
ForallV
ForallV_vector_hd n (v : vector T (S n)) (f : ForallV v) : P (vector_hd v) := match f in @ForallV n v return match n as n return vector T n -> Prop with | 0 => fun _ => True | S _ => fun v => P (vector_hd v) end v with | ForallV_nil => I | ForallV_cons _ _ _ pf _ => pf end.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
ForallV_vector_hd
ForallV_vector_tl n (v : vector T (S n)) (f : ForallV v) : ForallV (vector_tl v) := match f in @ForallV n v return match n as n return vector T n -> Prop with | 0 => fun _ => True | S _ => fun v => ForallV (vector_tl v) end v with | ForallV_nil => I | ForallV_cons _ _ _ _ pf => pf end.
Definition
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
ForallV_vector_tl
vector_dec {n} (a : vector T n) : forall b : vector T n, {a = b} + {a <> b} := match a in vector _ n return forall b : vector T n, {a = b} + {a <> b} with | Vnil => fun b => left match b in vector _ 0 with | Vnil => eq_refl end | Vcons _ a a' => fun b => match b as b in vector _ (S n) return forall a', (forall a : vector T n, {a' = a} + {a' <> a}) -> {Vcons a a' = b} + {Vcons a a' <> b} with | Vcons _ b b' => fun a' rec => match Tdec a b , rec b' with | left pf , left pf' => left match pf , pf' with | eq_refl , eq_refl => eq_refl end | right pf , _ => right (fun x : Vcons a a' = Vcons b b' => pf match x in _ = z return a = vector_hd z with | eq_refl => eq_refl end) | left _ , right pf => right (fun x : Vcons a a' = Vcons b b' => pf match x in _ = z return a' = vector_tl z with | eq_refl => eq_refl end) end end a' (@vector_dec _ a') end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_dec
vector_In : forall {n}, vector T n -> Prop := | vHere : forall n rst, @vector_In (S n) (Vcons a rst) | vNext : forall n rst b, @vector_In n rst -> @vector_In (S n) (Vcons b rst).
Inductive
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_In
ForallV_vector_In : forall {n} t (vs : vector T n) P, ForallV P vs -> vector_In t vs -> P t. Proof. induction 2. - eapply (ForallV_vector_hd H). - eapply IHvector_In. eapply (ForallV_vector_tl H). Qed.
Lemma
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
ForallV_vector_In
vector_map {n} (v : vector T n) : vector U n := match v with | Vnil => Vnil _ | Vcons _ v vs => Vcons (f v) (vector_map vs) end.
Fixpoint
theories
[ "Require Import ExtLib." ]
theories/Data/Vector.v
vector_map
hlist_to_tuple ps (h : hlist (fun x : Type => x) ps) : asTuple ps := match h in hlist _ ps return asTuple ps with | Hnil => tt | Hcons x h => (x,hlist_to_tuple h) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
hlist_to_tuple
itype (ps : list Type) : Type := | Inj : Type -> itype ps | Rec : hlist (fun x => x) ps -> itype ps | Sum : itype ps -> itype ps -> itype ps | Prod : itype ps -> itype ps -> itype ps | Sig : forall T : Type, (T -> itype ps) -> itype ps | Pi : forall T : Type, (T -> itype ps) -> itype ps | Get : forall T : Type, member T ps -> (T -> itype ps) -> itype ps | Unf : forall T : Type, member T ps -> T -> itype ps -> itype ps.
Inductive
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
itype
Unit {ps} := @Inj ps unit.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
Unit