fact
stringlengths 3
2.59k
| type
stringclasses 20
values | library
stringclasses 4
values | imports
listlengths 0
18
| filename
stringclasses 207
values | symbolic_name
stringlengths 1
36
| docstring
stringclasses 269
values |
|---|---|---|---|---|---|---|
bool : Set := true : bool | false : bool
]]
We can define the boolean negation as follows: *)
Equations neg (b : bool) : bool :=
neg true := false;
neg false := true.
|
Inductive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
bool
| null |
neg (b : bool) : bool :=
neg true := false;
neg false := true.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
neg
|
* 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 as follows:
|
neg_inv : forall b, neg (neg b) = b.
|
Lemma
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
neg_inv
| null |
neg_ind : bool -> bool -> Prop :=
| neg_ind_equation_1 : neg_ind true false
| neg_ind_equation_2 : neg_ind false true ]]
Along with a proof of [Π b, neg_ind b (neg b)], we can eliminate any call
to [neg] specializing its argument and result in a single command.
|
Inductive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
neg_ind
| null |
list {A} : Type := nil : list | cons : A -> list -> list.
|
Inductive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
list
|
* 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 proof principles for (recursive)
definitions.
[Equations] provides this through an automatic generation of proofs related to
the function. Namely, each defining equation gives rise to a lemma stating the
equality between the left and right hand sides. These equations can be used as
rewrite rules for simplification during proofs, without having to rely on the
fragile simplifications implemented by raw reduction. We can also generate the
inductive graph of any [Equations] definition, giving the strongest elimination
principle on the function.
I.e., for [neg] the inductive graph is defined as: [[
Inductive neg_ind : bool -> bool -> Prop :=
| neg_ind_equation_1 : neg_ind true false
| neg_ind_equation_2 : neg_ind false true ]]
Along with a proof of [Π b, neg_ind b (neg b)], we can eliminate any call
to [neg] specializing its argument and result in a single command.
Suppose we want to show that [neg] is involutive for example, our goal will
look like: [[
b : bool
============================
neg (neg b) = b ]]
An application of the tactic [funelim (neg b)] will produce two goals corresponding to
the splitting done in [neg]: [neg false = true] and [neg true = false].
These correspond exactly to the rewriting lemmas generated for [neg].
In the following sections we will show how these ideas generalize to more complex
types and definitions involving dependencies, overlapping clauses and recursion.
* Building up
** Polymorphism
Coq's inductive types can be parameterized by types, giving polymorphic datatypes.
For example the list datatype is defined as:
|
tail {A} (l : list A) : list A :=
tail nil := nil ;
tail (cons a v) := v.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
tail
|
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:
|
app {A} (l l' : list A) : list A :=
app nil l' := l' ;
app (cons a l) l' := cons a (app l l').
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
app
|
** 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
relations. A classical example is list concatenation:
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
filter
|
** 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 to the left of our equations made available for further
refinement. This concept is know as with clauses in the Agda
%\cite{norell:thesis}% community and was first presented and
implemented in the Epigram language
%\cite{DBLP:journals/jfp/McBrideM04}%.
The compilation of with clauses and its treatment for generating
equations and the induction principle are quite involved in the
presence of dependencies, but the basic idea is to add a new case
analysis to the program. To compute the type of the new subprogram,
we actually abstract the discriminee term from the expected type of
the clause, so that the type can get refined in the subprogram. In
the non-dependent case this does not change anything though.
Each [with] node generates an auxiliary definition from the clauses
in the curly brackets, taking the additional object as argument. The
equation for the with node will simply be an indirection to the
auxiliary definition and simplification will continue as usual with
the auxiliary definition's rewrite rules.
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
filter
|
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
current problem. Under a `with` node, they should match the variable(s) introduced by the `with` construct.
When using "|", the ";" at the end of a clause becomes optional.
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
unzip
|
A common use of with clauses is to scrutinize recursive results like the following:
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
equal
|
* 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 type carrying proofs of the equality or disequality
of the arguments. The sum type [{ A } + { B }] is a constructive variant of disjunction
that can be used in programs to give at the same time a boolean algorithmic information
(are we in branch [A] or [B]) and a _logical_ information (a proof witness of [A] or [B]).
Hence its constructors [left] and [right] take proofs as arguments. The [eq_refl] proof
term is the single proof of [x = x] (the [x] is generaly infered automatically).
|
head {A} (l : list A) (pf : l <> nil) : A :=
head nil pf with pf eq_refl := { | ! };
head (cons a v) _ := a.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
head
|
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 matching this equality
proof is to unify [n] and [m], hence the left hand side patterns become [S n] and
[S ?(n)] and the return type of this branch is refined to [{ n = n } + { n <> n }].
We can easily provide a proof for the left case.
- In the right case, we mark the proof unfilled with an underscore. This will
generate an obligation for the hole, that can be filled automatically by a
predefined tactic or interactively by the user in proof mode (this uses the
same obligation mechanism as the Program extension
%\cite{sozeau.Coq/FingerTrees/article}%). In this case the automatic tactic
is able to derive by itself that [n <> m -> S n <> S m].
Dependent types are also useful to turn partial functions into total functions by
restricting their domain. Typically, we can force the list passed to [head]
to be non-empty using the specification:
|
eq (A : Type) (x : A) : A -> Prop :=
eq_refl : eq A x x.
|
Inductive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
eq
| null |
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
eqt
|
** 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 Haskell
%\cite{GADTcomplete}%. Families provide a way to associate to each constructor
a different type, making it possible to give specific information about a value
in its type.
*** Equality
The alma mater of inductive families is the propositional equality
[eq] defined as: [[
Inductive eq (A : Type) (x : A) : A -> Prop :=
eq_refl : eq A x x. ]]
Equality is a polymorphic relation on [A]. (The [Prop] sort (or kind) categorizes
propositions, while the [Set] sort, equivalent to $\star$ in Haskell categorizes
computational types.) Equality is _parameterized_ by a value [x] of type [A] and
_indexed_ by another value of type [A]. Its single constructor states that
equality is reflexive, so the only way to build an object of [eq x y] is if
[x ~= y], that is if [x] is definitionaly equal to [y].
Now what is the elimination principle associated to this inductive family?
It is the good old Leibniz substitution principle: [[
forall (A : Type) (x : A) (P : A -> Type), P x -> forall y : A, x = y -> P y ]]
Provided a proof that [x = y], we can create on object of type [P y] from an
existing object of type [P x]. This substitution principle is enough to show
that equality is symmetric and transitive. For example we can use
pattern-matching on equality proofs to show:
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
vmap
| null |
vtail {A n} (v : vector A (S n)) : vector A n :=
vtail (Vcons a v') := v'.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
vtail
|
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 code.
In other words, it provides only _logical_ information about
the shape of [v] but no computational information.
The [vmap] function works on every member of the [vector] family,
but some functions may work only for some subfamilies, for example
[vtail]:
|
NoConfusion for nat.
|
Derive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
NoConfusion
|
** Derived notions, No-Confusion
For this to work smoothlty, the package requires some derived definitions
on each (indexed) family, which can be generated automatically using
the generic [Derive] command. Here we ask to generate the signature,
heterogeneous no-confusion and homogeneous no-confusion principles for vectors:
|
Signature NoConfusion NoConfusionHom for vector.
|
Derive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
Signature
| null |
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
diag
|
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 principle for the family, which
allows to discriminate between objects in potentially different instances/fibers of the family,
or deduce injectivity of each constructor. The [NoConfusionHom] variant derives
the homogeneous no-confusion principle between two objects in the _same_ instance
of the family, e.g. to simplify equations of the form [Vnil = Vnil :> vector A 0].
This last principle can only be defined when pattern-matching on the inductive family
does not require the [K] axiom and will otherwise fail.
** Unification and indexed datatypes
Back to our example, of course the equations and the induction principle are simplified in a
similar way. If we encounter a call to [vtail] in a proof, we can
use the following elimination principle to simplify both the call and the
argument which will be automatically substituted by an object of the form
[Vcons _ _ _]:[[
forall P : forall (A : Type) (n : nat), vector A (S n) -> vector A n -> Prop,
(forall (A : Type) (n : nat) (a : A) (v : vector A n),
P A n (Vcons a v) v) ->
forall (A : Type) (n : nat) (v : vector A (S n)), P A n v (vtail v) ]]
As a witness of the power of the unification, consider the following function
which computes the diagonal of a square matrix of size [n * n].
|
id (n : nat) : nat by wf n lt :=
id 0 := 0;
id (S n') := S (id n').
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
id
|
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 introduces decorations to the proof term
that prevent the syntactic guard check from seeing that the
definition is structurally recursive.
To aleviate this problem, [Equations] provides support for
_well-founded_ recursive definitions which do not rely on syntactic
checks.
The simplest example of this is using the [lt] order on natural numbers
to define a recursive definition of identity:
|
Subterm for vector.
|
Derive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
Subterm
|
Here [id] is defined by well-founded recursion on [lt] on the (only)
argument [n] using the [by wf] annotation. At recursive calls of
[id], obligations are generated to show that the arguments
effectively decrease according to this relation. Here the proof
that [n' < S n'] is discharged automatically.
Wellfounded recursion on arbitrary dependent families is not as easy
to use, as in general the relations on families are _heterogeneous_,
as they must relate inhabitants of potentially different instances of
the family. [Equations] provides a [Derive] command to generate the
subterm relation on any such inductive family and derive the
well-foundedness of its transitive closure. This provides
course-of-values or so-called "mathematical" induction on these
objects, reflecting the structural recursion criterion in the logic.
|
t_direct_subterm (A : Type) :
forall n n0 : nat, vector A n -> vector A n0 -> Prop :=
t_direct_subterm_1_1 : forall (h : A) (n : nat) (H : vector A n),
t_direct_subterm A n (S n) H (Vcons h H) ]]
That is, there is only one recursive subterm, for the subvector
in the [Vcons] constructor.
|
Inductive
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
t_direct_subterm
| null |
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
unzip
|
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
tactic defined in [Equations.Init] includes a proof-search
for [subterm] proofs which can resolve the recursive call obligation
automatically in this case.
|
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
diag
|
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:
|
uipa : forall A, UIP A.
|
Axiom
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
uipa
|
The user must declare this axiom itself, as an instance of the [UIP] class.
|
Instance uipa.
|
Existing
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
Instance
| null |
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
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
K
|
In this case the following definition uses the [UIP] axiom just declared.
|
allows however to use constructive proofs of UIP for types
enjoying decidable equality.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
allows
| null |
K' (x : nat) (P : x = x -> Type) (p : P eq_refl)
(H : x = x) : P H :=
K' x P p eq_refl := p.
|
Equations
|
doc
|
[
"Coq.Arith",
"Coq.Lia",
"Coq.Program",
"Equations.Equations",
"Bvector"
] |
doc/equations_intro.v
|
K
|
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 natural numbers, from which
we can automatically derive a [UIP nat] instance. Note that
the computational behavior of this definition on open terms is not
to reduce to [p] but pattern-matches on the decidable equality
proof. However the defining equation still holds as a
_propositional_ equality, and the definition of K' is axiom-free.
|
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
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
rev_acc
|
** 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 matching on the list.
|
rev_acc_eq : forall {A} (l : list A), rev_acc l = rev l.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
rev_acc_eq
|
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.
|
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
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
indexes
|
** 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].
|
indexes_spec (l : list nat) : Forall (fun x => x < length l) (indexes l).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
indexes_spec
|
Clearly, all indexes in the resulting list should be smaller than [length l]:
|
interval_large x y : ~ x < y -> interval x y = [].
|
Lemma
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
interval_large
|
We prove a simple lemmas on [interval]:
|
indexes_interval l : indexes l = interval 0 (length l).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Coq.List",
"Coq.Program",
"ExtrOcamlBasic"
] |
examples/accumulator.v
|
indexes_interval
|
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 lemmas as helpers.
|
Eq (A : Type) :=
{ eqb : A -> A -> bool;
eqb_spec : forall x y, reflect (x = y) (eqb x y) }.
|
Class
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
Eq
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
fin_eq
| null |
fin_Eq k : Eq (fin k).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
fin_Eq
| null |
bool_Eq : Eq bool.
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
bool_Eq
| null |
prod_eq A B : Eq A -> Eq B -> Eq (A * B).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
prod_eq
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
option_eq
| null |
option_Eq A : Eq A -> Eq (option A).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
option_Eq
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
eq_fin_fn
| null |
Eq_graph k : Eq (fin k -> A).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
Eq_graph
| null |
dec_rel {X:Type} (R : X → X → Prop) := ∀ x y, {R x y} + {not (R x y)}.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
dec_rel
| null |
WFT : Type :=
| ZT : WFT
| SUP : (X -> WFT) -> WFT.
|
Inductive
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
WFT
| null |
NoConfusion Subterm for WFT.
|
Derive
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
NoConfusion
| null |
sec_disj (R : X -> X -> Prop) x y z := R y z \/ R x y.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
sec_disj
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
SecureBy
| null |
SecureBy_mon p (R' S : X -> X -> Prop) (H : forall x y, R' x y -> S x y) :
SecureBy R' p -> SecureBy S p.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
SecureBy_mon
| null |
almost_full (R : X -> X -> Prop) := exists p, SecureBy R p.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
almost_full
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_tree_iter
| null |
af_tree : X → WFT :=
fun x => af_tree_iter (wfR x).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_tree
| null |
secure_from_wf : SecureBy (fun x y => not (R y x)) (SUP af_tree).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
secure_from_wf
| null |
af_from_wf : almost_full (fun x y => not (R y x)).
|
Corollary
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_from_wf
| null |
AlmostFull {X} (R : X -> X -> Prop) :=
is_almost_full : almost_full R.
|
Class
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
AlmostFull
| null |
#[export] Instance proper_af X : Proper (relation_equivalence ==> iff) (@AlmostFull X).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
proper_af
| null |
#[export] Instance almost_full_le : AlmostFull Peano.le.
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
almost_full_le
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_trans_n1_left
| null |
clos_trans_1n_n1 {R : X -> X -> Prop} x y : clos_trans_1n _ R x y -> clos_trans_n1 _ R x y.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_trans_1n_n1
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_refl_trans_right
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_trans_1n_right
| null |
clos_trans_n1_1n {R : X -> X -> Prop} x y : clos_trans_n1 _ R x y -> clos_trans_1n _ R x y.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_trans_n1_1n
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
acc_from_af
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
wf_from_af
| null |
compose_rel {X} (R S : X -> X -> Prop) : relation X :=
fun x y => exists z, R x z /\ S z y.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
compose_rel
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
power
| null |
acc_incl (T T' : X -> X -> Prop) x : (forall x y, T' x y -> T x y) -> Acc T x -> Acc T' x.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
acc_incl
| null |
power_clos_trans (T : X -> X -> Prop) k : inclusion _ (power k T) (clos_trans _ T).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
power_clos_trans
| null |
clos_trans_power (T : X -> X -> Prop) x y : clos_trans _ T x y -> exists k, power k T x y.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
clos_trans_power
| null |
acc_power (T : X -> X -> Prop) x k : Acc T x -> Acc (power k T) x.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
acc_power
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
secure_power
| null |
secure_by_power R p (H : SecureBy R p) k :
SecureBy R (secure_power k p).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
secure_by_power
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
acc_from_power_af
| null |
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.
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
wf_from_power_af
| null |
af_wf : WellFounded T.
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_wf
| null |
af_power_wf : WellFounded T.
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_power_wf
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
cofmap
| null |
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).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
cofmap_secures
| null |
#[export] Instance AlmostFull_MR {X Y} R (f : Y -> X) : AlmostFull R -> AlmostFull (Wf.MR R f).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
AlmostFull_MR
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
oplus_nullary
| null |
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).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
oplus_nullary_sec_intersection
| null |
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).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
oplus_unary_sec_intersection
| null |
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).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
oplus_binary_sec_intersection
| null |
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).
|
Lemma
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
oplus_binary_sec_intersection
| null |
inter_rel {X : Type} (A B : X -> X -> Prop) := fun x y => A x y /\ B x y.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
inter_rel
| null |
af_interesection {X : Type} (A B : X -> X -> Prop) :
AlmostFull A -> AlmostFull B -> AlmostFull (inter_rel A B).
|
Corollary
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_interesection
| null |
af_bool : AlmostFull (@eq bool).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_bool
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
product_rel
| null |
#[export] Instance af_product {X Y : Type} (A : X -> X -> Prop) (B : Y -> Y -> Prop) :
AlmostFull A -> AlmostFull B -> AlmostFull (product_rel A B).
|
Instance
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
af_product
| null |
T (x y : nat * nat) : Prop :=
(fst x = snd y /\ snd x < snd y) \/
(fst x = snd y /\ snd x < fst y).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
T
| null |
Tl (x y : nat * (nat * unit)) : Prop :=
(fst x = fst (snd y) /\ fst (snd x) < fst (snd y)).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
Tl
| null |
Tr (x y : nat * (nat * unit)) : Prop :=
(fst x = fst (snd y) /\ fst (snd x) < fst y).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
Tr
| null |
subgraph k k' := fin k -> option (bool * fin k').
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
subgraph
| null |
graph k := subgraph k k.
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
graph
| null |
strict {k} (f : fin k) := Some (true, f).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
strict
| null |
large {k} (f : fin k) := Some (false, f).
|
Definition
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
large
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
T_graph_l
| null |
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
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
T_graph_r
| null |
graph_compose {k} (g1 g2 : graph k) : graph k :=
graph_compose g1 g2 arg0 with g1 arg0 :=
{ | Some (weight, arg1) with g2 arg1 :=
{ | Some (weight', arg2) => Some (weight || weight', arg2);
| None => None };
| None => None }.
|
Equations
|
examples
|
[
"Equations.Equations",
"Examples",
"Relations",
"Utf8",
"Relations",
"Wellfounded",
"Setoid",
"RelationClasses",
"Morphisms",
"Lia",
"Bool",
"List",
"Arith",
"String",
"Coq.FunctionalExtensionality",
"ssreflect",
"Lia",
"ExtrOcamlBasic"
] |
examples/AlmostFull.v
|
graph_compose
| null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.