Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
statement stringlengths 1 1.21k | proof stringlengths 0 6.87k | type stringclasses 22
values | symbolic_name stringlengths 1 36 | library stringclasses 11
values | filename stringclasses 211
values | imports listlengths 1 19 | deps listlengths 0 28 | docstring stringclasses 481
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
neg (b : bool) : bool | :=
neg true := false;
neg false := true. | Equations | neg | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | * Inductive types
In its simplest form, [Equations] allows to define functions on inductive datatypes.
Take for example the booleans defined as an inductive type with two constructors [true] and [false]:
[[
Inductive bool : Set := true : bool | false : bool
]]
We can define the boolean negation ... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
neg_inv : forall b, neg (neg b) = b. | Proof. intros b. funelim (neg b); now simp neg. Defined. | Lemma | neg_inv | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"neg"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
list {A} : Type | := nil : list | cons : A -> list -> list. | Inductive | list | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | * Reasoning principles
In the setting of a proof assistant like Coq, we need not only the ability
to define complex functions but also get good reasoning support for them.
Practically, this translates to the ability to simplify applications of functions
appearing in the goal and to give strong enough pro... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
"x :: l" | := (cons x l). | Notation | x :: l | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
"[]" | := nil. | Notation | [] | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
tail {A} (l : list A) : list A | :=
tail nil := nil ;
tail (cons a v) := v. | Equations | tail | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | No special support for polymorphism is needed, as type arguments are treated
like regular arguments in dependent type theories. Note however that one cannot
match on type arguments, there is no intensional type analysis.
We can write the polymorphic [tail] function as follows: | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
app {A} (l l' : list A) : list A | :=
app nil l' := l' ;
app (cons a l) l' := cons a (app l l'). | Equations | app | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | ** Recursive inductive types
Of course with inductive types comes recursion. Coq accepts a subset
of the structurally recursive definitions by default (it is
incomplete due to its syntactic nature). We will use this as a first
step towards a more robust treatment of recursion via well-founded
relatio... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
filter {A} (l : list A) (p : A -> bool) : list A | :=
filter nil p := nil ;
filter (cons a l) p with p a => {
filter (cons a l) p true := a :: filter l p ;
filter (cons a l) p false := filter l p }. | Equations | filter | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | ** Moving to the left
The structure of real programs is richer than a simple case tree on
the original arguments in general. In the course of a computation, we
might want to scrutinize intermediate results (e.g. coming from
function calls) to produce an answer. This literally means adding a
new pattern ... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
filter' {A} (l : list A) (p : A -> bool) : list A | :=
| [], p => []
| a :: l, p with p a => {
| true => a :: filter' l p
| false => filter' l p }. | Equations | filter' | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | A more compact syntax can be used to avoid repeating the same patterns in multiple clauses and
focus on the patterns that matter. When a clause starts with `|`, a list of patterns separated by "," or "|"
can be provided in open syntax, without parentheses. They should match the explicit arguments of the
curren... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
unzip {A B} (l : list (A * B)) : list A * list B | :=
unzip nil := (nil, nil) ;
unzip (cons p l) with unzip l => {
unzip (cons (pair a b) l) (pair la lb) := (a :: la, b :: lb) }. | Equations | unzip | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | A common use of with clauses is to scrutinize recursive results like the following: | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
equal (n m : nat) : { n = m } + { n <> m } | :=
equal O O := left eq_refl ;
equal (S n) (S m) with equal n m := {
equal (S n) (S ?(n)) (left eq_refl) := left eq_refl ;
equal (S n) (S m) (right p) := right _ } ;
equal x y := right _. | Equations | equal | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | * Dependent types
Coq supports writing dependent functions, in other words, it gives the ability to
make the results _type_ depend on actual _values_, like the arguments of the function.
A simple example is given below of a function which decides the equality of two
natural numbers, returning a sum typ... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
head {A} (l : list A) (pf : l <> nil) : A | :=
head nil pf with pf eq_refl := { | ! };
head (cons a v) _ := a. | Equations | head | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"list"
] | Of particular interest here is the inner program refining the recursive result.
As [equal n m] is of type [{ n = m } + { n <> m }] we have two cases to consider:
- Either we are in the [left p] case, and we know that [p] is a proof of [n = m],
in which case we can do a nested match on [p]. The result of ... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
eqt {A} (x y z : A) (p : x = y) (q : y = z) : x = z | :=
eqt x ?(x) ?(x) eq_refl eq_refl := eq_refl. | Equations | eqt | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | ** Inductive families
The next step is to make constraints such as non-emptiness part of the
datatype itself. This capability is provided through inductive families in
Coq %\cite{paulin93tlca}%, which are a similar concept to the generalization
of algebraic datatypes to GADTs in functional languages like... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
vmap {A B} (f : A -> B) {n} (v : vector A n) :
vector B n | :=
vmap f (n:=?(0)) Vnil := Vnil ;
vmap f (Vcons a v) := Vcons (f a) (vmap f v). | Equations | vmap | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"vector"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
vtail {A n} (v : vector A (S n)) : vector A n | :=
vtail (Vcons a v') := v'. | Equations | vtail | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"vector"
] | Here the value of the index representing the size of the vector
is directly determined by the constructor, hence in the case tree
we have no need to eliminate [n]. This means in particular that
the function [vmap] does not do any computation with [n], and
the argument could be eliminated in the extracted... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
diag {A n} (v : vector (vector A n) n) : vector A n | :=
diag (n:=O) Vnil := Vnil ;
diag (n:=S _) (Vcons (Vcons a v) v') :=
Vcons a (diag (vmap vtail v')). | Equations | diag | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"vector",
"vmap",
"vtail"
] | The precise specification of these derived definitions can be found in the manual
section %(\S \ref{manual})%. Signature is used to "pack" a value in an inductive family
with its index, e.g. the "total space" of every index and value of the family. This
can be used to derive the heterogeneous no-confusion p... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
id (n : nat) : nat by wf n lt | :=
id 0 := 0;
id (S n') := S (id n'). | Equations | id | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"lt",
"wf"
] | Indeed, Coq cannot guess the decreasing argument of this fixpoint
using its limited syntactic guard criterion: [vmap vtail v'] cannot
be seen to be a (large) subterm of [v'] using this criterion, even
if it is clearly "smaller". In general, it can also be the case that
the compilation algorithm introduc... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
unzip {n} (v : vector (A * B) n) : vector A n * vector B n
by wf (signature_pack v) (@t_subterm (A * B)) | :=
unzip Vnil := (Vnil, Vnil) ;
unzip (Vector.cons (pair x y) v) with unzip v := {
| pair xs ys := (Vector.cons x xs, Vector.cons y ys) }. | Equations | unzip | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"vector",
"wf"
] | We can use the packed relation to do well-founded recursion on the vector.
Note that we do a recursive call on a substerm of type [vector A n] which
must be shown smaller than a [vector A (S n)]. They are actually compared
at the packed type [{ n : nat & vector A n}]. The default obligation
tact... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
diag' {A n} (v : vector (vector A n) n) : vector A n by wf n | :=
diag' Vnil := Vnil ;
diag' (Vcons (Vcons a v) v') :=
Vcons a (diag' (vmap vtail v')). | Equations | diag' | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"vector",
"vmap",
"vtail",
"wf"
] | For the diagonal, it is easier to give [n] as the decreasing argument
of the function, even if the pattern-matching itself is on vectors: | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
uipa : forall A, UIP A. | Axiom | uipa | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [
"UIP"
] | The user must declare this axiom itself, as an instance of the [UIP] class. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
K {A} (x : A) (P : x = x -> Type) (p : P eq_refl)
(H : x = x) : P H | :=
K x P p eq_refl := p. | Equations | K | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | In this case the following definition uses the [UIP] axiom just declared. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
K' (x : nat) (P : x = x -> Type) (p : P eq_refl)
(H : x = x) : P H | :=
K' x P p eq_refl := p. | Equations | K' | doc | doc/equations_intro.v | [
"Stdlib",
"Arith",
"Lia",
"Program",
"Equations.Prop",
"Equations",
"Bvector"
] | [] | Note that the definition loses its computational content: it will
get stuck on an axiom. We hence do not recommend its use.
Equations allows however to use constructive proofs of UIP for types
enjoying decidable equality. The following example relies on an
instance of the [EqDec] typeclass for ... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
rev_acc {A} (l : list A) : list A | :=
rev_acc l := go [] l
where go : list A -> list A -> list A :=
go acc [] := acc;
go acc (hd :: tl) := go (hd :: acc) tl. | Equations | rev_acc | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"hd",
"list"
] | ** Worker/wrapper
The most standard example is an efficient implementation of list reversal.
Instead of growing the stack by the size of the list, we accumulate a
partially reverted list as a new argument of our function.
We implement this using a [go] auxilliary function defined recursively
and pattern mat... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
rev_acc_eq : forall {A} (l : list A), rev_acc l = rev l. | Proof.
(** We apply functional elimination on the [rev_acc l] call.
The eliminator expects two predicates:
one specifying the wrapper and another for the worker.
For the wrapper, we give the expected final goal but for the worker
we have to invent a kind of loop invariant: here that the result... | Lemma | rev_acc_eq | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"app_assoc",
"app_nil_r",
"list",
"rev",
"rev_acc"
] | A typical issue with such accumulating functions is that one has to
write lemmas in two versions, once about the internal [go] function
and then on its wrapper. Using the functional elimination principle
associated to [rev_acc], we can show both properties simultaneously. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
isPrime (n : nat) : bool :=
isPrime 0 := false;
isPrime 1 := false;
isPrime 2 := true;
isPrime 3 := true;
isPrime k := worker 2
where worker (n' : nat) : bool by wf (k - n') lt :=
worker n' with ge_dec n' k :=
{ | left H := true;
| right H := if Nat.eqb (Nat.modulo k n') 0 then false els... | Proof. lia. Defined. | Equations | isPrime | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"eqb",
"lt",
"wf"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
indexes : list nat -> list nat | :=
indexes l := go [] (length l)
where go : list nat -> nat -> list nat :=
go acc 0 := acc;
go acc (S n) := go (n :: acc) n. | Equations | indexes | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"list"
] | ** Programm equivalence with worker/wrappers
Finally we show how the eliminator can be used to prove
program equivalences involving a worker/wrapper definition.
Here [indexes l] computes the list [0..|l|-1] of valid indexes in the
list [l]. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
indexes_spec (l : list nat) : Forall (fun x => x < length l) (indexes l). | Proof.
(** We apply the eliminator, giving a predicate that specifies
preservation of the property from the accumulator to the end
result for [go]'s specification. The rest of the proof uses simple reasoning. *)
apply (indexes_elim (fun l indexesl => Forall (fun x => x < length l) indexesl)
(fun... | Lemma | indexes_spec | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"indexes",
"list"
] | Clearly, all indexes in the resulting list should be smaller than [length l]: | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
interval x y : list nat by wf (y - x) lt :=
interval x y with lt_dec x y :=
{ | left ltxy => x :: interval (S x) y;
| right nltxy => [] }. | Proof. lia. Defined. | Equations | interval | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"list",
"lt",
"wf"
] | Using well-founded recursion we can also define an [interval x y]
function producing the interval [x..y-1] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
interval_large x y : ~ x < y -> interval x y = []. | Proof. funelim (interval x y); clear Heq; intros; now try lia. Qed. | Lemma | interval_large | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"interval"
] | We prove a simple lemmas on [interval]: | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
indexes_interval l : indexes l = interval 0 (length l). | Proof.
set (P := fun start (l indexesl : list nat) => indexesl = interval start (length l)).
revert l.
apply (indexes_elim (P 0)
(fun l acc n indexesl =>
n <= length l ->
P n l acc -> P 0 l indexesl)); subst P; simpl.
intros l.
+ intros H. apply H; auto. rewrite interval_la... | Lemma | indexes_interval | examples | examples/accumulator.v | [
"Equations.Prop",
"Equations",
"Stdlib",
"List",
"Syntax",
"Arith",
"Lia",
"ListNotations"
] | [
"indexes",
"interval",
"interval_large",
"list",
"subst"
] | One can show that [indexes l] produces the interval [0..|l|-1] using [indexes_elim].
The recursion invariant for [indexes_go] records that [acc] corresponds to a partial
interval [n..|l|-1] during the computation, and is finally completed into [0..|l|-1]
by the end of the computation. We use the previous le... | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
intuition_solver : | := auto with *. | Ltac | intuition_solver | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
Eq (A : Type) | :=
{ eqb : A -> A -> bool;
eqb_spec : forall x y, reflect (x = y) (eqb x y) }. | Class | Eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"eqb",
"reflect"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
fin_eq {k} (f f' : fin k) : bool | :=
fin_eq fz fz => true;
fin_eq (fs f) (fs f') => fin_eq f f';
fin_eq _ _ => false. | Equations | fin_eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"f'",
"fin"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
fin_Eq k : Eq (fin k). | Proof.
exists fin_eq. intros x y. induction x; depelim y; simp fin_eq; try constructor; auto.
intro H; noconf H.
intro H; noconf H.
destruct (IHx y). subst x; now constructor. constructor. intro H; noconf H. now apply n0.
Defined. | Instance | fin_Eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq",
"depelim",
"fin",
"fin_eq",
"noconf",
"subst"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
bool_Eq : Eq bool. | Proof.
exists bool_eq. intros [] []; now constructor.
Defined. | Instance | bool_Eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
prod_eq A B : Eq A -> Eq B -> Eq (A * B). | Proof.
intros. exists (fun '(x, y) '(x', y') => eqb x x' && eqb y y').
intros [] []. destruct (eqb_spec a a0); subst.
destruct (eqb_spec b b0); subst. constructor; auto.
constructor; auto. intro H; noconf H. now elim n.
constructor; auto. simplify *. now elim n.
Defined. | Instance | prod_eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq",
"eqb",
"noconf",
"subst"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
option_eq {A : Type} {E:Eq A} (o o' : option A) : bool | :=
option_eq None None := true;
option_eq (Some o) (Some o') := eqb o o';
option_eq _ _ := false. | Equations | option_eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq",
"eqb"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
option_Eq A : Eq A -> Eq (option A). | Proof.
intros A_Eq. exists option_eq. intros [] []; simp option_eq; try constructor.
destruct (eqb_spec a a0); subst. now constructor.
constructor. intro H; noconf H. now elim n.
simplify *. simplify *. constructor.
Defined. | Instance | option_Eq | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq",
"noconf",
"option_eq",
"subst"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
eq_fin_fn {k} (f g : fin k -> A) : bool | :=
eq_fin_fn (k:=0) f g := true;
eq_fin_fn (k:=S k) f g := eqb (f fz) (g fz) && eq_fin_fn (fun n => f (fs n)) (fun n => g (fs n)). | Equations | eq_fin_fn | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"eqb",
"fin"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
Eq_graph k : Eq (fin k -> A). | Proof.
exists eq_fin_fn. induction k; intros; simp eq_fin_fn. constructor; auto.
extensionality i. depelim i.
destruct (eqb_spec (x fz) (y fz)). simpl. destruct (IHk (fun n => x (fs n)) (fun n => y (fs n))).
constructor; auto. extensionality n. depelim n. auto. eapply equal_f in e0. eauto. const... | Instance | Eq_graph | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Eq",
"depelim",
"eq_fin_fn",
"fin",
"subst"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
dec_rel {X:Type} (R : X → X → Prop) | := ∀ x y, {R x y} + {not (R x y)}. | Definition | dec_rel | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
WFT : Type | :=
| ZT : WFT
| SUP : (X -> WFT) -> WFT. | Inductive | WFT | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
sec_disj (R : X -> X -> Prop) x y z | := R y z \/ R x y. | Definition | sec_disj | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
SecureBy (R : X -> X -> Prop) (p : WFT) : Prop | :=
match p with
| ZT => forall x y, R x y
| SUP f => forall x, SecureBy (fun y z => R y z \/ R x y) (f x)
end. | Fixpoint | SecureBy | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
SecureBy_mon p (R' S : X -> X -> Prop) (H : forall x y, R' x y -> S x y) :
SecureBy R' p -> SecureBy S p. | Proof.
revert R' S H.
induction p. simpl. intros. apply H. apply H0.
simpl. intros.
eapply H. 2:apply H1.
intros. simpl in H2. intuition.
Defined. | Lemma | SecureBy_mon | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
almost_full (R : X -> X -> Prop) | := exists p, SecureBy R p. | Definition | almost_full | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_tree_iter {x : X} (accX : Acc R x) | :=
match accX with
| Acc_intro f => SUP (fun y =>
match decR y x with
| left Ry => af_tree_iter (f y Ry)
| right _ => ZT
end)
end. | Fixpoint | af_tree_iter | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_tree : X → WFT | :=
fun x => af_tree_iter (wfR x). | Definition | af_tree | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT",
"af_tree_iter"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
Acc_ind_dep | := Induction for Acc Sort Prop. | Scheme | Acc_ind_dep | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
secure_from_wf : SecureBy (fun x y => not (R y x)) (SUP af_tree). | Proof.
intro x. unfold af_tree. generalize (wfR x).
induction a using Acc_ind_dep. simpl.
intros y. destruct (decR y x). simpl.
eapply SecureBy_mon; eauto. simpl; intros.
intuition. simpl. intros. intuition auto.
Defined. | Lemma | secure_from_wf | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc_ind_dep",
"SecureBy",
"SecureBy_mon",
"af_tree"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_from_wf : almost_full (fun x y => not (R y x)). | Proof. exists (SUP af_tree). apply secure_from_wf. Defined. | Corollary | af_from_wf | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"af_tree",
"almost_full",
"secure_from_wf"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
AlmostFull {X} (R : X -> X -> Prop) | :=
is_almost_full : almost_full R. | Class | AlmostFull | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"almost_full"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
proper_af X : Proper (relation_equivalence ==> iff) (@AlmostFull X). | Proof.
intros R S eqRS.
split; intros.
destruct H as [p Hp]. exists p.
revert R S eqRS Hp. induction p; simpl in *; intros. now apply eqRS.
apply (H x (fun y z => R y z \/ R x y)). repeat red; intuition.
apply Hp.
destruct H as [p Hp]. exists p.
revert R S eqRS Hp. induction p; simpl in *; intros. now ... | Instance | proper_af | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"split"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
almost_full_le : AlmostFull Peano.le. | Proof.
assert (relation_equivalence Peano.le (fun x y => ~ (y < x))) as ->.
{ cbn. intros x y. intuition auto. red in H0. lia. lia. }
red. eapply af_from_wf. 2:apply lt_wf.
intros x y. apply lt_dec.
Defined. | Instance | almost_full_le | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"af_from_wf",
"le",
"lt_wf"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_trans_n1_left {R : X -> X -> Prop} x y z : R x y -> clos_trans_n1 _ R y z -> clos_trans_n1 _ R x z. | Proof.
induction 2. econstructor 2; eauto. constructor; auto.
econstructor 2. eauto. auto.
Defined. | Lemma | clos_trans_n1_left | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_trans_1n_n1 {R : X -> X -> Prop} x y : clos_trans_1n _ R x y -> clos_trans_n1 _ R x y. | Proof.
induction 1. now constructor. eapply clos_trans_n1_left; eauto.
Defined. | Lemma | clos_trans_1n_n1 | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"clos_trans_n1_left"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_refl_trans_right {R : X -> X -> Prop} x y z :
R y z -> clos_refl_trans _ R x y -> clos_trans_n1 _ R x z. | Proof.
intros Ryz Rxy. apply clos_rt_rtn1_iff in Rxy.
induction Rxy in Ryz, z |- *. econstructor 1; eauto. econstructor 2; eauto.
Defined. | Lemma | clos_refl_trans_right | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"clos_refl_trans",
"clos_rt_rtn1_iff"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_trans_1n_right {R : X -> X -> Prop} x y z : R y z -> clos_trans_1n _ R x y -> clos_trans_1n _ R x z. | Proof.
induction 2. econstructor 2; eauto. constructor; auto.
econstructor 2. eauto. auto.
Defined. | Lemma | clos_trans_1n_right | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_trans_n1_1n {R : X -> X -> Prop} x y : clos_trans_n1 _ R x y -> clos_trans_1n _ R x y. | Proof.
induction 1. now constructor. eapply clos_trans_1n_right; eauto.
Defined. | Lemma | clos_trans_n1_1n | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"clos_trans_1n_right"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
acc_from_af (p : WFT X) (T R : X → X → Prop) y :
(∀ x z, clos_refl_trans X T z y ->
clos_trans_1n X T x z ∧ R z x → False)
→ SecureBy R p → Acc T y. | Proof.
induction p as [|p IHp] in T, R, y |- * .
+ simpl. intros. constructor.
intros z Tz. specialize (H z y). elim H. constructor 2. split; auto.
constructor. auto.
+ intros cond secure. constructor. intros z Tzy.
simpl in secure.
specialize (IHp y T (fun y0 z0 => R y0 z0 \/ R y y0... | Lemma | acc_from_af | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc",
"SecureBy",
"WFT",
"clos_refl_trans",
"clos_refl_trans_right",
"clos_trans_n1_1n",
"cond",
"split"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
wf_from_af (p : WFT X) (T R : X → X → Prop) :
(∀ x y, clos_trans_1n X T x y ∧ R y x → False)
→ SecureBy R p → well_founded T. | Proof.
intros. intro x. eapply acc_from_af;eauto.
Defined. | Lemma | wf_from_af | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"WFT",
"acc_from_af",
"well_founded"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
compose_rel {X} (R S : X -> X -> Prop) : relation X | :=
fun x y => exists z, R x z /\ S z y. | Definition | compose_rel | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"relation"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
power (k : nat) (T : X -> X -> Prop) : X -> X -> Prop | :=
power 0 T := T;
power (S k) T := fun x y => exists z, power k T x z /\ T z y. | Equations | power | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
acc_incl (T T' : X -> X -> Prop) x : (forall x y, T' x y -> T x y) -> Acc T x -> Acc T' x. | Proof.
intros HT H; induction H in |- *.
constructor. intros. apply HT in H1. now apply H0.
Qed. | Lemma | acc_incl | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
power_clos_trans (T : X -> X -> Prop) k : inclusion _ (power k T) (clos_trans _ T). | Proof.
intros x y. induction k in x, y |- *. simpl. now constructor.
simpl. intros [z [Pxz Tzy]]. econstructor 2. apply IHk; eauto. constructor. auto.
Qed. | Lemma | power_clos_trans | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"inclusion",
"power"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
clos_trans_power (T : X -> X -> Prop) x y : clos_trans _ T x y -> exists k, power k T x y. | Proof.
rewrite clos_trans_tn1_iff. induction 1. exists 0; auto.
destruct IHclos_trans_n1 as [k pkyz]. exists (S k). simp power. now exists y.
Qed. | Lemma | clos_trans_power | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"power"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
acc_power (T : X -> X -> Prop) x k : Acc T x -> Acc (power k T) x. | Proof.
intros. apply Acc_clos_trans in H. revert H.
apply acc_incl. intros. now apply (power_clos_trans _ k).
Qed. | Lemma | acc_power | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc",
"acc_incl",
"power",
"power_clos_trans"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
secure_power (k : nat) (p : WFT X) : WFT X | :=
secure_power 0 p := p;
secure_power (S k) p := SUP (fun x => secure_power k p). | Equations | secure_power | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
secure_by_power R p (H : SecureBy R p) k :
SecureBy R (secure_power k p). | Proof.
induction k in R, p, H |- *; trivial.
induction p. simpl in *. intros. apply IHk. simpl. intuition.
simpl. intros.
apply IHk. simpl. intros. simpl in H0. simpl in H.
specialize (H x0). eapply SecureBy_mon. 2:eauto. simpl. intuition.
Qed. | Lemma | secure_by_power | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"SecureBy_mon",
"secure_power"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
acc_from_power_af (p : WFT X) (T R : X → X → Prop) y k :
(∀ x z, clos_refl_trans _ T z y ->
clos_trans_1n X (power k T) x z ∧ R z x → False)
→ SecureBy R (secure_power k p) → Acc T y. | Proof.
(* induction k in T, R, y |- *. simpl. intros. simp secure_power in H0. eapply acc_from_af; eauto. admit. *)
(* intros. *)
(* simp secure_power in H0. simpl in H0. *)
(* constructor. intros x Txy. *)
(* specialize (IHk T (sec_disj R x)). specialize (H0 x). *)
(* apply IHk; auto. *)
(*... | Lemma | acc_from_power_af | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"Acc",
"SecureBy",
"WFT",
"clos_refl_trans",
"power",
"secure_power"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
wf_from_power_af (p : WFT X) (T R : X → X → Prop) k :
(∀ x y, clos_trans_1n X (power k T) x y ∧ R y x → False)
→ SecureBy R p → well_founded T. | Proof.
intros. intro x. eapply acc_from_power_af; eauto. apply secure_by_power. apply H0.
Defined. | Lemma | wf_from_power_af | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"WFT",
"acc_from_power_af",
"power",
"secure_by_power",
"well_founded"
] | Defined. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
af_wf : WellFounded T. | Proof. red. destruct af. eapply wf_from_af; eauto. Defined. | Instance | af_wf | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WellFounded",
"wf_from_af"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_power_wf : WellFounded T. | Proof.
destruct af as [p Sp].
eapply wf_from_power_af; eauto.
Defined. | Instance | af_power_wf | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WellFounded",
"wf_from_power_af"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
cofmap {X Y : Type} (f : Y -> X) (p : WFT X) : WFT Y | :=
cofmap f ZT := ZT;
cofmap f (SUP w) := SUP (fun y => cofmap f (w (f y))). | Equations | cofmap | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
cofmap_secures {X Y : Type} (f : Y -> X) (p : WFT X) (R : X -> X -> Prop) :
SecureBy R p -> SecureBy (fun x y => R (f x) (f y)) (cofmap f p). | Proof.
induction p in R |- *; simpl; auto.
intros.
specialize (H (f x) (fun y z : X => R y z \/ R (f x) y)). simpl in H.
apply H. apply H0.
Defined. | Lemma | cofmap_secures | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"WFT",
"cofmap"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
AlmostFull_MR {X Y} R (f : Y -> X) : AlmostFull R -> AlmostFull (Wf.MR R f). | Proof. intros [p sec]. exists (cofmap f p). apply (cofmap_secures f p _ sec). Defined. | Instance | AlmostFull_MR | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"cofmap",
"cofmap_secures"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
oplus_nullary {X:Type} (p:WFT X) (q:WFT X) | :=
match p with
| ZT => q
| SUP f => SUP (fun x => oplus_nullary (f x) q)
end. | Fixpoint | oplus_nullary | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
oplus_nullary_sec_intersection {X} (p : WFT X) (q: WFT X)
(C : X → X → Prop) (A : Prop) (B : Prop) :
SecureBy (fun y z => C y z ∨ A) p →
SecureBy (fun y z => C y z ∨ B) q →
SecureBy (fun y z => C y z ∨ (A ∧ B)) (oplus_nullary p q). | Proof.
revert C q.
induction p; simpl; intros; auto.
induction q in C, H, H0 |- *; simpl in *; intuition.
specialize (H x y). specialize (H0 x y). intuition.
specialize (H1 x (fun y z => (C y z \/ A /\ B) \/ C x y)). simpl in *.
eapply SecureBy_mon. 2:eapply H1. simpl. intuition. intuition. firstorder auto.... | Lemma | oplus_nullary_sec_intersection | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"SecureBy_mon",
"WFT",
"oplus_nullary"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
oplus_unary (p : WFT X) (q : WFT X) : WFT X
by wf (p, q) (Subterm.lexprod _ _ WFT_subterm WFT_subterm) :=
oplus_unary ZT q := q;
oplus_unary p ZT := p;
oplus_unary (SUP f) (SUP g) :=
SUP (fun x => oplus_nullary (oplus_unary (f x) (SUP g))
(oplus_unary (SUP f) (g x))). | Proof. repeat constructor.
constructor 2. repeat constructor.
Defined. | Equations | oplus_unary | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT",
"lexprod",
"oplus_nullary",
"wf"
] | (oplus_unary_right (g x) x) }. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
oplus_binary (p : WFT X) (q : WFT X) : WFT X
by wf (p, q) (Subterm.lexprod _ _ WFT_subterm WFT_subterm) :=
oplus_binary ZT q := q;
oplus_binary p ZT := p;
oplus_binary (SUP f) (SUP g) :=
SUP (fun x => oplus_unary (oplus_binary (f x) (SUP g))
(oplus_binary (SUP f) (g x))). | Proof. repeat constructor.
constructor 2. repeat constructor.
Defined. | Equations | oplus_binary | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"WFT",
"lexprod",
"oplus_unary",
"wf"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
oplus_unary_sec_intersection {X} (p q : WFT X)
(C : X -> X -> Prop) (A B : X -> Prop) :
SecureBy (fun y z => C y z \/ A y) p ->
SecureBy (fun y z => C y z \/ B y) q ->
SecureBy (fun y z => C y z \/ (A y /\ B y)) (oplus_unary p q). | Proof.
funelim (oplus_unary p q); simpl; intros.
- eapply SecureBy_mon; [|eapply H0]; simpl; firstorder.
- eapply SecureBy_mon; [|eapply H]. simpl; firstorder.
- eapply SecureBy_mon. 2:eapply (oplus_nullary_sec_intersection _ _ _ (A x) (B x)). simpl.
intros. destruct H3; [|intuition auto]. rewrite <- or_ass... | Lemma | oplus_unary_sec_intersection | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"SecureBy_mon",
"WFT",
"oplus_nullary_sec_intersection",
"oplus_unary"
] | Defined. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
oplus_binary_sec_intersection' {X} (p q : WFT X)
(C : X -> X -> Prop) (A B : X -> X -> Prop) :
SecureBy (fun y z => C y z \/ A y z) p ->
SecureBy (fun y z => C y z \/ B y z) q ->
SecureBy (fun y z => C y z \/ (A y z /\ B y z)) (oplus_binary p q). | Proof.
funelim (oplus_binary p q); simpl; intros.
eapply SecureBy_mon. 2:eapply H0. simpl. firstorder.
eapply SecureBy_mon; [|eapply H]. simpl; firstorder.
eapply SecureBy_mon. 2:eapply (oplus_unary_sec_intersection _ _ _ (A x) (B x)). simpl.
intros. destruct H3; [|intuition auto]. rewrite <- or_assoc. left. ... | Lemma | oplus_binary_sec_intersection' | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"SecureBy_mon",
"WFT",
"oplus_binary",
"oplus_unary_sec_intersection"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
oplus_binary_sec_intersection {X} (p q : WFT X)
(A B : X -> X -> Prop) :
SecureBy A p ->
SecureBy B q ->
SecureBy (fun y z => A y z /\ B y z) (oplus_binary p q). | Proof.
revert p q A B; intros p q. funelim (oplus_binary p q); simpl; intros.
eapply SecureBy_mon. 2:eapply H0. simpl. firstorder.
eapply SecureBy_mon; [|eapply H]. simpl; firstorder.
eapply SecureBy_mon. 2:eapply (oplus_unary_sec_intersection _ _ _ (A x) (B x)). simpl.
intros. destruct H3; [|intuition auto].... | Lemma | oplus_binary_sec_intersection | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"SecureBy",
"SecureBy_mon",
"WFT",
"oplus_binary",
"oplus_unary_sec_intersection",
"sec_disj"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
inter_rel {X : Type} (A B : X -> X -> Prop) | := fun x y => A x y /\ B x y. | Definition | inter_rel | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_interesection {X : Type} (A B : X -> X -> Prop) :
AlmostFull A -> AlmostFull B -> AlmostFull (inter_rel A B). | Proof.
intros [pa Ha] [pb Hb]. exists (oplus_binary pa pb). now apply oplus_binary_sec_intersection.
Defined. | Corollary | af_interesection | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"inter_rel",
"oplus_binary",
"oplus_binary_sec_intersection"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_bool : AlmostFull (@eq bool). | Proof.
exists (SUP (fun _ => SUP (fun _ => ZT))).
simpl. intros x y z w. destruct x, y, z, w; intuition.
Defined. | Definition | af_bool | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"eq"
] | Qed. | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
product_rel {X Y : Type} (A : X -> X -> Prop) (B : Y -> Y -> Prop) | :=
fun x y => A (fst x) (fst y) /\ B (snd x) (snd y). | Definition | product_rel | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fst",
"snd"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
af_product {X Y : Type} (A : X -> X -> Prop) (B : Y -> Y -> Prop) :
AlmostFull A -> AlmostFull B -> AlmostFull (product_rel A B). | Proof.
intros. pose (af_interesection (Wf.MR A fst) (Wf.MR B snd)).
assert (relation_equivalence (inter_rel (Wf.MR A fst) (Wf.MR B snd)) (product_rel A B)).
repeat red; intuition. rewrite <- H1. apply a; typeclasses eauto.
Defined. | Instance | af_product | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"AlmostFull",
"af_interesection",
"fst",
"inter_rel",
"product_rel",
"snd"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
T (x y : nat * nat) : Prop | :=
(fst x = snd y /\ snd x < snd y) \/
(fst x = snd y /\ snd x < fst y). | Definition | T | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fst",
"snd"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
Tl (x y : nat * (nat * unit)) : Prop | :=
(fst x = fst (snd y) /\ fst (snd x) < fst (snd y)). | Definition | Tl | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fst",
"snd"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
Tr (x y : nat * (nat * unit)) : Prop | :=
(fst x = fst (snd y) /\ fst (snd x) < fst y). | Definition | Tr | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fst",
"snd"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
destruct_pairs | := repeat
match goal with
[ x : _ * _ |- _ ] => let x0 := fresh x in let x1 := fresh x in destruct x as [x0 x1]; simpl in *
| [ x : exists _ : _, _ |- _ ] => destruct x
| [ x : _ /\ _ |- _ ] => destruct x
end. | Ltac | destruct_pairs | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
subgraph k k' | := fin k -> option (bool * fin k'). | Definition | subgraph | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fin"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
graph k | := subgraph k k. | Definition | graph | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"subgraph"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
strict {k} (f : fin k) | := Some (true, f). | Definition | strict | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fin"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
large {k} (f : fin k) | := Some (false, f). | Definition | large | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fin"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
"0" | := fz : fin_scope. | Notation | 0 | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
"1" | := (fs 0) : fin_scope. | Notation | 1 | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 | |
T_graph_l (x : fin 2) : option (bool * fin 2) | :=
{ T_graph_l fz := large (fs fz);
T_graph_l (fs fz) := strict (fs fz) }. | Equations | T_graph_l | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fin",
"large",
"strict"
] | bug scopes not handled well | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
T_graph_r (x : fin 2) : option (bool * fin 2) | :=
{ T_graph_r fz := large (fs fz);
T_graph_r (fs fz) := strict fz }. | Equations | T_graph_r | examples | examples/AlmostFull.v | [
"Equations.Prop",
"Equations",
"Examples.Fin",
"Stdlib",
"Relations",
"Utf8",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"FunctionalExtensionality",
"ssreflect",
"ListNotations",
"ExtrOcamlBasic"
] | [
"fin",
"large",
"strict"
] | https://github.com/mattam82/Coq-Equations | a3d1e5a422ccde88c2b99228c7cf487f13934576 |
Structured dataset from Coq-Equations, a library for dependent pattern matching and well-founded recursion.
a3d1e5a422ccde88c2b99228c7cf487f13934576| Column | Type | Description |
|---|---|---|
| statement | string | Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof |
| proof | string | Verbatim proof/body, empty if the declaration has none |
| type | string | Declaration keyword |
| symbolic_name | string | Declaration identifier |
| library | string | Sub-library |
| filename | string | Repository-relative source path |
| imports | list[string] | File-level Require/Import modules |
| deps | list[string] | Intra-corpus identifiers referenced |
| docstring | string | Preceding documentation comment, empty if absent |
| source_url | string | Upstream repository |
| commit | string | Upstream commit extracted |
| Type | Count |
|---|---|
| Lemma | 787 |
| Equations | 731 |
| Definition | 440 |
| Ltac | 298 |
| Inductive | 238 |
| Notation | 136 |
| Instance | 126 |
| Fixpoint | 54 |
| Theorem | 53 |
| Class | 43 |
| Axiom | 29 |
| Let | 22 |
| Example | 16 |
| Parameter | 16 |
| Scheme | 12 |
| Remark | 10 |
| Coercion | 8 |
| Record | 7 |
| Variant | 4 |
| Fact | 3 |
| Corollary | 2 |
| Hypothesis | 2 |
filter {A} (l : list A) (p : A -> bool) : list A
:=
filter nil p := nil ;
filter (cons a l) p with p a => {
filter (cons a l) p true := a :: filter l p ;
filter (cons a l) p false := filter l p }.
filter | doc/equations_intro.vEach declaration is split into a statement (signature/claim) and a proof (body) that are disjoint
and together form the complete declaration, for proof modeling, autoformalization, retrieval, and
dependency analysis via deps.
@misc{coq_equations_dataset,
title = {Coq-Equations},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://github.com/mattam82/Coq-Equations, commit a3d1e5a422cc},
url = {https://huggingface.co/datasets/phanerozoic/Coq-Equations}
}