(; Equality is a family of binary predicate symbols. ;)
Eq : sort -> predicate.
[A] fol.pred_arity (Eq A) --> read_sorts (S (S O)) A A.
[A] fol.pred_domain (Eq A) --> read_sorts (S (S O)) A A.
def eq (A : sort) : term A -> term A -> prop := pred_apply (Eq A).
[A,x,y]
...
...
@@ -97,8 +97,8 @@ def eq_pred_imp : L : sorts -> p : (terms L -> prop) -> proof (pred_imp L p p).
(H =>
eq_congr A x y H (y : term A => pred_imp L (l : terms L => p (cons_term A x L l)) (l : terms L => p (cons_term A y L l))) (eq_pred_imp L (l : terms L => p (cons_term A x L l)))))).
def fun_eq : L : sorts -> B : sort -> (terms L -> term B) -> (terms L -> term B) -> prop.
[B,b,b'] fun_eq fol.nil_sort B b b' --> eq B (b nil_term) (b' nil_term)
...
...
@@ -118,5 +118,5 @@ def eq_fun_eq : L : sorts -> B : sort -> f : (terms L -> term B) -> proof (fun_e
(H =>
eq_congr A x y H (y : term A => fun_eq L B (l : terms L => f (cons_term A x L l)) (l : terms L => f (cons_term A y L l))) (eq_fun_eq L B (l : terms L => f (cons_term A x L l)))))).
To define a new first-order theory, we start by declaring the sorts,
predicate symbols, and function symbols as new constants of type
=fol.sort=, =fol.predicate=, and =fol.function= respectively. We then
define the arity of each function and predicate symbol and the
define the domain of each function and predicate symbol and the
codomain sort of each function symbol by extending the definitions of
=fol.pred_arity=, =fol.fun_arity=, and =fol.fun_codomain= respectively.
=fol.pred_domain=, =fol.fun_domain=, and =fol.fun_codomain= respectively.
Finally we declare constants for the axioms and axiom schemes of the
theory.
...
...
@@ -244,7 +243,7 @@ We treat equality as a first-order theory defined in the file
a sort:
- =eq.Eq : fol.sort -> fol.predicate=
The predicate symbol =eq.Eq A= expects two terms of sort =A= so the arity of the symbol =eq.Eq A= is =fol.read_sorts (nat.S (nat.S nat.O)) A A=.
The predicate symbol =eq.Eq A= expects two terms of sort =A= so the domain of the symbol =eq.Eq A= is =fol.read_sorts (nat.S (nat.S nat.O)) A A=.
The shortcut notation =eq.eq A a b= where =A= has type =fol.sort= and
both =a= and =b= have type =fol.term A= denotes the formula
...
...
@@ -261,10 +260,10 @@ facts:
=eq.eq_trans : A : fol.sort -> fol.proof (fol.all A (x => fol.all A (y => fol.all A (z => fol.imp (eq.eq A x y) (fol.imp (eq.eq A y z) (eq.eq A x z))))))=
- Equality is a congruence with respect to all function symbols:
=eq.eq_fun_equal : f : fol.function -> fol.proof (fol.all A1 (x1 => fol.all A1 (y1 => fol.imp (eq.eq A1 x1 y1) (… fol.all An (xn => fol.all An (yn => fol.imp (eq.eq An xn yn) (eq.eq B (fol.apply_fun f x1 … xn) (fol.apply_fun f y1 … yn)))) …))))=
where =f= has arity =fol.read_sorts n A1 … An= and codomain =B=.
where =f= has domain =fol.read_sorts n A1 … An= and codomain =B=.
- Equality is a congruence with respect to all predicate symbols:
=eq.eq_pred_equal : p : fol.predicate -> fol.proof (fol.all A1 (x1 => fol.all A1 (y1 => fol.imp (eq.eq A1 x1 y1) (… fol.all An (xn => fol.all An (yn => fol.imp (eq.eq An xn yn) (fol.imp (fol.apply_pred p x1 … xn) (fol.apply_pred p y1 … yn)))) …))))=
where =p= has arity =fol.read_yypes n A1 … An=
where =p= has domain =fol.read_yypes n A1 … An=
* The tactic language
...
...
@@ -494,7 +493,7 @@ can be used for this purpose:
(A : fol.sort -> (fol.term A -> fol.prop) -> cert.certificate) ->
(A : fol.sort -> (fol.term A -> fol.prop) -> cert.certificate) ->