statement stringlengths 1 1.02k | proof stringlengths 0 5.19k | type stringclasses 13
values | symbolic_name stringlengths 1 30 | library stringclasses 15
values | filename stringclasses 117
values | imports listlengths 0 16 | deps listlengths 0 16 | docstring stringclasses 50
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
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 | Into | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"OneOf",
"pmap_lookup'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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
... | Fixpoint | asNth' | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"pmap",
"pmap_lookup'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | asNth | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"OneOf",
"asNth'",
"pmap",
"pmap_lookup'",
"value"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | OutOf | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"OneOf",
"asNth",
"pmap_lookup'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
asNth'_get_lookup : forall p ts v, asNth' (ts:=ts) p p v = Some v. | Proof.
induction p; simpl; intros; auto.
Qed. | Lemma | asNth'_get_lookup | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"asNth'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | Outof_Into | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"Into",
"OutOf",
"asNth",
"asNth'_get_lookup",
"eq_Arr_eq",
"eq_Const_eq",
"pmap_lookup'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | asNth_eq | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"asNth",
"value"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | pmap_elim | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | pmap_lookup'_Empty | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"pmap_lookup'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
OneOf_Empty (f : OneOf Empty) : False. | Proof.
destruct f. rewrite pmap_lookup'_Empty in *.
intuition congruence.
Defined. | Definition | OneOf_Empty | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"OneOf",
"pmap_lookup'_Empty"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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. | Lemma | pmap_lookup'_eq | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"apply",
"pmap_lookup",
"pmap_lookup'",
"pmap_lookup'_Empty"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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... | Instance | Injective_OneOf | Data | theories/Data/SumN.v | [
"Coq",
"PArith",
"ExtLib.Data.Map.FMapPositive",
"ExtLib.Data.Eq",
"ExtLib.Tactics.Injection"
] | [
"Injective",
"OneOf",
"pmap_lookup'",
"value"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
vector (T : Type) (n : nat) : Type | :=
match n with
| 0 => unit
| S n => prod T (vector T n)
end. | Fixpoint | vector | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | get | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | put | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | get_put_eq | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"get",
"put",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 H... | Theorem | get_put_neq | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"fin_case",
"get",
"put",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
vector_tl {T : Type} {n : nat} (v : vector T (S n)) : vector T n | :=
snd v. | Definition | vector_tl | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
vector_hd {T : Type} {n : nat} (v : vector T (S n)) : T | :=
fst v. | Definition | vector_hd | Data | theories/Data/Tuple.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_eq_unit : RelDec (@eq unit) | :=
{ rel_dec := fun _ _ => true }. | Instance | RelDec_eq_unit | Data | theories/Data/Unit.v | [
"ExtLib.Core.RelDec"
] | [
"RelDec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_eq_unit : RelDec_Correct RelDec_eq_unit. | constructor. destruct x; destruct y; auto; simpl. intuition.
Qed. | Instance | RelDec_Correct_eq_unit | Data | theories/Data/Unit.v | [
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_eq_unit"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
vector T : nat -> Type | :=
| Vnil : vector T 0
| Vcons : forall {n}, T -> vector T n -> vector T (S n). | Inductive | vector | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | vector_hd | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | vector_tl | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | vector_eta | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector",
"vector_hd",
"vector_tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | get | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"vector",
"vector_hd",
"vector_tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | put | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"vector",
"vector_hd",
"vector_tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | get_put_eq | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"get",
"put",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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... | Theorem | get_put_neq | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"fin",
"fin_case",
"get",
"put",
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | ForallV | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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... | Definition | ForallV_vector_hd | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"ForallV",
"vector",
"vector_hd"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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
| Forall... | Definition | ForallV_vector_tl | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"ForallV",
"vector",
"vector_tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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)
... | Fixpoint | vector_dec | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector",
"vector_hd",
"vector_tl"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | vector_In | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | ForallV_vector_In | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"ForallV",
"ForallV_vector_hd",
"ForallV_vector_tl",
"vector",
"vector_In"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
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 | vector_map | Data | theories/Data/Vector.v | [
"ExtLib.Data.Fin"
] | [
"vector"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_zeq : RelDec (@eq Z) | :=
{ rel_dec := Z.eqb }. | Instance | RelDec_zeq | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_zlt : RelDec (Z.lt) | :=
{ rel_dec := Z.ltb }. | Instance | RelDec_zlt | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec",
"lt"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_zle : RelDec (Z.le) | :=
{ rel_dec := Z.leb }. | Instance | RelDec_zle | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_zgt : RelDec (Z.gt) | :=
{ rel_dec := Z.gtb }. | Instance | RelDec_zgt | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_zge : RelDec (Z.ge) | :=
{ rel_dec := Z.geb }. | Instance | RelDec_zge | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_zeq : RelDec_Correct RelDec_zeq. | Proof.
constructor; simpl. intros.
apply Z.eqb_eq.
Qed. | Instance | RelDec_Correct_zeq | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_zeq",
"apply"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_zlt : RelDec_Correct RelDec_zlt. | Proof.
constructor; simpl. intros.
generalize (Zlt_cases x y).
unfold rel_dec. simpl.
destruct ((x <? y)%Z); intros; intuition; try congruence.
Qed. | Instance | RelDec_Correct_zlt | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_zlt"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_zle : RelDec_Correct RelDec_zle. | Proof.
constructor; simpl. intros.
generalize (Zle_cases x y).
unfold rel_dec; simpl.
destruct ((x <=? y)%Z); intros; intuition; congruence.
Qed. | Instance | RelDec_Correct_zle | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_zle"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_zgt : RelDec_Correct RelDec_zgt. | Proof.
constructor; simpl. intros.
generalize (Zgt_cases x y).
unfold rel_dec; simpl.
destruct ((x >? y)%Z); intros; intuition; congruence.
Qed. | Instance | RelDec_Correct_zgt | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_zgt"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RelDec_Correct_zge : RelDec_Correct RelDec_zge. | Proof.
constructor; simpl. intros.
generalize (Zge_cases x y).
unfold rel_dec; simpl.
destruct ((x >=? y)%Z); intros; intuition; congruence.
Qed. | Instance | RelDec_Correct_zge | Data | theories/Data/Z.v | [
"ZArith",
"ExtLib.Core.RelDec"
] | [
"RelDec_Correct",
"RelDec_zge"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
uip_prop_trans (dec : forall x y : A, x = y \/ x <> y)
{x : A} :
forall {y : A} (pf pf' : x = y), pf = pf' | :=
let comp :=
fun (x y y' : A) (eq1 : x = y) (eq2 : x = y') =>
eq_ind x (fun a : A => a = y') eq2 y eq1 in
let eq_dec := dec x in
let nu :=
fun (y : A) (u : x = y) =>
match eq_dec y with
| or_introl eqxy => eqxy
| or_intror neqxy => False_ind (x = y) ... | Definition | uip_prop_trans | Data.Eq | theories/Data/Eq/UIP_trans.v | [] | [
"eq_dec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
uip_trans (dec : forall x y : A, {x = y} + {x <> y}) | := @uip_prop_trans (fun a b => match dec a b with
| left pf => or_introl pf
| right pf' => or_intror pf'
end). | Definition | uip_trans | Data.Eq | theories/Data/Eq/UIP_trans.v | [] | [
"uip_prop_trans"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
BuildGraph : Type | :=
{ emptyGraph : G
; addVertex : V -> G -> G
; addEdge : V -> V -> G -> G
}. | Class | BuildGraph | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
GraphBuilderT (T : Type) : Type | := stateT G m T. | Definition | GraphBuilderT | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Monad_GraphBuilder : Monad GraphBuilderT | :=
Monad_stateT _ _. | Instance | Monad_GraphBuilder | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"Monad",
"Monad_stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MonadT_GraphBuilder : MonadT GraphBuilderT m | :=
MonadT_stateT _ _. | Instance | MonadT_GraphBuilder | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"MonadT",
"MonadT_stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
State_GraphBuilder : MonadState G GraphBuilderT | :=
MonadState_stateT _ _. | Instance | State_GraphBuilder | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"MonadState",
"MonadState_stateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
newEdge (f t : V) : GraphBuilderT unit | :=
g <- get ;;
put (addEdge f t g). | Definition | newEdge | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"get",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
newVertex (v : V) : GraphBuilderT unit | :=
g <- get ;;
put (addVertex v g). | Definition | newVertex | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"get",
"put"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
buildGraph {v} (c : GraphBuilderT v) (g : G) : m G | :=
execStateT c g. | Definition | buildGraph | Data.Graph | theories/Data/Graph/BuildGraph.v | [
"ExtLib.Structures.Monads",
"ExtLib.Data.Monads.StateMonad",
"MonadNotation"
] | [
"GraphBuilderT",
"execStateT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Graph : Type | :=
{ verticies : G -> list V
; successors : G -> V -> list V
}. | Class | Graph | Data.Graph | theories/Data/Graph/Graph.v | [] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
adj_graph : Type | := map. | Definition | adj_graph | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
verts (g : adj_graph) : list V | :=
let c := foldM (m := writerT (Monoid_list_app) ident)
(fun k_v _ => let k := fst k_v in tell (k :: nil)) (ret tt) g
in
psnd (unIdent (runWriterT c)). | Definition | verts | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"Monoid_list_app",
"adj_graph",
"foldM",
"ident",
"writerT"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
succs (g : adj_graph) (v : V) : list V | :=
match lookup v g with
| None => nil
| Some vs => vs
end. | Definition | succs | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"adj_graph"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Graph_adj_graph : Graph V adj_graph | :=
{ verticies := verts
; successors := succs
}. | Instance | Graph_adj_graph | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"Graph",
"adj_graph",
"succs",
"verts"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
add_vertex (v : V) (g : adj_graph) : adj_graph | :=
if contains v g then g else add v nil g. | Definition | add_vertex | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"adj_graph",
"contains"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
list_in_dec v (ls : list V) : bool | :=
match ls with
| nil => false
| l :: ls =>
if eq_dec l v then true
else list_in_dec v ls
end. | Fixpoint | list_in_dec | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"eq_dec"
] | TODO: Move this * | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
add_edge (f t : V) (g : adj_graph) : adj_graph | :=
match lookup f g with
| None =>
add f (t :: nil) g
| Some vs =>
if list_in_dec t vs then g
else add f (t :: vs) g
end. | Definition | add_edge | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"adj_graph",
"list_in_dec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
GraphBuilder_adj_graph : BuildGraph V adj_graph | :=
{ emptyGraph := empty
; addVertex := add_vertex
; addEdge := add_edge
}. | Instance | GraphBuilder_adj_graph | Data.Graph | theories/Data/Graph/GraphAdjList.v | [
"ExtLib.Core.RelDec",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Monoid",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Maps",
"ExtLib.Data.List",
"ExtLib.Data.PPair",
"ExtLib.Data.Monads.WriterMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Graph.Buil... | [
"BuildGraph",
"add_edge",
"add_vertex",
"adj_graph",
"empty"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
list_in_dec v (ls : list V) : bool | :=
match ls with
| nil => false
| l :: ls =>
if eq_dec l v then true
else list_in_dec v ls
end. | Fixpoint | list_in_dec | Data.Graph | theories/Data/Graph/GraphAlgos.v | [
"Coq.Lists.List",
"Coq.PArith.BinPos",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Monads.FuelMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.List",
"ExtLib.Core.RelDec"
] | [
"eq_dec"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dfs' : V -> list V -> m (list V) | :=
mfix_multi (V :: list V :: nil) (list V) (fun rec from seen =>
if list_in_dec from seen
then ret (m:=m) seen
else
foldM (fun v acc =>
if list_in_dec v acc
then ret (m:=m) acc
else rec v acc) (ret (m:=m) seen) (successors g fr... | Definition | dfs' | Data.Graph | theories/Data/Graph/GraphAlgos.v | [
"Coq.Lists.List",
"Coq.PArith.BinPos",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Monads.FuelMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.List",
"ExtLib.Core.RelDec"
] | [
"foldM",
"list_in_dec",
"mfix_multi"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
dfs (from : V) : list V | :=
let count := Npos (List.fold_left (fun acc _ => Pos.succ acc) (verticies g) 1%positive) in
let res := runGFix (dfs' from nil) count in
match res with
| Diverge => (** This should never happen! **)
verticies g
| Term v => v
end. | Definition | dfs | Data.Graph | theories/Data/Graph/GraphAlgos.v | [
"Coq.Lists.List",
"Coq.PArith.BinPos",
"ExtLib.Structures.Monads",
"ExtLib.Structures.Reducible",
"ExtLib.Data.Graph.Graph",
"ExtLib.Data.Monads.FuelMonad",
"ExtLib.Data.Monads.IdentityMonad",
"ExtLib.Data.List",
"ExtLib.Core.RelDec"
] | [
"dfs'",
"fold_left"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist : Type | := list (K * V). | Definition | alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_remove (k : K) (m : alist) : alist | :=
List.filter (fun x => negb (k ?[ R ] (fst x))) m. | Definition | alist_remove | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"filter"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_add (k : K) (v : V) (m : alist) : alist | :=
(k, v) :: alist_remove k m. | Definition | alist_add | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_find (k : K) (m : alist) : option V | :=
match m with
| nil => None
| (k',v) :: ms =>
if k ?[ R ] k' then
Some v
else
alist_find k ms
end. | Fixpoint | alist_find | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_find' (k: K) : alist -> option V | :=
fmap snd ∘ find (rel_dec k ∘ fst). | Definition | alist_find' | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_find_alt (m: alist) : forall k: K,
alist_find k m = alist_find' k m. | Proof.
induction m; intuition.
unfold alist_find', compose.
simpl.
destruct (k ?[ R ] a0) eqn:Heq; [intuition|].
rewrite IHm.
reflexivity.
Qed. | Lemma | alist_find_alt | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_find",
"alist_find'",
"compose"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fold_alist (acc : T) (map : alist) : T | :=
match map with
| nil => acc
| (k,v) :: m =>
let acc := f k v acc in
fold_alist acc m
end. | Fixpoint | fold_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fold_alist' : T -> alist -> T | :=
flip $ fold_left (flip $ uncurry f). | Definition | fold_alist' | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"fold_left",
"uncurry"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
fold_alist_alt (map: alist) : forall acc: T,
fold_alist acc map = fold_alist' acc map. | Proof.
induction map; intuition.
simpl.
rewrite IHmap.
reflexivity.
Qed. | Lemma | fold_alist_alt | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"fold_alist",
"fold_alist'"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
alist_union (m1 m2 : alist) : alist | :=
fold_alist alist_add m2 m1. | Definition | alist_union | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_add",
"fold_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Map_alist : Map K V alist | :=
{ empty := nil
; add := @alist_add
; remove := alist_remove
; lookup := alist_find
; union := @alist_union
}. | Instance | Map_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"Map",
"alist",
"alist_add",
"alist_find",
"alist_remove",
"alist_union",
"empty",
"remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
RDC_K : RelDec_Correct RD_K. | Hypothesis | RDC_K | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"RelDec_Correct"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | ||
Refl : Reflexive R. | Hypothesis | Refl | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | ||
Sym : Symmetric R. | Hypothesis | Sym | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | ||
Trans : Transitive R. | Hypothesis | Trans | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | ||
mapsto_alist (m : alist) k v : Prop | :=
alist_find k m = Some v. | Definition | mapsto_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_find"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_alist_cons : forall k v m k' v',
mapsto_alist ((k',v') :: m) k v <->
( (mapsto_alist m k v /\ ~R k k')
\/ (R k k' /\ v = v')). | Proof.
unfold mapsto_alist; intuition; simpl in *.
{ consider (k ?[ R ] k'); intros.
{ right. inversion H0; auto. }
{ left. auto. } }
{ consider (k ?[ R ] k'); intros; intuition. }
{ consider (k ?[ R ] k'); intros; intuition. congruence. }
Qed. | Lemma | mapsto_alist_cons | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"consider",
"mapsto_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_lookup_alist : forall (k : K) (v : V) (m : list (K * V)),
lookup k m = Some v <-> mapsto_alist m k v. | Proof.
reflexivity.
Qed. | Theorem | mapsto_lookup_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"mapsto_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_remove_eq_alist : forall (m : list (K * V)) (k : K) (v : V),
~mapsto_alist (remove k m) k v. | Proof.
unfold mapsto_alist, remove, alist_remove; simpl. intros.
induction m; simpl; auto.
{ congruence. }
{ destruct a; simpl in *.
consider (k ?[ R ] k0); auto; intros.
simpl. consider (k ?[ R ] k0); auto. }
Qed. | Theorem | mapsto_remove_eq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist_remove",
"consider",
"mapsto_alist",
"remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_remove_neq_alist : forall (m : list (K * V)) (k : K),
forall k', ~ R k k' -> forall v', (mapsto_alist m k' v' <-> mapsto_alist (remove k m) k' v'). | Proof.
unfold mapsto_alist, add; simpl. intros.
induction m; simpl in *.
{ intuition. }
{ destruct a. simpl in *.
consider (k' ?[ R ] k0); intros.
{ consider (k ?[ R ] k0); intros.
{ exfalso. eauto. }
{ simpl. consider (k' ?[ R ] k0); intros.
{ int... | Theorem | mapsto_remove_neq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"consider",
"mapsto_alist",
"remove"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_add_eq_alist : forall (m : list (K * V)) (k : K) (v : V),
mapsto_alist (add k v m) k v. | Proof.
unfold mapsto_alist, add, alist_add; simpl. intros.
consider (k ?[ R ] k); auto.
intro. exfalso. apply H. reflexivity.
Qed. | Theorem | mapsto_add_eq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist_add",
"apply",
"consider",
"mapsto_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
mapsto_add_neq_alist : forall (m : list (K * V)) (k : K) (v : V),
forall k', ~ R k k' -> forall v', (mapsto_alist m k' v' <-> mapsto_alist (add k v m) k' v'). | Proof.
unfold mapsto_alist, add; simpl. intros.
consider (k' ?[ R ] k); try solve [ intros; exfalso; auto ].
intros. eapply mapsto_remove_neq_alist in H. eapply H.
Qed. | Theorem | mapsto_add_neq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"consider",
"mapsto_alist",
"mapsto_remove_neq_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
remove_eq_alist:
forall (m : alist) (k : K), alist_find k (alist_remove k m) = None. | Proof.
unfold mapsto_alist.
induction m; simpl; eauto; try congruence.
intros; consider (k ?[ R ] fst a); simpl; intros; eauto.
destruct a; simpl in *.
consider (k ?[ R ] k0); eauto. tauto.
Qed. | Theorem | remove_eq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_find",
"alist_remove",
"consider",
"mapsto_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
remove_neq_alist:
forall (m : alist) (k k' : K), ~R k' k -> alist_find k (alist_remove k' m) = alist_find k m. | Proof.
unfold mapsto_alist.
induction m; simpl; eauto; try congruence.
destruct a; simpl.
intros; consider (k' ?[ R ] k); simpl; intros; eauto.
{ consider (k0 ?[ R ] k); intros; eauto.
exfalso. eapply H. etransitivity; eauto. }
{ consider (k0 ?[ R ] k); eauto. }
Qed. | Theorem | remove_neq_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"alist",
"alist_find",
"alist_remove",
"consider",
"mapsto_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
MapLaws_alist : MapOk R Map_alist. | Proof.
refine {| mapsto := fun k v m => mapsto_alist m k v |};
eauto using mapsto_lookup_alist, mapsto_add_eq_alist, mapsto_add_neq_alist.
{ intros; intro. inversion H. }
{ unfold mapsto_alist; simpl. intros.
rewrite remove_eq_alist. congruence. }
{ unfold mapsto_alist. simpl; intr... | Instance | MapLaws_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"MapOk",
"Map_alist",
"mapsto_add_eq_alist",
"mapsto_add_neq_alist",
"mapsto_alist",
"mapsto_lookup_alist",
"remove_eq_alist",
"remove_neq_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Foldable_alist : Foldable alist (K * V) | :=
fun _ f b => fold_alist (fun k v => f (k,v)) b. | Instance | Foldable_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"Foldable",
"alist",
"fold_alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
Functor_alist K : Functor (alist K) | :=
{ fmap := fun T U f => map (fun x => (fst x, f (snd x))) }. | Instance | Functor_alist | Data.Map | theories/Data/Map/FMapAList.v | [
"Coq.Classes.RelationClasses",
"Coq.Lists.List",
"ExtLib.Core.RelDec",
"ExtLib.Tactics.Consider",
"ExtLib.Structures.Maps",
"ExtLib.Structures.Monad",
"ExtLib.Structures.Reducible",
"ExtLib.Structures.Functor",
"Coq",
"Basics",
"ExtLib",
"Extras",
"OptionMonad",
"FunNotation",
"FunctorNo... | [
"Functor",
"alist"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap : Type | :=
| Empty
| Branch : option T -> pmap -> pmap -> pmap. | Inductive | pmap | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_here (m : pmap) : option T | :=
match m with
| Empty => None
| Branch d _ _ => d
end. | Definition | pmap_here | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_left (m : pmap) : pmap | :=
match m with
| Empty => Empty
| Branch _ l _ => l
end. | Definition | pmap_left | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_right (m : pmap) : pmap | :=
match m with
| Empty => Empty
| Branch _ _ r => r
end. | Definition | pmap_right | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 | |
pmap_lookup (p : positive) (m : pmap) {struct p} : option T | :=
match m with
| Empty => None
| Branch d l r =>
match p with
| xH => d
| xO p => pmap_lookup p l
| xI p => pmap_lookup p r
end
end. | Fixpoint | pmap_lookup | Data.Map | theories/Data/Map/FMapPositive.v | [
"ExtLib.Structures.Maps",
"ExtLib.Structures.Functor",
"ExtLib.Data.Option",
"ExtLib.Data.Positive",
"ExtLib.Tactics.Cases"
] | [
"pmap"
] | https://github.com/coq-community/coq-ext-lib | ddd03d257f6b85a93bfaa0ed4d03658e0ddf5075 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.