The example given below is a typical small standalone proof (using no library).
We prove that two definitions of the continuity of a function are equivalent. We give only one of the directions, the other is similar. We have written it in a rather elaborate way in order to show the possibilities of the system.
>PhoX> Sort real.
Sort is the name of the command used to create new sorts, but
you can also use it to give name to existing sorts.
>PhoX> Cst d : real -> real -> real.
>PhoX> Cst R0 : real.
>PhoX> Cst Infix[5] x "<=" y : real -> real -> prop.
>PhoX> Cst Infix[5] x "<" y : real -> real -> prop.
>PhoX> def Infix[5] x ">" y = y < x.
>PhoX> def Infix[5] x ">=" y = y <= x.
The command Cst introduces new constants of given sorts while
def is used to give definitions. The commands to define
inequalities are quite
complex, because we want to use some infix notation with a specific
priority.
>PhoX> def continue1 f x =
.
>PhoX> def continue2 f x =
.
>PhoX> claim lemme1
.
>PhoX> claim lemme2
.
The command claim allows to introduce new axioms (or lemmas that
you do not want to prove now. You can prove them later using the
command prove_claim). Beware that there may be a contradiction
in your axioms!
goal:
>PhoX> goal
.
goal 1/1
|-
%PhoX% intro 5.
goal 1/1
H :=
H0 := |-
An ``introduction'' for a given connective, is the natural way to
establish the truth of that connective without using other fact
or hypothesis. For instance, to prove
, we assume
and
prove
. Here, PhoX did five introductions:
Therefore, PhoX created three new objects:
and two new
hypothesis named H0 and H1.
%PhoX% apply H with H0. rmh H H0.
goal 1/1
G :=
|-
The apply command is quite intuitive to use. But it is a complex
command, performing unification (more precisely higher-order
unification) to guess the value of some variables.
Sometimes you do not get the result you expected and you need
to add extra information in the proper order.
lefts G twice with no more indication).
%PhoX% lefts G $$.
goal 1/1
H := H0 :=
|-
The left and lefts are introductions for an hypothesis:
that is the way to use an hypothesis in a ``standalone'' way (not
using the conclusion you want to prove or other hypothesis).
We need to write a ``$'' prefix, because
and
have
a prefix syntax and need other informations. The ``$'' prefix tells
that you just want this
symbol and nothing more.
%PhoX% apply lemme2 with H. rmh H.
goal 1/1
H0 :=
G :=
|-
%PhoX% lefts G $$. rename y a'.
goal 1/1
H0 :=
H1 := H2 :=
|-
intros several times with no more indication). Two
goals are created, as well as an existential variable (denoted by
?1) for which we have to find a value.
%PhoX% intros $
$
$
$![]()
.
goal 1/2
H0 :=
H1 :=
H2 :=
|-
goal 2/2
H0 :=
H1 :=
H2 :=
H3 :=
|-
?1 is %PhoX% axiom H1. auto +lemme1.
Remark. Instead of the command auto +lemme1 one could
also say elim lemme1. elim H0. axiom H3. or
apply H0 with H3. elim lemme1 with G. where G is an
hypothesis produced by the first command. We could also give the value
of the existential variable by typing instance ?1 a'.
A good exercise for the reader consists in understanding what these commands do. The appendix A should help you !