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
itypeD (i : itype ps) {struct i} : asFunc ps Type -> asFunc ps Type := match i return asFunc ps Type -> asFunc ps Type with | Get pf f => fun F => @get ps _ _ pf (fun x => itypeD (f x) F) | Inj _ T => fun _ => const T | Rec h => fun F => const (applyF F (hlist_to_tuple h)) | @Sig _ t f => fun F => @under _ _ (fun App => @sigT t (fun x' => App _ (itypeD (f x') F))) | @Pi _ t f => fun F => @under _ _ (fun App => forall x' : t, App _ (itypeD (f x') F)) | Sum a b => fun F => combine sum ps (itypeD a F) (itypeD b F) | Prod a b => fun F => combine prod ps (itypeD a F) (itypeD b F) | @Unf _ T pf v i => fun F => @get ps _ _ pf (fun x => combine prod _ (const (x = v : Type)) (replace pf v (itypeD i F))) end%type.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
itypeD
cases (i : itype ps) (k : asFunc ps Type -> asFunc ps Type) {struct i} : asFunc ps Type := match i with | Inj _ T => k (const T) | Sum a b => combine prod ps (cases a k) (cases b k) | Prod a b => cases a (fun A => cases b (fun B => under _ _ (fun App => App _ A -> App _ (k B)))) | Rec ps => k (const (applyF RecT (hlist_to_tuple ps))) | @Get _ T m f => @get _ _ _ m (fun x => cases (f x) k) | @Sig _ t f => @under _ _ (fun App => forall x' : t, (App _ (cases (f x') k))) | @Pi _ t f => @under _ _ (fun App => @sigT t (fun x' => App _ (cases (f x') k))) | @Unf _ T pf v i => replace pf v (cases i k) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
cases
asPiE ps {struct ps} : forall (F : _) (G : forall x : (forall U, asFunc ps U -> U), F x), asPi ps F := match ps as ps return forall F : (forall U : Type, asFunc ps U -> U) -> Type, (forall x : forall U : Type, asFunc ps U -> U, F x) -> asPi ps F with | nil => fun _ G => G _ | p :: ps => fun _ G => fun x => asPiE _ _ (fun x' => G _) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
asPiE
asPi_combine ps {struct ps} : forall (F G : _), asPi ps (fun App => F App -> G App) -> asPi ps F -> asPi ps G := match ps as ps return forall F G : (forall U : Type, asFunc ps U -> U) -> Type, asPi ps (fun App : forall U : Type, asFunc ps U -> U => F App -> G App) -> asPi ps F -> asPi ps G with | nil => fun _ _ a b => a b | p :: ps => fun _ _ a b x => asPi_combine _ _ _ (a x) (b x) end. (*
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
asPi_combine
Fmatch (i : itype ps) (Ret : asFunc ps Type) (brs : asPi ps (fun App => App _ (cases RecT i (fun x => combine (fun x y => x -> y) _ x Ret)))) {struct i} : asPi ps (fun App => App _ (itypeD i RecT) -> App _ Ret). destruct i. { simpl in *. revert brs. unfold combine. apply asPi_combine. apply asPiE. intro. intro. destruct i. { simpl in *. Abort. *) (** Some Examples **) (** Vectors **) (*
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
Fmatch
rfvec T : itype ((nat : Type) :: nil) := @Get ((nat : Type) :: @nil Type) nat (MZ _ _) (fun x => match x with | 0 => Inj _ unit | S n => Prod (Inj _ T) (Rec (Hcons n Hnil)) end).
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
rfvec
rfvec' T : itype ((nat : Type) :: nil) := Sum (@Get ((nat : Type) :: @nil Type) nat (MZ _ _) (fun x => Inj _ (x = 0))) (@Get ((nat : Type) :: @nil Type) nat (MZ _ _) (fun x => Sig (fun n : nat => Prod (Inj _ T) (Prod (Rec (Hcons n Hnil)) (Inj _ (x = S n)))))).
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
rfvec'
rfvec'' T : itype ((nat : Type) :: nil) := Sum (Unf (MZ _ _) 0 Unit) (Sig (fun n : nat => (Unf (MZ _ _) (S n) (Prod (Inj _ T) (Rec (Hcons n Hnil)))))). Eval simpl in fun T => itypeD (rfvec T). Eval simpl in fun T => itypeD (rfvec' T). Eval simpl in fun T => itypeD (rfvec'' T). Eval simpl in fun T Result Rec => @cases _ Rec (rfvec T) (fun x => combine (fun x y => x -> y) _ x Result). Eval simpl in fun T Result Rec => @cases _ Rec (rfvec' T) (fun x => combine (fun x y => x -> y) _ x Result). Eval simpl in fun T Result Rec => @cases _ Rec (rfvec'' T) (fun x => combine (fun x y => x -> y) _ x Result). (** Nats **)
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
rfvec''
rfnat := Sum (Inj nil unit) (Rec Hnil). Eval simpl in fun Result Rec => @Tmatch _ Rec rfnat (fun x => combine (fun x y => x -> y) _ x Result).
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
rfnat
inat := Eval simpl in itypeD rfnat.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
inat
i0 : inat := @existT bool (fun x' => itypeD nil (if x' then Inj nil unit else Rec nil Hnil) nat) true tt.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
i0
iS : nat -> inat := @existT bool (fun x' => itypeD nil (if x' then Inj nil unit else Rec nil Hnil) nat) false.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
iS
fold (i : nat) : inat := match i with | 0 => i0 | S n => iS n end.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
fold
unfold (i : inat) : nat := match i with | existT true _ => 0 | existT false x => S x end.
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
unfold
fold_unfold : forall x, fold (unfold x) = x. Proof. destruct x; simpl. destruct x; simpl. { simpl in *. destruct i. reflexivity. } { simpl in *. reflexivity. } Qed.
Theorem
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
fold_unfold
unfold_fold : forall x, unfold (fold x) = x. Proof. destruct x; simpl; reflexivity. Qed. *)
Theorem
theories
[ "Require Import Coq.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Data.v
unfold_fold
data T : (T -> Type) -> Type := | Inj : forall X, Type -> data X | Get : forall X, T -> data X | Prod : forall X, data X -> data X -> data X | Sigma : forall X (S : Type), (S -> data X) -> data X | Pi : forall X (S : Type), (S -> data X) -> data X.
Inductive
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
data
dataD (T : Type) (X : T -> Type) (d : data X) : Type := match d with | Inj _X x => x | Get X i => X i | Prod l r => prod (dataD l) (dataD r) | @Sigma _ _ i s => @sigT i (fun v => dataD (s v)) | @Pi _ _ i s => forall v : i, dataD (s v) end. (** Example of lists as data **)
Fixpoint
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataD
dataList (a : Type) : @data unit (fun _ => list a) := @Sigma _ _ bool (fun x => match x with | true => @Inj _ _ unit | false => @Prod _ _ (Inj _ a) (Get _ tt) end).
Definition
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataList
dataList_to_list : forall T (x : dataD (dataList T)), list T. simpl. intros. destruct x. destruct x. apply nil. simpl in *. apply (fst d :: snd d). Defined.
Theorem
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataList_to_list
list_to_dataList : forall T (ls : list T), dataD (dataList T). simpl. destruct 1. exists true. apply tt. exists false. apply (t, ls). Defined.
Theorem
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
list_to_dataList
dataP (T : Type) (X : T -> Type) (d : data X) (R : Type) : Type := match d with | Inj _X x => x -> R | Get X x => X x -> R | @Prod _ _ l r => dataP l (dataP r R) | @Sigma _ _ i s => forall i, dataP (s i) R | @Pi _ _ i s => (forall i, dataD (s i)) -> R end.
Fixpoint
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataP
dataMatch (T : Type) (X : T -> Type) (d : data X) {struct d} : forall (R : Type), dataP d R -> dataD d -> R := match d as d return forall (R : Type), dataP d R -> dataD d -> R with | Inj _ _ => fun _ p => p | Get X x => fun _ p => p | @Prod _ _ l r => fun _ p v => dataMatch r _ (dataMatch l _ p (fst v)) (snd v) | @Sigma _ _ i d => fun _ p v => match v with | existT _ x y => dataMatch (d x) _ (p _) y end | @Pi _ _ i d => fun _ p v => p v end. (* This used to work (** You really need a fold! **)
Fixpoint
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataMatch
dataLength {x} (l : list x) Z {struct l} : nat := dataMatch (dataList x) _ (fun tag => match tag with | true => fun _ => 0 | false => fun h t => S (Z t) (* (dataLength t) *) end) (list_to_dataList l). *)
Fixpoint
theories
[ "Require Import String List.", "Require Import ExtLib." ]
theories/Generic/DerivingData.v
dataLength
asFunc (domain : list Type) (range : Type) : Type := match domain with | nil => range | d :: ds => d -> asFunc ds range end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
asFunc
asPi (ps : list Type) {struct ps} : ((forall U, asFunc ps U -> U) -> Type) -> Type := match ps as ps return ((forall U, asFunc ps U -> U) -> Type) -> Type with | nil => fun f => f (fun _ x => x) | p :: ps => fun f => forall x : p, asPi ps (fun App => f (fun _ f' => App _ (f' x))) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
asPi
asTuple (domain : list Type) : Type := match domain with | nil => unit | d :: ds => prod d (asTuple ds) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
asTuple
applyF {domain : list Type} {range : Type} : asFunc domain range -> asTuple domain -> range := match domain as domain return asFunc domain range -> asTuple domain -> range with | nil => fun x _ => x | d :: ds => fun f x_xs => applyF (f (fst x_xs)) (snd x_xs) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
applyF
const {D R} (r : R) : asFunc D R := match D with | nil => r | _ :: D => fun _ => const r end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
const
uncurry {D R} {struct D} : (asTuple D -> R) -> asFunc D R := match D as D return (asTuple D -> R) -> asFunc D R with | nil => fun x => x tt | d :: D => fun f d => uncurry (fun x => f (d, x)) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
uncurry
curry {D R} {struct D} : asFunc D R -> (asTuple D -> R) := match D as D return asFunc D R -> (asTuple D -> R) with | nil => fun x _ => x | d :: D => fun f x => curry (f (fst x)) (snd x) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
curry
get (domain : list Type) (range : Type) T (m : member T domain) : (T -> asFunc domain range) -> asFunc domain range := match m in member _ domain return (T -> asFunc domain range) -> asFunc domain range with | MZ _ _ => fun F x => F x x | MN _ m => fun F x => @get _ _ _ m (fun y => F y x) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
get
under (domain : list Type) (range : Type) {struct domain} : ((forall U, asFunc domain U -> U) -> range) -> asFunc domain range := match domain as domain return ((forall U, asFunc domain U -> U) -> range) -> asFunc domain range with | nil => fun F => F (fun _ x => x) | d :: ds => fun F x => under ds range (fun App => F (fun U f => App U (f x))) end%type.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
under
replace {ps} {T U : Type} (m : member T ps) (v : T) {struct m} : asFunc ps U -> asFunc ps U := match m in member _ ps return asFunc ps U -> asFunc ps U with | MZ _ _ => fun f _ => f v | MN _ m => fun f x => replace m v (f x) end.
Fixpoint
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
replace
combine (domain : list Type) (a : asFunc domain T) (b : asFunc domain U) : asFunc domain V := under domain _ (fun App => join (App _ a) (App _ b)).
Definition
theories
[ "Require Import Coq.", "Require Import ExtLib." ]
theories/Generic/Func.v
combine
type : Type := | Self : type | Inj : Type -> type.
Inductive
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
type
product := list type.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
product
variant := list product.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
variant
typeD (t : type) : Type := match t with | Self => M | Inj t => t end.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
typeD
func (T : Type) (v : product) : Type := fold_right (fun x acc => typeD x -> acc) T v.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
func
data (v : product) : Type := fold_right (fun x acc => typeD x * acc)%type unit v.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
data
matchD (T : Type) (v : variant) : Type := fold_right (fun x acc => func T x -> acc)%type T v.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
matchD
dataD (v : variant) : Type := fold_right (fun x acc => data x + acc)%type Empty_set v.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
dataD
recD (T : Type) (c : Type -> Type) (v : variant) : Type := fold_right (fun x acc => fold_right (fun x acc => match x with | Inj t => t | Self => c T end -> acc) (c T) x -> acc) (M -> T) v.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
recD
Data (T : Type) : Type := { repr : variant ; into : dataD T repr -> T ; outof : T -> forall A, matchD T A repr ; rec : forall c {_ : CoMonad c}, forall A, recD T A c repr }. Local Open Scope string_scope. Global Instance Data_nat : Data nat := { repr := nil :: (Self :: nil) :: nil ; outof := fun x _ z s => match x with | 0 => z | S n => s n end ; into := fun d => match d with | inl tt => 0 | inr (inl (n, tt)) => n | inr (inr x) => match x with end end ; rec := fun c _ A z s d => extract ((fix recur (d : nat) {struct d} : c A := match d with | 0 => z | S n => s (recur n) end) d) }. Global Instance Data_list {A} : Data (list A) := { repr := (nil) :: (Inj A :: Self :: nil) :: nil ; outof := fun x _ n c => match x with | nil => n | x :: xs => c x xs end ; into := fun d => match d with | inl tt => nil | inr (inl (x, (xs, tt))) => x :: xs | inr (inr x) => match x with end end ; rec := fun c _ T n co d => extract ((fix recur (ds : list A) {struct ds} : c T := match ds with | nil => n | d :: ds => co d (recur ds) end) d) }. (** Example of deriving Show from Data **) Require Import ExtLib.Programming.Show. Require Import ExtLib.Data.Monads.IdentityMonad. Require Import ExtLib.Structures.Monads. Global Instance Comoand_Id : CoMonad id := { extract := fun _ x => x ; extend := fun _ _ x f => x f }. (*
Class
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
Data
AllResolve (C : Type -> Type) : list type -> Type := | AllResolve_nil : AllResolve C nil | AllResolve_Self : forall ls, AllResolve C ls -> AllResolve C (Self :: ls) | AllResolve_Inj : forall t ls, C t -> AllResolve C ls -> AllResolve C (Inj t :: ls).
Inductive
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
AllResolve
Class AllResolve. *)
Existing
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
Class
ProductResolve (C : Type -> Type) (r : product) : Type := fold_right (fun t acc => match t with | Inj t => C t * acc | Self => acc end)%type unit r.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
ProductResolve
VariantResolve (C : Type -> Type) (r : variant) : Type := fold_right (fun p acc => ProductResolve C p * acc)%type unit r.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
VariantResolve
Class VariantResolve.
Existing
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
Class
all_resolve := simpl VariantResolve; simpl ProductResolve; repeat match goal with | |- unit => apply tt | |- (unit * _)%type => constructor; [ apply tt | ] | |- (_ * _)%type => constructor | |- _ => solve [ eauto with typeclass_instances ] end. #[global] Hint Extern 0 (ProductResolve _ _) => all_resolve : typeclass_instances. #[global] Hint Extern 0 (VariantResolve _ _) => all_resolve : typeclass_instances.
Ltac
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
all_resolve
comma_before (b : bool) (s : showM) : showM := if b then cat (show_exact ",") s else s.
Definition
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
comma_before
show_product (first : bool) (r : list type) {struct r} : ProductResolve Show r -> (showM -> showM) -> (fold_right (fun (x : type) (acc : Type) => match x with | Self => showM | Inj t => t end -> acc) (showM) r). refine ( match r as r return ProductResolve Show r -> (showM -> showM) -> (fold_right (fun (x : type) (acc : Type) => match x with | Self => showM | Inj t => t end -> acc) (showM) r) with | nil => fun _ f => f empty | Self :: rs => fun a f s => @show_product false rs a (fun s' => f (cat s (comma_before first s'))) | Inj t :: rs => fun a f x => @show_product false rs (snd a) (fun s' => f (cat ((fst a) x) (comma_before first s'))) end); simpl in *. Defined. Global Instance Show_data (T : Type) (d : Data T) (AS : VariantResolve Show repr) : Show T := { show := (fix recur (repr : variant) : VariantResolve Show repr -> recD T showM id repr -> T -> showM := match repr as repr return VariantResolve Show repr -> recD T showM id repr -> T -> showM with | nil => fun _ x => x | r :: rs => fun a k' => recur rs (snd a) (k' (show_product true _ (fst a) (fun s' => cat (show_exact "-") (cat (show_exact "(") (cat s' (show_exact ")")))))) end) repr AS (rec (c := id) showM) }. Eval compute in to_string (M := Show_data _ _) (5 :: 6 :: 7 :: nil).
Fixpoint
theories
[ "From Coq Require Import List String.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Generic/Ind.v
show_product
Eqv T := eqv : T -> T -> Prop.
Class
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
Eqv
neg_eqv {T} {E:Eqv T} (x:T) (y:T) : Prop := not (eqv x y).
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
neg_eqv
EqvWF T := { eqvWFEqv : Eqv T ; eqvWFEquivalence : Equivalence eqv }. #[global] Existing Instance eqvWFEqv. #[global] Existing Instance eqvWFEquivalence. #[global]
Class
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
EqvWF
EqvWF_Build {T} {E:Eqv T} {EV:Equivalence eqv} : EqvWF T := { eqvWFEqv := E ; eqvWFEquivalence := EV }.
Instance
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
EqvWF_Build
eqv_dec {T} {E:Eqv T} {R:RelDec eqv} := rel_dec.
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
eqv_dec
neg_eqv_dec {T} {E:Eqv T} {R:RelDec eqv} x y := negb (rel_dec x y).
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
neg_eqv_dec
eqv_dec_p (x:T) (y:T) : {eqv x y} + {~eqv x y} := rel_dec_p x y.
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
eqv_dec_p
neg_eqv_dec_p (x:T) (y:T) : {~eqv x y} + {eqv x y} := neg_rel_dec_p x y.
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
neg_eqv_dec_p
injection_eqv_equivalence : Equivalence (eqv (T:=U)). Proof. repeat constructor ; unfold Reflexive ; unfold Symmetric ; unfold Transitive ; intros. apply injResp. reflexivity. apply injResp. apply injResp in H. symmetry. auto. apply injResp. apply injResp in H. apply injResp in H0. transitivity (inj y) ; auto. Qed.
Definition
theories
[ "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Eqv.v
injection_eqv_equivalence
deprecated_uncurry A B C (f:A -> B -> C) (x:A * B) : C := let (a,b) := x in f a b. #[deprecated(since = "8.13", note = "Use standard library.")]
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_uncurry
uncurry := deprecated_uncurry.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
uncurry
deprecated_curry {A B C} (f : A * B -> C) (a : A) (b : B) : C := f (a, b). #[deprecated(since = "8.13", note = "Use standard library.")]
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_curry
curry := deprecated_curry.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
curry
deprecated_uncurry_curry : forall A B C (f : A -> B -> C) a b, curry (uncurry f) a b = f a b. Proof. unfold curry, uncurry. reflexivity. Qed. #[deprecated(since = "8.13", note = "Use standard library.")]
Lemma
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_uncurry_curry
uncurry_curry := deprecated_uncurry_curry.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
uncurry_curry
deprecated_curry_uncurry : forall A B C (f : A * B -> C) ab, uncurry (curry f) ab = f ab. Proof. unfold uncurry, curry. destruct ab. reflexivity. Qed. #[deprecated(since = "8.13", note = "Use standard library.")]
Lemma
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_curry_uncurry
curry_uncurry := deprecated_curry_uncurry.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
curry_uncurry
deprecated_zip A B (xs:list A) (ys:list B) : list (A * B) := match xs, ys with | [], _ => [] | _, [] => [] | x::xs, y::ys => (x,y)::deprecated_zip xs ys end . #[deprecated(note = "Use List.combine instead.")]
Fixpoint
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_zip
zip := deprecated_zip.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
zip
deprecated_unzip A B (xys:list (A * B)) : list A * list B := match xys with | [] => ([], []) | (x,y)::xys => let (xs,ys) := deprecated_unzip xys in (x::xs,y::ys) end. #[deprecated(note = "Use List.split instead.")]
Fixpoint
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
deprecated_unzip
unzip := deprecated_unzip.
Notation
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
unzip
sum_tot {A} (x:A + A) : A := match x with inl a => a | inr a => a end.
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
sum_tot
forEach A B (xs:list A) (f:A -> B) : list B := map f xs.
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
forEach
lsingleton {A} (x:A) : list A := [x].
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
lsingleton
firstf {A B C} (f:A->C) (xy:A*B) : C*B := let (x,y) := xy in (f x, y).
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
firstf
secondf {A B C} (f:B->C) (xy:A*B) : A*C := let (x,y) := xy in (x, f y).
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
secondf
update {K V} {kRealDec:RelDec (@eq K)} x v l : list (K * V) := match l with | [] => [(x,v)] | (y,w)::l' => if eq_dec x y then (x,v)::l' else (y,w)::update x v l' end.
Fixpoint
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
update
updateMany {K V} {kRealDec:RelDec (@eq K)} (ups:list (K * V)) (init:list (K * V)) : list (K * V) := fold_right (uncurry update) init ups.
Definition
theories
[ "Require Import List.", "Require Import String.", "Require Import ExtLib.", "Require Import ExtLib." ]
theories/Programming/Extras.v
updateMany
Projection x t := { project : t -> x ; pmodify : (x -> x) -> (t -> t) }. *) #[global] Polymorphic Instance Injection_refl {T : Type} : Injection T T := { inject := @id T }. #[global]
Class
theories
[ "Require Import Coq.", "Require Import Coq." ]
theories/Programming/Injection.v
Projection
Injection_ascii_string : Injection ascii string := { inject a := String a EmptyString }. #[global]
Instance
theories
[ "Require Import Coq.", "Require Import Coq." ]
theories/Programming/Injection.v
Injection_ascii_string
Injection_ascii_string_cons : Injection ascii (string -> string) := { inject := String }.
Instance
theories
[ "Require Import Coq.", "Require Import Coq." ]
theories/Programming/Injection.v
Injection_ascii_string_cons
Lte T := { lte : T -> T -> Prop }.
Class
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
Lte
neg_lte {T} {L:Lte T} (x:T) (y:T) : Prop := not (lte x y).
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lte
lt {T} {L:Lte T} x y := lte x y /\ ~lte y x.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lt
neg_lt {T} {L:Lte T} x y := not (lt x y). #[global]
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lt
lt_RelDec {T} {L:Lte T} {RD:RelDec lte} : RelDec lt := { rel_dec x y := (rel_dec x y && negb (rel_dec y x))%bool }. #[global]
Instance
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lt_RelDec
lt_RelDecCorrect {T} {L:Lte T} {RD:RelDec lte} {RDC:RelDec_Correct RD} : RelDec_Correct lt_RelDec. Proof. constructor. intros ; constructor ; intros. unfold rel_dec in H. simpl in H. apply andb_true_iff in H. destruct H. unfold lt. constructor. apply rel_dec_correct. auto. apply neg_rel_dec_correct. simpl in H0. apply negb_true_iff in H0. auto. unfold lt in H. destruct H. unfold rel_dec. simpl. apply andb_true_iff. constructor. apply rel_dec_correct. auto. apply negb_true_iff. apply neg_rel_dec_correct. auto. Qed.
Instance
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lt_RelDecCorrect
LteWF T := { lteWFLte : Lte T ; lteWFPreOrder : PreOrder lte }. #[global] Existing Instance lteWFLte. #[global] Existing Instance lteWFPreOrder. #[global]
Class
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
LteWF
LteWF_Build {T} {L:Lte T} {PO:PreOrder lte} : LteWF T := { lteWFLte := L ; lteWFPreOrder := PO }.
Instance
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
LteWF_Build
lte_dec {T} {L:Lte T} {R:RelDec lte} := rel_dec.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lte_dec
neg_lte_dec {T} {L:Lte T} {R:RelDec lte} x y := negb (lte_dec x y).
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lte_dec
lt_dec {T} {L:Lte T} {R:RelDec lte} := rel_dec.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lt_dec
neg_lt_dec {T} {L:Lte T} {R:RelDec lte} x y := negb (lt_dec x y).
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lt_dec
lte_dec_p (x:T) (y:T) : {lte x y} + {~lte x y} := rel_dec_p x y.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lte_dec_p
neg_lte_dec_p (x:T) (y:T) : {~lte x y} + {lte x y} := neg_rel_dec_p x y.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lte_dec_p
lt_dec_p (x:T) (y:T) : {lt x y} + {~lt x y} := rel_dec_p x y.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
lt_dec_p
neg_lt_dec_p (x:T) (y:T) : {~lt x y} + {lt x y} := neg_rel_dec_p x y.
Definition
theories
[ "Require Import Coq.", "Require Import Equivalence.", "Require Import ExtLib." ]
theories/Programming/Le.v
neg_lt_dec_p