aa r X i v : . [ m a t h . L O ] F e b FORMALIZING RELATIONS IN TYPE THEORY
FARIDA KACHAPOVA
Abstract.
Type theory plays an important role in foundations of mathematics as a framework for formalizingmathematics and a base for proof assistants providing semi-automatic proof checking and construction. Deriva-tion of each theorem in type theory results in a formal term encapsulating the whole proof process. In thispaper we use a variant of type theory, namely the Calculus of Constructions with Definitions, to formalize thestandard theory of binary relations. This includes basic operations on relations, criteria for special propertiesof relations, invariance of these properties under the basic operations, equivalence relation, well-ordering, andtransfinite induction. Definitions and proofs are presented as flag-style derivations.
1. Introduction
First type theories were proposed by B. Russell [10] as a foundation of mathematics. Other importanttype theories are typed λ -calculus introduced by A. Church [2] and intuitionistic type theory introduced by P.Martin-L¨of [7]. A higher-order typed λ -calculus known as Calculus of Constructions (CoC) was created by T.Coquand [3]. Variants of CoC make formal bases of proof assistants, which are computer tools for formalizingand developing mathematics. In particular, the well-known proof assistant Coq is based on the strong variantof CoC called the Calculus of Inductive Constructions (CIC).Here we use the variant λD of CoC developed in [8]; λD is called the Calculus of Constructions with Defini-tions. We choose λD because of its following useful properties.– In λD , as in other variants of CoC, proofs are expressed as formal terms and thus are incorporated inthe system.– In λD type checking is decidable and therefore proof checking is decidable. So the correctness of a proofcan be checked by an algorithm.– λD is strongly normalizing, which implies the logical consistency of this theory, even with classical logic(when no extra axioms are added) - see [1].The theory λD is weaker than CIC because λD does not have inductive types. This does not limit itscapability for formalizing mathematics because in λD we can use axiomatic approach and higher-order logic toexpress the objects that CIC defines with inductive types.In Section 2 we briefly describe the theory λD , derived rules of intuitionistic logic in λD , and the classicalaxiom of excluded third that can be added to λD if necessary; we also briefly explain the flag format derivation.In Section 3 we describe the equality in λD and its derived properties.In Section 4 we study binary relations in λD , operations on relations, and their properties. In Section 5 weformally prove criteria of relexivity, symmetry, antisymmetry and transitivity, and study the invariance of theseproperties under some basic operations. In Section 6 we formally define partitions in λD and provide a proof oftheir correspondence with equivalence relations. In Section 6 we also provide an example of partial order witha formal proof, definition of well-ordering in λD and a formal proof of the principle of transfinite induction.In our formalizations we aim to keep the language and theorems as close as possible to the ones of standardmathematics. In definitions and proofs we use the flag-style derivation described in [8]. Long formal derivationsare moved from the main text to Appendices for better readability. Mathematics Subject Classification.
Primary 03B30; Secondary 03B38.
Key words and phrases.
Type theory, calculus of constructions, binary relation, transfinite induction, flag-style derivation.
2. Type Theory λD In [8] Nederpelt and Geuvers developed a formal theory λD and formalized some parts of logic and mathe-matics in it. Here we briefly describe main features of λD . λD The language of λD described in [8] has an infinite set of variables, V , and an infinite set of constants, C ;these two sets are disjoint. There are also special symbols (cid:3) and ∗ . Definition 2.1.
Expressions of the language are defined recursively as follows.(1) Each variable is an expression.(2) Each constant is an expression.(3) Constant * is an expression.(4) Constant (cid:3) is an expression.(5) (Application) If A and B are expressions, then AB is an expression.(6) (Abstraction) If A , B are expressions and x is a variable, then λx : A.B is an expression.(7) (Dependent Product) If A , B are expressions and x is a variable, then Π x : A.B is an expression.(8) If A , A , . . . , A n are expressions and c is a constant, then c ( A , A , . . . , A n ) is an expression. An expression A → B is introduced as a particular type of Dependent Product from (7) when x is not a freevariable in B . Definition 2.2. (1) A statement is of the form M : N , where M and N are expressions.(2) A declaration is of the form x : N , where x is a variable and N is an expression.(3) A descriptive definition is of the form: ¯ x : ¯ A ⊲ c (¯ x ) := M : N, where ¯ x is a list x , x , . . . , x n of variables, ¯ A is a list A , A , . . . , A n of expressions, c is a constant, and M and N are expressions.(4) A primitive definition is of the form: ¯ x : ¯ A ⊲ c (¯ x ) := ‚ : N, where ¯ x , ¯ A , and c are described the same way as in (3), and N is an expression. The symbol ‚ denotesthe non-existing definiens. Primitive definitions are used for introducing axioms where no proof termsare needed.(5) A definition is a descriptive definition or a primitive definition.(6) A judgement is of the form: ∆; Γ ⊢ M : N, where M and N are expressions of the language, ∆ is an environment (a properly constructed sequenceof definitions) and Γ is a context (a properly constructed sequence of declarations). For brevity we often use implicit variables in definitions, that is we omit the previously declared variables ¯ x in c (¯ x ) in (3) and (4).The following informally explains the meaning of expressions.(1) If an expression M appears in a derived statement of the form M : ∗ , then M is interpreted as a type ,which represents a set or a proposition. Note : There is only one type ∗ in λD . But informally we often use ∗ p for propositions and ∗ s for setsto make proofs more readable.(2) If an expression M appears in a derived statement of the form M : N , where N is a type, then M isinterpreted as an object at the lowest level.When N is interpreted as a set, then M is regarded as an element of this set. ORMALIZING RELATIONS IN TYPE THEORY 3
When N is interpreted as a proposition, then M is regarded as a proof (or a proof term) of thisproposition.(3) The symbol (cid:3) represents the highest level.(4) Sort is ∗ or (cid:3) . Letters s, s , s , . . . are used as variables for sorts.(5) If an expression M appears in a statement of the form M : (cid:3) , then M is called a kind . λD containsthe derivation rule: ∅ ; ∅ ⊢ ∗ : (cid:3) , which is its (only) axiom because it has an empty environment and an empty context.Further details of the language and derivation rules of the theory λD can be found in [8]. Judgments areformally derived in λD using the derivation rules. The flag-style deduction was introduced by Ja´skowski [5] and Fitch [4]. A derivation in the flag format isa linear deduction. Each ”flag” (a rectangular box) contains a declaration that introduces a variable or anassumption; a collection of already introduced variables and assumptions makes the current context. The scopeof the variable or assumption is established by the ”flag pole”. In the scope we construct definitions and proofterms for proving statements/ theorems in λD . Each new flag extends the context and at the end of each flagpole the context is reduced by the corresponding declaration. For brevity we can combine several declarationsin one flag.More details on the flag-style deduction can be found in [9] and [8]. λD The rules of intuitionistic logic are derived in the theory λD as shown in [8]. We briefly describe it here byshowing the introduction and elimination rules for logical connectives and quantifiers. Implication.
The logical implication A ⇒ B is identified with the arrow type A → B . The rules forimplication follow from the following general rules for the arrow type (we write them in the flag format): var A : s | B : s A → B : s u : A → B | v : Auv : B var x : A. . .M : Bλx : A.M : A → B Here x is not a free variable in B .In λD arrows are right associative, that is A → B → C is a shorthand for A → ( B → C ). Falsity and Negation.
Falsity ⊥ is introduced in λD by: ⊥ := Π A : ∗ p .A : ∗ p . From this definition we get a rule for falsity:
F. KACHAPOVA var B : ∗ p . . .u : ⊥ u : Π A : ∗ p .AuB : B The rule states that falsity implies any proposition.As usual, negation is defined by: ¬ A := A → ⊥ .Other logical connectives and quantifiers are also defined using second order encoding. Here we only list theirderived rules and names of the corresponding terms, without details of their construction. The exact values ofthe terms can be found in [8].Some of our flag derivations contain the proof terms that will be re-used in other proofs; such proof termsare written in bold font, e.g. ∧ -in in the first derived rule for conjunction as follows. Conjunction.
These are derived rules for conjunction ∧ : var A, B : ∗ p u : A | v : B ∧ -in ( A, B, u, v ) : A ∧ Bw : A ∧ B ∧ -el ( A, B, w ) : A ∧ -el ( A, B, w ) : B Disjunction.
These are derived rules for disjunction ∨ : var A, B : ∗ p u : A ∨ -in ( A, B, u ) : A ∨ Bu : B ∨ -in ( A, B, u ) : A ∨ BC : ∗ p u : A ∨ B | v : A ⇒ C | w : B ⇒ C ∨ -el ( A, B, C, u, v, w ) : C Bi-implication.
Bi-implication ⇔ has the standard definition:( A ⇔ B ) := ( A ⇒ B ) ∧ ( B ⇒ A ) . Lemma 2.3.
We will often use this lemma to prove bi-implication A ⇔ B . var A, B : ∗ p u : A ⇒ B | v : B ⇒ A bi-impl ( A, B, u, v ) := ∧ -in ( A ⇒ B, B ⇒ A, u, v ) : A ⇔ B ORMALIZING RELATIONS IN TYPE THEORY 5
Universal Quantifier.
The universal quantifier ∀ is defined through the dependent product: var S : ∗ s | P : S → ∗ p Definition ∀ ( S, P ) := Π x : S.P x : ∗ p Notation : ( ∀ x : S . Px ) for ∀ ( S, P ) Existential Quantifier.
These are derived rules for the existential quantifier ∃ . var S : ∗ s | P : S → ∗ p var y : S | u : P y ∃ -in ( S, P, y, u ) : ( ∃ x : S.P x ) C : ∗ p u : ( ∃ x : S.P x ) | v : ( ∀ x : S. ( P x ⇒ C )) ∃ -el ( S, P, u, C, v ) : C Here x is not a free variable in C . Classical Logic.
We use mostly intuitionistic logic. But sometimes classical logic is needed; in these caseswe add the following
Axiom of Excluded Third : var A : ∗ p exc-thrd ( A ) := ‚ : A ∨ ¬ A This axiom implies the
Double Negation theorem: var A : ∗ p doub-neg ( A ) : ( ¬¬ A ⇒ A ) λD Here we briefly repeat some definitions from [8] relating to sets, in particular, subsets of type S . var S : ∗ s ps ( S ) := S → ∗ p Power set of Svar V : ps ( S )Notation: { x : S | xεV } for λx : S.V x var x : S element ( S, x, V ) :=
V x : ∗ p Notation: xε S V or xεV for element ( S, x, V )Thus, a subset V of S is regarded as a predicate on S and xεV means x satisfies the predicate V .
3. Intensional Equality in λD Here we introduce intensional equality for elements of any type; we will call it just equality. In the nextsection we will introduce extensional equality and the axiom of extensionality relating the two types of equality.
F. KACHAPOVA var S : ∗ var x, y : Seq ( S, x, y ) := Π P : S → ∗ p . ( P x ⇒ P y ) : ∗ p Notation : x = S y for eq ( S, x, y ) Intensional equality3.1. Properties of Equality3.1.1.
Reflexivity.
The following diagram proves the reflexivity property of equality in λD . var S : ∗ | x : S var P : S → ∗ p P x : ∗ p a := λu : P x.u : P x ⇒ P xeq - ref l ( S, x ) = λP : S → ∗ p .a : (Π P : S → ∗ p . ( P x ⇒ P x )) eq - ref l ( S, x ) : x = S x Proof terms are constructed similarly for the following properties of Substitutivity, Congruence, Symmetry,and Transitivity (see [8]).
Substitutivity.
Substitutivity means that equality is consistent with predicates of corresponding types. var S : ∗ var P : S → ∗ p var x, y : S | u : x = S y | v : P x eq - subs ( S, P, x, y, u, v ) :
P y
Congruence.
Congruence means that equality is consistent with functions of corresponding types. var
Q, S : ∗ var f : Q → S var x, y : Q | u : x = Q y eq - cong ( Q, S, f, x, y, u ) : f x = S f y Symmetry.
The following diagram expresses the symmetry property of equality in λD . var S : ∗ var x, y : S | u : x = S y eq - sym ( S, x, y, u ) : y = S x Transitivity.
The following diagram expresses the transitivity property of equality in λD . var S : ∗ var x, y, z : S | u : x = S y | v : y = S z eq - trans ( S, x, y, z, u, v ) : x = S z ORMALIZING RELATIONS IN TYPE THEORY 7
4. Relations in Type Theory4.1. Sets in λD Here we briefly repeat some definitions from [8] relating to sets, in particular, subsets of type S . var S : ∗ s ps ( S ) := S → ∗ p Power set of Svar V : ps ( S )Notation: { x : S | xεV } for λx : S.V x var x : S element ( S, x, V ) :=
V x : ∗ p Notation: xε S V or xεV for element ( S, x, V )Thus, a subset V of S is regarded as a predicate on S and xεV means x satisfies the predicate V . λD Binary relations are introduced in [8], together with the properties of reflexivity, symmetry, antisymmetry,and transitivity, and definitions of equivalence relation and partial order. We use them as a starting point forformalizing the theory of binary relations in λD .A relation on S is a binary predicate on S , which is regarded in λD as a composition of unary predicates.For brevity we introduce the type br ( S ) of all binary relations on S : var S : ∗ s Definition br ( S ) := S → S → ∗ p : (cid:3) In the rest of the article we call binary relations just relations. The equality of relations and operations onrelations are defined similarly to the set equality and set operations.Next we define the extensional equality of relations vs the intentional equality introduced in the previoussection. var S : ∗ s var R, Q : br ( S )Definition ⊆ ( S, R, Q ) := ( ∀ x, y : S. ( Rxy ⇒ Qxy )) : ∗ p Notation : R ⊆ Q for ⊆ ( S, R, Q )Definition Ex - eq ( S, R, Q ) := R ⊆ Q ∧ Q ⊆ R : ∗ p Notation : R = Q for Ex - eq ( S, R, Q ) Extensional equality
We add to the theory λD the following axiom of extensionality for relations. var S : ∗ s var R, Q : br ( S ) u : R = Q ext - axiom ( S, R, Q, u ) := ‚ : R = br ( S ) Q Extensionality Axiom
F. KACHAPOVA
The axiom is introduced in the last line by a primitive definition with the symbol ‚ replacing a non-existingproof term. The Extensionality Axiom states that the two types of equality are the same for binary relations.So we will use the symbol = for both and we will not elaborate on details of applying the axiom of extensionalitywhen converting one type of equality to the other. Using the flag format, we introduce the identity relation id S on type S and converse R − of a relation R . var S : ∗ s Definition id S := λx, y : S. ( x = S y ) : br ( S ) Identity relationvar R : br ( S )Definition conv ( S, R ) := λx, y : S. ( Ryx ) : br ( S )Notation : R − for conv ( S, R ) Converse relation
Next we introduce the operations of union ∪ , intersection ∩ , and composition ◦ of relations. var S : ∗ s var R, Q : br ( S )Definition ∪ ( S, R, Q ) := λx, y : S. ( Rxy ∨ Qxy ) : br ( S )Notation : R ∪ Q for ∪ ( S, R, Q ) Union
Definition ∩ ( S, R, Q ) := λx, y : S. ( Rxy ∧ Qxy ) : br ( S )Notation : R ∩ Q for ∩ ( S, R, Q ) Intersection
Definition ◦ ( S, R, Q ) := λx, y : S. ( ∃ z : S. ( Rxz ∧ Qzy )) : br ( S )Notation : R ◦ Q for ◦ ( S, R, Q ) Composition4.4. Properties of Operations
The following two technical lemmas will be used in some future proofs.
Lemma 4.1.
This lemma gives a shortcut for constructing an element of a composite relation. var S : ∗ s | R, Q : br ( S ) | x, y, z : Su : Rxy | v : Qyza := ∧ -in ( Rxy, Qyz, u, v ) :
Rxy ∧ Qyz prod-term ( S, R, Q, x, y, z, u, v ) := ∃ -in ( S, λt.Rxt ∧ Qtz, y, a ) : ( R ◦ Q ) xz Lemma 4.2.
This lemma gives a shortcut for proving equality of two relations. var S : ∗ s | R, Q : br ( S ) u : R ⊆ Q | v : Q ⊆ R rel - equal ( S, R, Q, u, v ) := ∧ -in ( R ⊆ Q, Q ⊆ R, u, v ) : R = Q Theorem 4.3.
For relations
R, P and Q on S the following hold.1) ( R − ) − = R. ORMALIZING RELATIONS IN TYPE THEORY 9 ( R ◦ Q ) − = Q − ◦ R − . ( R ∩ Q ) − = R − ∩ Q − . ( R ∪ Q ) − = R − ∪ Q − . R ◦ ( P ∪ Q ) = R ◦ P ∪ R ◦ Q. ( P ∪ Q ) ◦ R = P ◦ R ∪ Q ◦ R. R ◦ ( P ∩ Q ) ⊆ R ◦ P ∩ R ◦ Q. ( P ∩ Q ) ◦ R ⊆ P ◦ R ∩ Q ◦ R. ( R ◦ P ) ◦ Q = R ◦ ( P ◦ Q ) . The formal proof is in part A of Appendix. The proof of part 2) has the form: var S : ∗ s | R, Q : br ( S ) . . . conv - prod ( S, R, Q ) := . . . : ( R ◦ Q ) − = Q − ◦ R − Its proof term conv - prod ( S, R, Q ) will be re-used later in the paper.
5. Properties of Binary Relations
The properties of reflexivity, symmetry, antisymmetry, transitivity, and the relations of equivalence and partialorder are defined in [8] as follows. var S : ∗ s | R : br ( S )Definition ref l ( S, R ) := ∀ x : S. ( Rxx ) : ∗ p Definition sym ( S, R ) := ∀ x, y : S. ( Rxy ⇒ Ryx ) : ∗ p Definition antisym ( S, R ) := ∀ x, y : S. ( Rxy ⇒ Ryx ⇒ x = S y ) : ∗ p Definition trans ( S, R ) := ∀ x, y, z : S. ( Rxy ⇒ Ryz ⇒ Rxz ) : ∗ p Definition equiv - relation ( S, R ) := ref l ( S, R ) ∧ sym ( S, R ) ∧ trans ( S, R ) : ∗ p Definition part - ord ( S, R ) := ref l ( S, R ) ∧ antisym ( S, R ) ∧ trans ( S, R ) : ∗ p Theorem 5.1.
Suppose R is a relation on type S . Then the following hold.1) Criterion of reflexivity. R is reflexive ⇔ id S ⊆ R .2) First criterion of symmetry. R is symmetric ⇔ R − ⊆ R .3) Second criterion of symmetry. R is symmetric ⇔ R − = R .4) Criterion of antisymmetry. R is antisymmetric ⇔ R − ∩ R ⊆ id S .5) Criterion of transitivity. R is transitive ⇔ R ◦ R ⊆ R . The formal proof is in part B of Appendix. The proof of part 3) has the form: var S : ∗ s | R : br ( S ) . . . sym - criterion ( S, R ) := . . . : sym ( S, R ) ⇔ R − = R Its proof term sym - criterion ( S, R ) will be re-used later in the paper.
Theorem 5.2.
Relation R on S is reflexive, symmetric and antisymmetric ⇒ R = id S . Proof.
The formal proof is in the following flag diagram. var S : ∗ s | R : br ( S ) u : ref l ( S, R ) | u : sym ( S, R ) | u : antisym ( S, R ) var x, y : S | v : Rxya = u xyv : Ryxa = u xyva : x = S ya := λx, y : S.λv : Rxy.a : ( R ⊆ id S ) var x, y : S | v : ( id S ) xyv : x = S y Notation P := λz : S.Rxz : S → ∗ p a = u x : Rxxa : P xa := eq - subs ( S, P, x, y, v, a ) : P ya : Rxya := λx, y : S.λv : ( id S ) xy.a : ( id S ⊆ R ) a := rel - equal ( S, R, id S , a , a ) : R = id S (cid:3) Theorem 5.3.
Invariance under converse operation.
Suppose R is a relation on type S . Then thefollowing hold.1) R is reflexive ⇒ R − is reflexive.2) R is symmetric ⇒ R − is symmetric.3) R is antisymmetric ⇒ R − is antisymmetric.4) R is transitive ⇒ R − is transitive.Proof. var S : ∗ s | R : br ( S ) u : ref l ( S, R ) var x : Sux : Rxxux : R − xxa := λx : S.ux : ref l ( S, R − ) ORMALIZING RELATIONS IN TYPE THEORY 11 var S : ∗ s | R : br ( S ) u : sym ( S, R ) var x, y : S | v : R − xyv : Ryxuyx : (
Ryx ⇒ Rxy ) a := uyxv : Rxya : R − yxa := λx, y : S.λv : R − xy.a : sym ( S, R − )3) var S : ∗ s | R : br ( S ) u : antisym ( S, R ) var x, y : S | v : R − xy | w : R − yxv : Ryxw : Rxyuxy : (
Rxy ⇒ Ryx ⇒ x = y ) a := uxywv : x = ya := λx, y : S.λv : R − xy.λw : R − yx.a : antisym ( S, R − )4) var S : ∗ s | R : br ( S ) u : trans ( S, R ) var x, y, z : S | v : R − xy | w : R − yzw : Rzyv : Ryxuzyx : (
Rzy ⇒ Ryx ⇒ Rzx ) a := uzyxwv : Rzxa : R − xza := λx, y, z : S.λv : R − xy.λw : R − yz.a : trans ( S, R − ) (cid:3) Theorem 5.4.
Invariance under intersection.
Suppose R and Q are relations on type S . Then the followinghold.1) R and Q are reflexive ⇒ R ∩ Q is reflexive.2) R and Q are symmetric ⇒ R ∩ Q is symmetric.3) R or Q is antisymmetric ⇒ R ∩ Q is antisymmetric.4) R and Q are transitive ⇒ R ∩ Q is transitive. Proof. var S : ∗ s | R, Q : br ( S ) u : ref l ( S, R ) | v : ref l ( S, Q ) var x : Sa := ux : Rxxa := vx : Qxxa := ∧ -in ( Rxx, Qxx, a , a ) : ( R ∩ Q ) xxa := λx : S.a : ref l ( S, R ∩ Q )2) var S : ∗ s | R, Q : br ( S ) u : sym ( S, R ) | v : sym ( S, Q ) var x, y : S | w : ( R ∩ Q ) xyw : Rxy ∧ Qxya := ∧ -el ( Rxy, Qxy, w ) :
Rxya := ∧ -el ( Rxy, Qxy, w ) :
Qxya := uxya : Ryxa := vxya : Qyxa := ∧ -in ( Ryx, Qyx, a , a ) : ( R ∩ Q ) yxa := λx, y : S.λw : ( R ∩ Q ) xy.a : sym ( S, R ∩ Q )3) var S : ∗ s | R, Q : br ( S )Notation A := antisym ( S, R ) : ∗ p Notation B := antisym ( S, Q ) : ∗ p Notation C := antisym ( S, R ∩ Q ) : ∗ p u : A ∨ Bv : A var x, y : S | w : ( R ∩ Q ) xy | w : ( R ∩ Q ) yxw : Rxy ∧ Qxya := ∧ -el ( Rxy, Qxy, w ) : Rxyw : Ryx ∧ Qyxa := ∧ -el ( Ryx, Qyx, w ) : Ryxvxy : (
Rxy ⇒ Ryx ⇒ x = y ) a := vxya a : x = ya := λv : A.λx, y : S.λw : ( R ∩ Q ) xy.λw : ( R ∩ Q ) yx.a : ( A ⇒ C ) ORMALIZING RELATIONS IN TYPE THEORY 13 v : B var x, y : S | w : ( R ∩ Q ) xy | w : ( R ∩ Q ) yxw : Rxy ∧ Qxya := ∧ -el ( Rxy, Qxy, w ) : Qxyw : Ryx ∧ Qyxa := ∧ -el ( Ryx, Qyx, w ) : Qyxvxy : (
Qxy ⇒ Qyx ⇒ x = y ) a := vxya a : x = ya := λv : B.λx, y : S.λw : ( R ∩ Q ) xy.λw : ( R ∩ Q ) yx.a : ( B ⇒ C ) a := ∨ - el ( A, B, C, u, a , a ) : Ca : antisym ( S, R ∩ Q )4) var S : ∗ s | R, Q : br ( S ) u : trans ( S, R ) | u : trans ( S, Q ) var x, y, z : S | v : ( R ∩ Q ) xy | w : ( R ∩ Q ) yzv : Rxy ∧ Qxya := ∧ -el ( Rxy, Qxy, v ) :
Rxya := ∧ -el ( Rxy, Qxy, v ) :
Qxyw : Ryz ∧ Qyza := ∧ -el ( Ryz, Qyz, w ) :
Ryza := ∧ -el ( Ryz, Qyz, w ) :
Qyza := u xyza a : Rxza := u xyza a : Qxza := ∧ -in ( Rxz, Qxz, a , a ) : ( R ∩ Q ) xza := λx, y, z : S.λv : ( R ∩ Q ) xy.λw : ( R ∩ Q ) yz.a : trans ( S, R ∩ Q ) (cid:3) Theorem 5.5.
Invariance under union.
Suppose R and Q are relations on type S . Then the following hold.1) R or Q is reflexive ⇒ R ∪ Q is reflexive.2) R and Q are symmetric ⇒ R ∪ Q is symmetric.Proof. var S : ∗ s | R, Q : br ( S ) u : ref l ( S, R ) | x : Sux : Rxxa := ∨ -in ( Rxx, Qxx, ux ) : ( R ∪ Q ) xx a := ∨ -in ( Rxx, Qxx, ux ) : ( Q ∪ R ) xxa := λu : ref l ( S, R ) .λx : S.a : ( ref l ( S, R ) ⇒ ref l ( S, R ∪ Q )) a ( R, Q ) := λu : ref l ( S, R ) .λx : S.a : ( ref l ( S, R ) ⇒ ref l ( S, Q ∪ R )) a := a ( Q, R ) : ( ref l ( S, Q ) ⇒ ref l ( S, R ∪ Q )) u : ref l ( S, R ) ∨ ref l ( S, Q ) a := ∨ - el ( ref l ( S, R ) , ref l ( S, Q ) , ref l ( S, R ∪ Q ) , u, a , a ) : ref l ( S, R ∪ Q )2) var S : ∗ s | R, Q : br ( S ) u : sym ( S, R ) | u : sym ( S, Q ) var x, y : S | v : ( R ∪ Q ) xyv : Rxy ∨ Qxyw : Rxya := u xyw : Ryxa := ∨ -in ( Ryx, Qyx, a ) : ( R ∪ Q ) yxa := λw : Rxy.a : ( Rxy ⇒ ( R ∪ Q ) yx ) w : Qxya := u xyw : Qyxa := ∨ -in ( Ryx, Qyx, a ) : ( R ∪ Q ) yxa := λw : Qxy.a : ( Qxy ⇒ ( R ∪ Q ) yx ) a := ∨ -el( Rxy, Qxy, ( R ∪ Q ) yx, v, a , a ) : ( R ∪ Q ) yxa := λx, y : S.λv : ( R ∪ Q ) xy.a : sym ( S, R ∪ Q ) (cid:3) Theorem 5.6.
Invariance under composition.
Suppose R and Q are relations on type S . Then the followinghold.1) R ◦ R − is always symmetric.2) R and Q are reflexive ⇒ R ◦ Q is reflexive.3) Suppose R and Q are symmetric. Then R ◦ Q is symmetric ⇔ R ◦ Q = Q ◦ R. Proof. var S : ∗ s | R : br ( S ) var x, y : S | u : ( R ◦ R − ) xy Notation P := λz : S.Rxz ∧ R − zy : S → ∗ p u : ( ∃ z : S.P z ) var z : S | v : P z
ORMALIZING RELATIONS IN TYPE THEORY 15 v : Rxz ∧ R − zya := ∧ -el ( Rxz, R − zy, v ) : Rxza := ∧ -el ( Rxz, R − zy, v ) : R − zya : Ryza : R − zxa := prod-term ( S, R, R − , y, z, x, a , a ) : ( R ◦ R − ) yxa := λz : S.λv : P z.a : ( ∀ z : S. ( P z ⇒ ( R ◦ R − ) yx )) a := ∃ -el ( S, P, u, ( R ◦ R − ) yx, a ) : ( R ◦ R − ) yxa := λx, y : S.λu : ( R ◦ R − ) xy.a : sym ( S, R ◦ R − )2) var S : ∗ s | R, Q : br ( S ) u : ref l ( S, R ) | v : ref l ( S, Q ) var x : Sux : Rxxvx : Qxxa := prod-term ( S, R, Q, x, x, x, ux, vx ) : ( R ◦ Q ) xxa := λx : S.a : ref l ( S, R ◦ Q )3) Here we use the proof term sym - criterion ( S, R ) from Theorem 5.1.3) for the second criterion of symmetryand the proof term conv - prod from Theorem 4.3.2). var S : ∗ s var R : br ( S ) a := sym - criterion ( S, R ) : sym ( S, R ) ⇔ ( R − = R ) a ( R ) := ∧ -el ( sym ( S, R ) ⇒ ( R − = R ) , ( R − = R ) ⇒ sym ( S, R ) , a ) : sym ( S, R ) ⇒ ( R − = R ) a ( R ) := ∧ -el ( sym ( S, R ) ⇒ ( R − = R ) , ( R − = R ) ⇒ sym ( S, R ) , a ) : ( R − = R ) ⇒ sym ( S, R ) var R, Q : br ( S ) | u : sym ( S, R ) | v : sym ( S, Q ) a := a ( R ) u : ( R − = R ) a := a ( Q ) v : ( Q − = Q ) a := conv - prod ( S, R, Q ) : ( R ◦ Q ) − = Q − ◦ R − Notation P := λK : br ( S ) . (( R ◦ Q ) − = K ◦ R − ) : br ( S ) → ∗ p Notation P := λK : br ( S ) . (( R ◦ Q ) − = Q ◦ K ) : br ( S ) → ∗ p a : P ( Q − ) a := eq - subs ( br ( S ) , P , Q − , Q, a , a ) : ( R ◦ Q ) − = Q ◦ R − a : P ( R − ) a := eq - subs ( br ( S ) , P , R − , R, a , a ) : ( R ◦ Q ) − = Q ◦ R Notation A := sym ( S, R ◦ Q ) : ∗ p Notation B := ( R ◦ Q = Q ◦ R ) : ∗ p w : Aa := a ( R ◦ Q ) w : ( R ◦ Q ) − = R ◦ Qa := eq - sym ( br ( S ) , ( R ◦ Q ) − , R ◦ Q, a ) : R ◦ Q = ( R ◦ Q ) − a := eq - trans ( br ( S ) , R ◦ Q, ( R ◦ Q ) − , Q ◦ R, a , a ) : R ◦ Q = Q ◦ Ra := λw : A.a : A ⇒ Bw : Bw : ( R ◦ Q = Q ◦ R ) a := eq - sym ( br ( S ) , R ◦ Q, Q ◦ R, w ) : Q ◦ R = R ◦ Qa := eq - trans ( br ( S ) , ( R ◦ Q ) − , Q ◦ R, R ◦ Q, a , a ) : ( R ◦ Q ) − = R ◦ Qa := a ( R ◦ Q ) a : sym ( S, R ◦ Q ) a := λw : B.a : B ⇒ Aa := bi - impl ( A, B, a , a ) : ( sym ( S, R ◦ Q ) ⇔ R ◦ Q = Q ◦ R ) (cid:3)
6. Special Binary Relations6.1. Equivalence Relation and PartitionTheorem 6.1.
Invariance of equivalence relation under converse operation and intersection.
Sup-pose R and Q are equivalence relations on type S . Then the following hold.1) R − is an equivalence relation on S .2) R ∩ Q is an equivalence relation on S .Proof.
1) can easily be derived from Theorem 5.3.1), 2), 4) using intuitionistic logic.2) can easily be derived from Theorem 5.4.1), 2), 4) using intuitionistic logic.We skip the formal proofs. (cid:3)
Next we formalize the fact that there is a correspondence between equivalence relations on S and partitionsof S . Equivalence classes are introduced in [8] as follows. var S : ∗ s | R : br ( S ) | u : equiv - rel ( S, R ) var x : S class ( S, R, u, x ) := { y : S | Rxy } : ps ( S )Notation [ x ] R for class ( S, R, u, x )Next we define a partition of type S : var S : ∗ s | R : S → ps ( S ) partition ( S, R ) := ( ∀ x : S.xεRx ) ∧ ∀ x, y, z : S. ( zεRx ⇒ zεRy ⇒ Rx = Ry ))As usual, we can regard a partition R as a collection Rx ( x ∈ S ) of subsets of S . From this point of view, theabove diagram expresses the standard two facts for a partition: ORMALIZING RELATIONS IN TYPE THEORY 17 (1) any element of S belongs to one of subsets from the collection (namely Rx );(2) if the intersection of two subsets Rx and Ry is non-empty, then they coincide.(1) implies that each subset from the collection is non-empty and that the union of all subsets from thecollection is S . Theorem 6.2.
Any equivalence relation R on type S is a partition of S and vice versa.Proof. The type of partitions of S is S → ps ( S ), which is S → S → ∗ p , and it is the same as the type br ( S ) ofrelations on S . The proof consists of two steps. Step 1. Any equivalence relation is a partition. var S : ∗ s | R : S → S → ∗ p u : equiv - rel ( S, R ) a := ∧ - el ( ref l ( S, R ) , sym ( S, R ) , ∧ - el ( ref l ( S, R ) ∧ sym ( S, R ) , trans ( S, R ) , u )) : ref l ( S, R ) var x : Sa := a x : Rxxa : ( xεRx ) a := λx : S.a : ( ∀ x : S.xεX )This proves the first part of the definition of partition ( S, R ) and the second part was proven in [8], pg. 291.
Step 2. Any partition is an equivalence relation. var S : ∗ s | R : S → S → ∗ p u : partition ( S, R )Notation A := ∀ x : S. ( xεRx )Notation B := ∀ x, y, z : S. ( zεRx ⇒ zεRy ⇒ Rx = Ry ) u : A ∧ Ba := ∧ - el ( A, B, u ) : Aa := ∧ - el ( A, B, u ) : B var x : Sa := a x : xεRxa : Rxxa := λx : S.a : ref l ( S, R ) var x, y : S | v : Rxya := a y : ( yεRy ) v : ( yεRx ) a := a xyyva : Rx = Rya := a x : ( xεRx ) a := eq - subs ( ps ( S ) , λZ : ps ( S ) .xεZ, Rx, Ry, a , a ) : ( xεRy ) a : Ryx a := λx, y : S.λv : Rxy.a : sym ( S, R ) var x, y, z : S | v : Rxy | w : Ryzv : yεRxa := a yzw : Rzya : ( yεRz ) a := a zxya v : Rz = Rxa := a z : ( zεRz ) a := eq - subs ( ps ( S ) , λZ : ps ( S ) .zεZ, Rz, Rx, a , a ) : zεRxa : Rxza := λx, y, z : S.λv : Rxy.λw : Ryz.a : trans ( S, R ) a := ∧ - in ( ref l ( S, R ) ∧ sym ( S, R ) , trans ( S, R ) , ∧ - in ( ref l ( S, R ) , sym ( S, R ) , a , a ) , a ) : equiv - rel ( S, R ) (cid:3) Invariance of partial order under converse operation and intersection.
Suppose R and Q are partial orders on type S . Then the following hold.1) R − is a partial order on S .2) R ∩ Q is a partial order on S .Proof.
1) can easily be derived from Theorem 5.3.1), 3), 4) using intuitionistic logic.2) can easily be derived from Theorem 5.4.1), 3), 4) using intuitionistic logic. We skip the formal proofs. (cid:3)
Example 6.4. ⊆ is a partial order on the power set ps ( S ) of type S .Proof. This is the formal proof. var S : ∗ s Notation R := λX, Y : ps ( S ) .X ⊆ Y : br ( ps ( S ))Notation A := ref l ( ps ( S ) , R )Notation B := antisym ( ps ( S ) , R )Notation C := trans ( ps ( S ) , R ) var X : ps ( S ) a := λx : S.λu : ( xεX ) .u : X ⊆ Xa := λX : ps ( S ) .a : A var X, Y : ps ( S ) | u : X ⊆ Y | v : Y ⊆ Xa := ∧ - in ( X ⊆ Y, Y ⊆ X, u, v ) : X = Ya := λX, Y : ps ( S ) .λu : X ⊆ Y.λv : Y ⊆ X.a : B var X, Y, Z : ps ( S ) | u : X ⊆ Y | v : Y ⊆ Z var x : S | w : xεXa := uxw : ( xεY ) ORMALIZING RELATIONS IN TYPE THEORY 19 a := vxa : ( xεZ ) a := λx : S.λw : ( xεX ) .a : X ⊆ Za := λX, Y, Z : ps ( S ) .λu : X ⊆ Y.λv : Y ⊆ Z.a : Ca := ∧ - in ( A ∧ B, C, ∧ - in ( A, B, a , a ) , a ) : A ∧ B ∧ Ca : part - ord ( ps ( S ) , R ) (cid:3) We will use the notation for partial order. In the following diagram we define the strict order < , the leastelement of a partially ordered set, and well-ordering of type S . var S : ∗ s | : br ( S ) | u : part - ord ( S, )Definition < := λx, y : S. ( x y ∧ ¬ ( x = y )) var X : ps ( S ) | x : S Definition least ( S, , X, x ) := xεX ∧ ∀ y : S. ( yεX ⇒ x y )Definition well - ord ( S, ) := part - ord ( S, ) ∧ ∀ X : ps ( S ) . [ ∃ x : S.xεX ⇒ ∃ x : S.least ( S, , X, x )] Theorem 6.5.
Transfinite Induction.
Suppose is a well-ordering of type S . Then for any predicate P on S : ∀ x : S. [( ∀ y : S. ( y < x ⇒ P y ) ⇒ P x ] ⇒ ∀ x : S.P x.
Proof.
Here is the formal proof. var S : ∗ s | : br ( S ) | u : well - ord ( S, ) | P : S → ∗ p u : ∀ x : S. [ ∀ y : S. ( y < x ⇒ P y ) ⇒ P x ]Notation A := part - ord ( S, )Notation B := [ ∀ X : ps ( S ) . ( ∃ x : S.xεX ⇒ ∃ x : S.least ( S, , X, x ))] u : A ∧ Ba := ∧ - el ( A, B, u ) : Aa := ∧ - el ( A, B, u ) : Ba := ∧ - el ( ref l ( S, ) ∧ antisym ( S, ) , trans ( S, ) , a ) : ref l ( S, ) ∧ antisym ( S, ) a := ∧ - el ( ref l ( S, ) , antisym ( S, ) , a ) : antisym ( S, )Notation X := λx : S. ¬ P x : ps ( S ) v : ( ∃ x : S.xεX ) a := a Xv : [ ∃ x : S.least ( S, , X, x )] var x : S | v : least ( S, , X, x ) a := ∧ - el ( xεX, ∀ y : S. ( yεX ⇒ x y ) , v ) : xεXa : ¬ P xa := ∧ - el ( xεX, ∀ y : S. ( yεX ⇒ x y ) , v ) : [ ∀ y : S. ( yεX ⇒ x y )] var y : S | w : y < xa := ∧ - el ( y x, ¬ ( x = y ) , w ) : y xa := ∧ - el ( y x, ¬ ( x = y ) , w ) : ¬ ( x = y ) w : ¬ P yw : yεXa := a yw : x ya := a xya a : x = ya := a a : ⊥ a := λw : ¬ P y.a : ¬¬ P ya := doub - neg ( P y ) a : P ya := λy : S.λw : y < x.a : [ ∀ y : S. ( y < x ⇒ P y )] a := u xa : P xa := a a : ⊥ a := λx : S.λv : least ( S, , X, x ) .a : [ ∀ x : S. ( least ( S, , X, x ) ⇒ ⊥ )] a := ∃ - el ( S, λx : S.least ( S, , X, x ) , a , ⊥ , a ) : ⊥ a := λv : ( ∃ x : S.xεX ) .a : ¬ ( ∃ x : S.xεX ) var x : Sw : ¬ P xw : xεXa := ∃ - in ( S, λz : S.zεX, x, w ) : ( ∃ z : S.zεX ) a := a a : ⊥ a := λw : ¬ P x.a : ¬¬ P xa := doub - neg ( P x ) a : P xa := λx : S.a : ( ∀ x : S.P x )Here we used (twice) the Double Negation theorem with the proof term doub - neg . This is the only place inthis paper where we use the classical (not intuitionistic) logic. (cid:3)
7. Conclusion
Starting with the definitions from [8] of binary relations and properties of reflexivity, symmetry, antisymmetry,and transitivity, we formalize in the theory λD (the Calculus of Constructions with Definitions) criteria for theseproperties and prove their invariance under operations of union, intersection, composition, and taking converse.We provide a formal definition of partition and formally prove correspondence between equivalence relationsand partitions. We derive a formal proof that ⊆ is a partial order on power set. Finally we formally prove theprinciple of transfinite inductions for a type with well-ordering.The results can be transferred to the proof assistants that are based on the Calculus of Constructions. Sincebinary relations are the abstract concepts used in many areas of mathematics, the results can be useful for furtherformalizations of mathematics in λD . Our next direction of research is formalization of parts of probability theoryin λD that we outlined in [6]. ORMALIZING RELATIONS IN TYPE THEORY 21
APPENDIXAppendix A. Proof of Theorem 4.3
Proof. var S : ∗ s | R : br ( S ) var x, y : Su : ( R − ) − xyu : R − yxu : Rxya := λu : ( R − ) − xy.u : ( R − ) − xy ⇒ Rxyu : Rxyu : R − yxu : ( R − ) − xya := λu : Rxy.u : Rxy ⇒ ( R − ) − xya := λx, y : S.a : ( R − ) − ⊆ Ra := λx, y : S.a : R ⊆ ( R − ) − a := rel - equal (cid:0) R − ) − , R, a , a (cid:1) : ( R − ) − = R var S : ∗ s | R, Q : br ( S )Notation A := ( R ◦ Q ) − : br ( S )Notation B := Q − ◦ R − : br ( S ) var x, y : S Notation P := λz : S.Ryz ∧ Qzx : S → ∗ p Notation P := λz : S.Q − xz ∧ R − zy : S → ∗ p u : Axyu : ( R ◦ Q ) yxu : ( ∃ z : S.P z ) z : S | v : P zv : Ryz ∧ Qzxa := ∧ -el ( Ryz, Qzx, v ) :
Ryza := ∧ -el ( Ryz, Qzx, v ) :
Qzxa : R − zya : Q − xza := prod-term ( S, Q − , R − , x, z, y, a , a ) : ( Q − ◦ R − ) xya : Bxy a := λz : S.λv : P z.a : ( ∀ z : S. ( P z ⇒ Bxy )) a := ∃ -el ( S, P , u, Bxy, a ) : Bxya := λx, y : S.λu : Axy.a : A ⊆ B var x, y : S | u : Bxyu : ( ∃ z : S.P z ) z : S | v : P zv : Q − xz ∧ R − zya := ∧ -el ( Q − xz, R − zy, v ) : Q − xza := ∧ -el ( Q − xz, R − zy, v ) : R − zya : Qzxa : Ryza := prod-term ( S, R, Q, y, z, x, a , a ) : ( R ◦ Q ) yxa : ( R ◦ Q ) − xya : Axya := λz : S.λv : P z.a : ( ∀ z : S. ( P z ⇒ Axy )) a := ∃ -el ( S, P , u, Axy, a ) : Axya := λx, y : S.λu : Bxy.a : B ⊆ A conv - prod ( S, R, Q ) := rel - equal ( A, B, a , a ) : ( R ◦ Q ) − = Q − ◦ R − var S : ∗ s | R, Q : br ( S )Notation A := ( R ∩ Q ) − : br ( S )Notation B := R − ∩ Q − : br ( S ) var x, y : S | u : Axyu : ( R ∩ Q ) − xyu : ( R ∩ Q ) yxu : Ryx ∧ Qyxa := ∧ -el ( Ryx, Qyx, v ) :
Ryxa := ∧ -el ( Ryx, Qyx, v ) :
Qyxa : R − xya : Q − xya := ∧ -in( R − xy, Q − xy, a , a ) : Bxya := λx, y : S.λu : Axy.a : A ⊆ B var x, y : S | u : Bxyu : R − xy ∧ Q − xya := ∧ -el ( R − xy, Q − xy, v ) : R − xy ORMALIZING RELATIONS IN TYPE THEORY 23 a := ∧ -el ( R − xy, Q − xy, v ) : Q − xya : Ryxa : Qyxa := ∧ -in( Ryx, Qyx, a , a ) : ( R ∩ Q ) yxa : ( R ∩ Q ) − xya : Axya := λx, y : S.λu : Bxy.a : B ⊆ Aa := rel - equal ( A, B, a , a ) : ( R ∩ Q ) − = R − ∩ Q − var S : ∗ s | R, Q : br ( S )Notation A := ( R ∪ Q ) − : br ( S )Notation B := R − ∪ Q − : br ( S ) var x, y : S | u : Axyu : ( R ∪ Q ) yxu : Ryx ∨ Qyxv : Ryxv : R − xya := ∨ -in ( R − xy, Q − xy, v ) : Bxya := λv : Ryx.a : Ryx ⇒ Bxyv : Qyxv : Q − xya := ∨ -in ( R − xy, Q − xy, v ) : Bxya := λv : Qyx.a : Qyx ⇒ Bxya := ∨ -el ( Ryx, Qyx, Bxy, u, a , a ) : Bxya := λx, y : S.λu : Axy.a : A ⊆ B var x, y : S | u : Bxyu : R − xy ∨ Q − xyv : R − xyv : Ryxa := ∨ -in ( Ryx, Qyx, v ) :
Ryx ∨ Qyxa : ( R ∪ Q ) − xya : Axya := λv : R − xy.a : R − xy ⇒ Axyv : Q − xyv : Qyx a := ∨ -in ( Ryx, Qyx, v ) :
Ryx ∨ Qyxa : ( R ∪ Q ) − xya : Axya := λv : Q − xy.a : Q − xy ⇒ Axya := ∨ -el ( R − xy, Q − xy, Axy, u, a , a ) : Axya := λx, y : S.λu : Bxy.a : B ⊆ Aa := rel - equal ( A, B, a , a ) : ( R ∪ Q ) − = R − ∪ Q − var S : ∗ s | R, P, Q : br ( S )Notation A := R ◦ ( P ∪ Q ) : br ( S )Notation B := R ◦ P ∪ R ◦ Q : br ( S ) var x, y : S Notation P := λz : S.Rxz ∧ ( P ∪ Q ) zy : S → ∗ p u : Axyu : ( ∃ z : S.P z ) z : S | v : P zv : Rxz ∧ ( P ∪ Q ) zya := ∧ - el ( Rxz, ( P ∪ Q ) zy, v ) : Rxza := ∧ - el ( Rxz, ( P ∪ Q ) zy, v ) : ( P ∪ Q ) zya : P zy ∨ Qzyw : P zya := prod-term ( S, R, P, x, z, y, a , w ) : ( R ◦ P ) xya := ∨ - in (( R ◦ P ) xy, ( R ◦ Q ) xy, a ) : Bxya := λw : P zy.a : P zy ⇒ Bxyw : Qzya := prod-term ( S, R, Q, x, z, y, a , w ) : ( R ◦ Q ) xya := ∨ -in (( R ◦ P ) xy, ( R ◦ Q ) xy, a ) : Bxya := λw : Qzy.a : Qzy ⇒ Bxya := ∨ -el ( P zy, Qzy, Bxy, a , a , a ) : Bxya := λz : S.λv : P z.a : ( ∀ z : S. ( P z ⇒ Bxy )) a := ∃ -el ( S, P , u, Bxy, a ) : Bxya := λx, y : S.λu : Axy.a : A ⊆ B var x, y : S Notation P := λz : S.Rxz ∧ P zy : S → ∗ p Notation P := λz : S.Rxz ∧ Qzy : S → ∗ p ORMALIZING RELATIONS IN TYPE THEORY 25 u : Bxyu : ( R ◦ P ) xy ∨ ( R ◦ Q ) xyv : ( R ◦ P ) xyv : ( ∃ z : S.P z ) z : S | w : P zw : Rxz ∧ P zya := ∧ -el ( Rxz, P zy, w ) :
Rxza := ∧ -el ( Rxz, P zy, w ) :
P zya := ∨ - in ( P zy, Qzy, a ) : ( P ∪ Q ) zya := prod-term ( S, R, ( P ∪ Q ) , x, z, y, a , a ) : Axya := λz : S.λw : P z.a : ( ∀ z : S. ( P z ⇒ Axy )) a := ∃ -el ( S, P , v, Axy, a ) : Axya := λv : ( R ◦ P ) xy.a : (( R ◦ P ) xy ⇒ Axy ) v : ( R ◦ Q ) xyv : ( ∃ z : S.P z ) z : S | w : P za := ∧ -el ( Rxz, Qzy, w ) :
Rxza := ∧ -el ( Rxz, Qzy, w ) :
Qzya := ∨ - in ( P zy, Qzy, a ) : ( P ∪ Q ) zya := prod-term ( S, R, ( P ∪ Q ) , x, z, y, a , a ) : Axya := λz : S.λw : P z.a : ( ∀ z : S. ( P z ⇒ Axy )) a := ∃ -el ( S, P , v, Axy, a ) : Axya := λv : ( R ◦ Q ) xy.a : (( R ◦ Q ) xy ⇒ Axy ) a := ∨ -el(( R ◦ P ) xy, ( R ◦ Q ) xy, Axy, u, a , a ) : Axya := λx, y : S.λu : Bxy.a : B ⊆ Aa := rel - equal ( A, B, a , a ) : R ◦ ( P ∪ Q ) = R ◦ P ∪ R ◦ Q
6) is proven similarly to 5). var S : ∗ s | R, P, Q : br ( S )Notation A := R ◦ ( P ∩ Q ) : br ( S )Notation B := R ◦ P ∩ R ◦ Q : br ( S ) var x, y : S Notation P := λz : S.Rxz ∧ ( P ∩ Q ) zy : ∗ p u : Axyu : ( ∃ z : S.P z ) var z : S | v : P zv : Rxz ∧ ( P ∩ Q ) zya := ∧ -el ( Rxz, ( P ∩ Q ) zy, v ) : Rxza := ∧ -el ( Rxz, ( P ∩ Q ) zy, v ) : ( P ∩ Q ) zya : P zy ∧ Qzya := ∧ -el ( P zy, Qzy, a ) : P zya := ∧ -el ( P zy, Qzy, a ) : Qzya := prod-term ( S, R, P, x, z, y, a , a ) : ( R ◦ P ) xya := prod-term ( S, R, Q, x, z, y, a , a ) : ( R ◦ Q ) xya := ∧ -in (( R ◦ P ) xy, ( R ◦ Q ) xy, a , a ) : Bxya := λz : S.λv : P z.a : ( ∀ z : S. ( P z ⇒ Bxy )) a := ∃ -el ( S, P, u, Bxy, a ) : Bxya := λx, y : S.λu : Axy.a : R ◦ ( P ∩ Q ) ⊆ R ◦ P ∩ R ◦ Q
8) is proven similarly to 7).9) var S : ∗ s | R, P, Q : br ( S )Notation A := ( R ◦ P ) ◦ Q : br ( S )Notation B := R ◦ ( P ◦ Q ) : br ( S ) var x, y : S Notation P ( x, y ) := λz : S. ( R ◦ P ) xz ∧ Qzy : S → ∗ p Notation P ( x, y ) := λz : S.Rxz ∧ ( P ◦ Q ) zy : S → ∗ p Notation P ( x, y ) := λz : S.Rxz ∧ P zy : S → ∗ p Notation P ( x, y ) := λz : S.P xz ∧ Qzy : S → ∗ p var x, y : S | u : Axyu : ( ∃ z : S.P ( x, y ) z ) var z : S | v : P ( x, y ) za := ∧ -el (( R ◦ P ) xz, Qzy, v ) : ( R ◦ P ) xz ORMALIZING RELATIONS IN TYPE THEORY 27 a := ∧ -el (( R ◦ P ) xz, Qzy, v ) : Qzya : ( ∃ z : S.P ( x, z ) z ) var z : S | w : P ( x, z ) z w : Rxz ∧ P z za := ∧ -el ( Rxz , P z z, w ) : Rxz a := ∧ -el ( Rxz , P z z, w ) : P z za := prod-term ( S, P, Q, z , z, y, a , a ) : ( P ◦ Q ) z ya := prod-term ( S, R, ( P ◦ Q ) , x, z , y, a , a ) : Bxya := λz : S.λw : P ( x, z ) z .a : ( ∀ z : S. ( P ( x, z ) z ⇒ Bxy )) a := ∃ -el ( S, P ( x, z ) , a , Bxy, a ) : Bxya := λz : S.λv : P ( x, y ) z.a : ( ∀ z : S. ( P ( x, y ) z ⇒ Bxy )) a := ∃ -el ( S, P ( x, y ) , u, Bxy, a ) : Bxya := λx, y : S.λu : Axy.a : A ⊆ B var x, y : S | u : Bxyu : ( ∃ z : S.P ( x, y ) z ) var z : S | v : P ( x, y ) za := ∧ -el ( Rxz, ( P ◦ Q ) zy, v ) : Rxza := ∧ -el ( Rxz, ( P ◦ Q ) zy, v ) : ( P ◦ Q ) zya : ( ∃ z : S.P ( z, y ) z ) var z : S | w : P ( z, y ) z w : P zz ∧ Qz ya := ∧ -el ( P zz , Qz y, w ) : P zz a := ∧ -el ( P zz , Qz y, w ) : Qz ya := prod-term ( S, R, P, x, z, z , a , a ) : ( R ◦ P ) xz a := prod-term ( S, R ◦ P, Q, x, z , y, a , a ) : Axya := λz : S.λw : P ( z, y ) z .a : ( ∀ z : S. ( P ( z, y ) z ⇒ Axy )) a := ∃ -el ( S, P ( z, y ) , a , Axy, a ) : Axya := λz : S.λv : P ( x, y ) z.a : ( ∀ z : S. ( P ( x, y ) z ⇒ Axy )) a := ∃ -el ( S, P ( x, y ) , u, Axy, a ) : Axya := λx, y : S.λu : Bxy.a : B ⊆ Aa := rel - equal ( A, B, a , a ) : ( R ◦ P ) ◦ Q = R ◦ ( P ◦ Q ) (cid:3) Appendix B. Proof of Theorem 5.1
Proof.
Each statement here is a bi-implication, so we use the proof term bi-impl from Lemma 2.3.1) var S : ∗ s | R : br ( S )Notation A := ref l ( S, R ) : ∗ p Notation B := id s ⊆ R : ∗ p u : A var x, y : S | v : ( id S ) xyv : x = S y Notation P := λz : S.Rxz : S → ∗ p ux : P xa := eq - subs ( S, P, x, y, v, ux ) :
P ya : Rxya := λx, y : S.λv : ( id S ) xy.a : ( id S ⊆ R ) a : Ba := λu : A.a : ( A ⇒ B ) u : B var x : Sa := eq - ref l ( S, x ) : x = S xa : ( id S ) xxuxx : ( id S ) xx ⇒ Rxxa := uxxa : Rxxa := λx : S.a : ( ∀ x : S.Rxx ) a : Aa := λu : B.a : ( B ⇒ A ) a := bi - impl ( A, B, a , a ) : ref l ( S, R ) ⇔ id s ⊆ R
2) and 3) are proven together as follows. var S : ∗ s | R : br ( S )Notation A := sym ( S, R ) : ∗ p Notation B := R − ⊆ R : ∗ p Notation C := R − = R : ∗ p u : A var x, y : S | v : R − xyv : Ryxuyx : (
Ryx ⇒ Rxy ) ORMALIZING RELATIONS IN TYPE THEORY 29 a := uyxv : Rxya := λx, y : S.λu : R − xy.a : ( R − ⊆ R ) var x, y : S | v : Rxyuxy : (
Rxy ⇒ Ryx ) a := uxyv : Ryxa : R − xya := λx, y : S.λu : Rxy.a : ( R ⊆ R − ) a := rel - equal ( S, R − , R, a , a ) : R − = Ra := λu : A.a : A ⇒ Ba := λu : A.a : A ⇒ Cu : B var x, y : S | v : Rxyv : R − yxuyx : ( R − yx ⇒ Ryx ) a := uyxv : Ryxa := λx, y : S.λv : Rxy.a : sym ( S, R ) a := λu : B.a : ( B ⇒ A ) u : Cu : R − ⊆ R ∧ R ⊆ R − a := ∧ -el ( R − ⊆ R, R ⊆ R − , u ) : R − ⊆ Ra : Ba := a a : Aa := λu : C.a : ( C ⇒ A ) a := bi - impl ( A, B, a , a ) : sym ( S, R ) ⇔ R − ⊆ R sym - criterion ( S, R ) := bi - impl ( A, C, a , a ) : sym ( S, R ) ⇔ R − = R var S : ∗ s | R : br ( S )Notation A := antisym ( S, R ) : ∗ p Notation B := R ∩ R − ⊆ id S : ∗ p u : A var x, y : S | v : ( R ∩ R − ) xyv : R − xy ∧ Rxya := ∧ -el ( R − xy, Rxy, v ) : R − xya := ∧ -el ( R − xy, Rxy, v ) : Rxya : Ryx uxy : Rxy ⇒ Ryx ⇒ x = ya := uxya a : ( x = y ) a : ( id S ) xya := λx, y : S.λv : ( R ∩ R − ) xy.a : ( R ∩ R − ⊆ id S ) a : Ba := λu : A.a : ( A ⇒ B ) u : B var x, y : S | v : Rxy | w : Ryxw : R − xya := ∧ -in ( R − xy, Rxy, w, v ) : ( R − ∩ R ) xya := uxya : ( id S ) xya : x = ya := λx, y : S.λv : Rxy.λw : Ryx.a : antisym ( S, R ) a : Aa := λu : B.a : ( B ⇒ A ) a := bi - impl ( A, B, a , a ) : ( antisym ( S, R ) ⇔ ( R ∩ R − ⊆ id S ))5) var S : ∗ s | R : br ( S )Notation A := trans ( S, R ) : ∗ p Notation B := R ◦ R ⊆ R : ∗ p u : A var x, y : S Notation P := λz : S.Rxz ∧ Rzy : S → ∗ p v : ( R ◦ R ) xyv : ( ∃ z : S.P z ) var z : S | w : P zw : Rxz ∧ Rzya := ∧ -el ( Rxz, Rzy, w ) :
Rxza := ∧ -el ( Rxz, Rzy, w ) :
Rzya := uxzya a : Rxya := λz : S.λw : P z.a : ( ∀ z : S. ( P z ⇒ Rxy )) a := ∃− el ( S, P, v, Rxy, a ) : Rxya := λx, y : S.λv : ( R ◦ R ) xy.a : ( R ◦ R ⊆ R ) a : Ba := λu : A.a : ( A ⇒ B ) ORMALIZING RELATIONS IN TYPE THEORY 31 u : B var x, y, z : S | v : Rxy | w : Ryza := prod - term ( S, R, R, x, y, z, v, w ) : ( R ◦ R ) xza := uxz : (( R ◦ R ) xz ⇒ Rxz ) a := a a : Rxza := λx, y, z : S.λv : Rxy.λw : Ryz.a : trans ( S, R ) a : Aa := λu : B.a : ( B ⇒ A ) a := bi - impl ( A, B, a , a ) : ( trans ( S, R ) ⇔ ( R ◦ R ⊆ R )) (cid:3) References [1] H. Barendregt. Lambda calculi with types. In S. Abramsky, D.M. Gabbay, and T.S.E. Maibaum, editors,
Handbook of Logic inComputer Science , volume 2, pages 117–309. Oxford University Press, 1992.[2] A. Church. A formulation of the simple theory of types.
Journal of Symbolic Logic , 5(2):56–68, 1940.https://doi.org/10.2307/2266170.[3] T. Coquand and G. Huet. The calculus of constructions.
Information and Computation , 76(2-3):95–120, 1988.https://doi.org/10.1016/0890-5401(88)90005-3.[4] F. B. Fitch.
Symbolic Logic . Ronald Press Company, 1952. ISBN: 978-0826030955.[5] S. Ja´skowski.
On the rules of suppositions in formal logic . Oxford University Press, 1967. ISBN: 978-0198243045.[6] F. Kachapova. Formalizing probability concepts in a type theory.
Journal of Mathematics and Statistics , 14(1):209–218, 2018.10.3844/jmssp.2018.209.218.[7] P. Martin-L¨of.
Intuitionistic type theory: Notes by Giovanni Sambin . Prometeus Books, 1985. ISBN: 978-8870881059.[8] R. Nederpelt and H. Geuvers.
Type Theory and Formal Proof . Cambridge University Press, 2014. ISBN: 978-1-107-03650-5.[9] R. Nederpelt and F. Kamareddine.
Logical Reasoning: A First Course . College Publications, 2 edition, 2011. ISBN: 978-0954300678.[10] B. Russell.
The Principles of Mathematics . W. W. Norton & Company, 1996. ISBN: 978-0393314045.
Department of Mathematical Sciences, Auckland University of Technology, New Zealand
Email address ::