Theory of Relational Calculus and its Formalization
-
Upload
yoshihiro-mizoguchi -
Category
Education
-
view
205 -
download
2
Transcript of Theory of Relational Calculus and its Formalization
Theory of Relational Calculus and its formalization
Yoshihiro MizoguchiInstitute of Mathematics for Industry
Kyushu University, JAPAN
Universal Structures in Mathematics and Computing (USMaC2016)La Trobe University
June 29th, 2016
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 1 / 64
Abstract
There are many network structures (relations between certain objects)considered in applications of mathematics for industry. We use manycalculations of numbers and equations of numbers in mathematicalanalysis. But we seldom use calculations of network structures orequations of relational structures. On the other hand, a sufficientlydeveloped theory of relations has been existing for a long while. In thistalk, we review those theory of relations from a view point of acomputation. we show an elementary theory of relations and itsformalization in Coq, a proof assistant system. Further, we introduce anautomatic proving procedures (tactics) for our formalization of the theory ofrelational calculus.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 2 / 64
Table of Contents
1 Introduction2 From Algebra to Category3 Coq Proof Assitant System4 Coq Library for Relational Calculus5 Category Theory using Relational Calculus6 Automata Theory using Relational Calculus7 Relational Graph Rewriting8 Conclusion9 References
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 3 / 64
Section 1: Introduction
Introduction
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 4 / 64
Introduction
There are many network structures (relations between certainobjects) considered in applications of mathematics in other sciences.
We use many calculations of numbers and equations of numbers inmathematical analysis in application areas.
We seldom do calculations in mathematical analysis of networkstructures or equations of structures.
A sufficiently developed theory of relations has been existing for along while.
Managing calculations of relations, we reexamine properties ofnetwork structures.
It is also intended to construct a theory of relations with computerverifiable proofs.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 5 / 64
Historical Background
The modern story of an algebra of logic is started by G. Boole (1847).Complement, Converse (Inverse) and Composition of relations.(De Morgen 1864)To create an algebra out of logic. (C. S. Peirce 1870)Axiomatization of a relation algebra and its Representability.(Tarski 1941, R.Lyndon 1950, McKenzie 1966)Relations in categories.(S. MacLane 1961, D. Puppe 1962, Y. Kawahara 1973)Algebra to Category (Homogeneous to heterogeneous)Allegories(Freyd 1990), Dedekind category (Oliver 1980).Axiomatization of Dedekind category with point axioms(H. Furusawa 2015)
† R. D. Maddux, The origin of relation algebras in the development andaxiomaization of the calculus of relations, 1991.
† R. Hirsh, I. Hodkinson, Relation algebras by games, 2002.
† G. Schmidt, Relational Mathematics, 2010.Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 6 / 64
Applications to Computer Science
Theory of program (Program verification)The weakest prespecifiacion (Hoare 1987),Categorical assertion semantics in toposes (Kawahara 1992),Automated verification of relational while-programs (Berghammer 2014),Semigroup with if–then–else and halting programs (Jackson 2009).
Automata, Graph rewritings (Model of computation)Applications of relational calculus to computer mathematics(Kawahara 1988),Relational graph rewritings (Mizoguchi 1995).
Relational database, Formal concepts analysis (Model of data)Relational aspects of relational database dependencies (Okuma 2000),Formal concepts in Dedekind categories (Ishida 2008).
† 16th International Conference on Relational and Algebraic Methods inComputer Science (RAMiCS),http://www.ens-lyon.fr/LIP/PLUME/RAMiCS17/
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 7 / 64
Section 2: From Algebra to Category
From Algebra to Category
Boolean Algebra→ Relation Algebra→ Dedekind Category
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 8 / 64
Boolean algebra (1)
Let B = (B, ϕ,∇,⊔,−) be a quintuple of a set B, elements ϕ,∇ ∈ B,operations ⊔ : B × B → B and − : B → B. B is a Boolean algebra, if itsatisfies the following axioms for any elements a, b, c ∈ B.
(a ⊔ b) ⊔ c = a ⊔ (b ⊔ c)a ⊔ b = b ⊔ aa ⊔ a = a−(−b) = bb ⊔ (−b) = ∇−∇ = ϕa ⊓ (b ⊔ c) = (a ⊓ b) ⊔ (a ⊓ c)where x ⊓ y = −((−x) ⊔ (−y)).ϕ ⊔ a = a
※ a ⊑ b is defined by a ⊔ b = b, and a − b is defined by a ⊔ (−b).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 9 / 64
Boolean algebra (2)
Let 2X be the set of all subsets of a set X. For any subsets A and B of X,Let A ⊔ B be the union of sets A and B and −A the complement(−A = X − A) of a set A. Then we have a Boolean algebraP(X) = (2X, ϕ, X,⊔,−).
Theorem (Stone’s representation theorem(1936))Let B be a Boolean algebra. Then there exists a set X such that P(X) andB are equivalent as a Boolean algebra.
PropositionA finite Boolean algebra is equivalent to a Boolean algebra of some finiteset. So every finite Boolean algebra is corresponding to a natural numbern and its number of elements is 2n.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 10 / 64
Relation algebra (1)
Let R be a set, ϕ, ∇, id ∈ R, ⊔ : R × R → R, · : R × R → R, − : R → Rand ( )♯ : R → R. A octuple R = (R,⊔,−, ϕ,∇, id,♯ , ·) is called a relationalgebra, if for any elements a, b, c ∈ B it satisfies following axioms:
(R,⊔,−, ϕ,∇) is a Boolean algebra.
(R, ·, id,♯ ) is an involutive monoid withthe identity element id.
(a · b) · c = a · (b · c)a · id = id · a = a(a♯)♯ = a(a · b)♯ = b♯ · a♯
The following three conditions areequivalent.
(a · b) ⊓ c = ϕ(a♯ · c) ⊓ b = ϕa ⊓ (c · b♯) = ϕ
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 11 / 64
Relation algebra (2)
Let X be a set and 2X×X a set of all subsets of X × X. For any subsets A,B of X × X, we define
A · B = {(x, y) | ∃u, (x, u) ∈ A ∧ (u, y) ∈ B}idX = {(x, x) | x ∈ X}, and
A♯ = {(y, x) | (x, y) ∈ A}.
Then P(X × X) = (2X×X,⊔,−, ϕ, X × X, idX, ( )♯, ·) is a relational algebra.
Example
For a relation A ∈ 2X×X, the expression A · A ⊆ A is corresponding to thetransitive law,
(a, b) ∈ A ∧ (b, c) ∈ A ⇒ (a, c) ∈ A.
Our main idea is translating a logical formula in set theory to an expressionusing relation algebra’s operations. Further, we prove those propertiesusing symbolic computations.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 12 / 64
Lyndon’s conditions
Let X be a set, P(X × X) a relation algebra defined by all subsets ofX × X. For any elements in 2X×X, the following conditions always hold:
(D1)
(a·b)⊓(c·d)⊓(e· f ) ⊏ a·[(a♯ ·c)⊓(b·d♯)⊓{((a♯ ·e)⊓(b· f ♯))·((e♯ ·c)⊓( f ·d♯))}]·d
(D2)
a⊓((b⊓(c·d))·(e⊓( f ·g))) ⊏ c·[(((c♯·a)⊓(d·e))·g♯)⊓(d· f )⊓(c♯·((a·g♯)⊓(b· f )))]·g
(D3) If a ⊏ (b · c) ⊓ (d · e) and (b♯ · d) ⊓ (c · e♯) ⊏ f · g then
a ⊏ ((b · f ) ⊓ (d · g♯)) · (( f ♯ · b♯) ⊓ (g · e)).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 13 / 64
McKenzie algebra
Let A = {id, x, y, y♯} and consider a freely generated relation algebra byA ∪ {ϕ,∇} (i.e. an element is a finite union(⊔) of elements of A ∪ {ϕ,∇}and ϕ(∇) is a minimum(maximum) elements).
x = x♯, id♯ = id
For any α ∈ A, ϕ ⊏ α ⊏ ∇ and α ⊓ α = α.
For any α, β ∈ A, if α , β then α ⊓ β = ϕ.
concatenation (·) is defined by the following table:
· id x y y♯
id id x y y♯
x x id ⊔ y ⊔ y♯ x ⊔ y x ⊔ y♯y y x ⊔ y y ∇y♯ y♯ x ⊔ y♯ ∇ y♯
We call the relation algebra defined by above conditions as the McKenziealgebra.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 14 / 64
undecidability of relation algebra
Conjecture
Any relation algebra R is equivalent to a sub-algebra of a relation algebraP(X × X) for some set X.
Theorem (McKenzie 1970)McKenzie algebra does not satisfy (D2). i.e. If a = c = d = f = g = x,b = y, and e = y♯, then (D2) does not hold.
The proof of above theorem is proved by computing (D2) assigningappropriate elements using axioms.
※ The first prove of existence of a relation algebra which is notrepresented by a relation algebra of subsets of X × X is introduced byLyndon(1950).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 15 / 64
Dedekind category (Category of relations) (1)
LetD be a category,D(X, Y) a class of all morphisms from X to Y forX, Y ∈ D. For any objects X, Y, and Z, we define the composition ·, theinverse ( )♯, and the residue composition ▷ as follows:
· = D(X, Y) × D(Y, Z) → D(X, Z)( )♯ = D(X, Y) → D(Y, X)▷ = D(X, Y) × D(Y, Z) → D(X, Z)
We callD as a Dedekind category if it satisfies following conditions:1 (D,⊑,⊓,⊔,⇒, ϕXY ,∇XY) is a complete Heyting algebra with the
minimum ϕXY and the maximum ∇XY .2 Let α, α′ ∈ D(X, Y). Then
(α · β)♯ = β♯ · α♯(α♯)♯ = αIf α ⊑ α′ then α♯ ⊑ α′♯.
3 Let α ∈ D(X, Y), β ∈ D(Y, Z), γ ∈ D(X, Z). Then(α · β) ⊓ γ ⊑ α · (β ⊓ (α♯ · γ))
4 Let α ∈ D(X, Y), β ∈ D(Y, Z), δ ∈ D(X, Z). Thenδ ⊑ α ▷ β↔ α♯ · δ ⊑ β
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 16 / 64
Dedekind category (Category of relations) (2)
※ Summary of notations:(1) A relation α from a set A into another set B is a subset of the
Cartesian product A × B and denoted by α : A ⇁ B.(2) The inverse relation α♯ : B ⇁ A of α is a relation such that
(b, a) ∈ α♯ if and only if (a, b) ∈ α.(3) The composite αβ : A ⇁ C of α : A ⇁ B followed by β : B ⇁ C is
a relation such that (a, c) ∈ αβ if and only if there exists b ∈ B with(a, b) ∈ α and (b, c) ∈ β.
(4) As a relation of a set A into a set B is a subset of A × B, the inclusionrelation, union, intersection and difference of them are available asusual and denoted by ⊑, ⊔, ⊓ and −, respectively.
(5) The identity relation idA : A ⇁ A is a relation withidA = {(a, a) ∈ A × A |,a ∈ A}.
(6) The empty relation ϕ ⊆ A × B is denoted by 0AB. The entire setA × B is called the universal relation and denoted by ∇AB.
(7) The one point set {∗} is denoted by I. We note that ∇II = idI.Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 17 / 64
Section 3: A Coq Proof Assistant System
Coq Proof Assitant System
for Information Systemsand
for Mathematics
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 18 / 64
What is Coq?
Coq is a proof assistant system developed in INRIA (France). A proofassistant system is used to show a correctness of a program. TheCommon Criteria for Information Technology Security Evaluation is aninternational standard (ISO/IEC 15408) for computer security certification.In the EAL7 (The maximum Evaluation Assurance Level), a formalverification is requested. In Japan, Sony(and FeliCa) took a certification ofEAL6+ for a FeliCa chip a payment IC card embedded in a mobile phonecalled ’OSAIFU KEITAI’ (moblie wallet).Personally, I think that formal verifications could be much important formany areas including an automatic driving vehicle system. Recently, proofassistant systems are used to create a computer verifiable proof forcomplicated theorems in Mathematics.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 19 / 64
Formal Proofs in Mathematics
G. Gonthier, Formal Proof―The Four-Color Theorem. Notices of the AmericanMathematical Society, 55(11), 13821393, 2008.http://www.ams.org/notices/200811/tx081101382p.pdf
R. Affeldt and M. Hagiwara, Formalization of Shannon’s Therems in SSReflect-Coq,Proc. 3rd Conference on Interactive Theorem Proving, LNCS 7406, 233249, 2012.
G. Gonthier, et al., A Machine-Checked Proof of the Odd Order Theorem, Proc. 4thConference on Interactive Theorem Proving, LNCS 7998, 163179, 2013.https://hal.inria.fr/hal-00816699/file/main.pdf
F. Chyzak, A. Mahboubi et.al, A Computer-Algebra-Based Formal Proof of theIrrationality of ζ(3), Proc. 5th International Conference on Interactive TheoremProving, LNCS 8558, 2014, https://hal.inria.fr/hal-00984057.
T. Hales, Dense Sphere Packings : A blueprint for formal proofs, CambridgeUniversity Press, 2012. (The Kepler Conjecture)
J.Avigad and J.Harrison, Formally Verified Mathematics, Communications of theACM, Vol.57(4), 2014. (Tutorial)
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 20 / 64
Four Color Theorem
Kyushu Island in Japan
Kyushu University is
in Fukuoka Prefecture
The four color theorem states that noore than four colors are required tocolor the regions of the plane map sothat no two adjacent regions have thesame color.
First, it is proved by Appel and Hakenin 1976. They found 1405 unavoidablesets and find solutions using acomputer (IBM-360).
In 1996, Robertson et. al. improvedand reduced the number ofunavoidable sets to 633. They use acomputer Sun Sparc20.
In 2004, Gonthier et. al. introduced acomplete verifiable proof for the fourcolor theorem using a proof assistantsystem Coq and its extensionSsreflect.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 21 / 64
Keplar Conjecture
Keplar Conjecture states that no arrangement of equality sizedspheres filling space has a greater average density than that of thecubic close packing and hexagonal close packing arrangements.In 1998, Thomas Hales proved it manually using a Java programwhich compare densities of 5128 tame graphs corresponding tospecified arrangements. The reviewer gave up to review the paper.In 2006, Nipkow et. al. reduced the number of tame graphs to 2771and proved using a proof assistant Isabell/HOL.In 2014, Hales et. al. announced the completion of a formal verifiableproof. The member of Flyspec project finished to construct a formalproof using HOL Light.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 22 / 64
Announcements and Links
SSreflect in the world,http://coqfinitgroup.gforge.inria.fr/ssreflect_world.html
Coq Proof of the Four Color Theorem, 2006/04/26,http://bit.ly/FourColorTheorem
Feit thompson proved in Coq, 2012/09/20,http://bit.ly/FeitThompson
The announcement of the completion of the Flyspec project, 2014/8/10.http://bit.ly/Flyspeck
(The Kepler Conjecture)
Univalent Foundations of Mathematics, 2012,2013.http://bit.ly/UnivalentFoundations
(Homotopy Type Theory)
Computing close approximations of Pi,http://www-sop.inria.fr/members/Yves.Bertot/proofs.html
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 23 / 64
Section 4
Coq Library for Relational Calculus
From Logical formula to Relational formula in Mathematics.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 24 / 64
Axioms and Lemmas in Dedekind category (1)
Library Basic_NotationsDefinitions and notations of elementary operations.
Library Distributive_LawsDistributive law, De-Morgan’s law, etc.
Library Empty_Universal_InverseLemmas for empty, total, and inverse relations
Library Basic_LemmasLemmas for inclusions, union, and intersection of relations.
Library Functions_MappingsDefinitions and lemmas for functions. 1
Library DedekindLemmas for Dedekind categories.
1※ including tactics.Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 25 / 64
Axioms and Lemmas in Dedekind category (2)
Let A, B be eqType. We denote a type of a relation from A to B by(Rel A B) and defied as A → B → Prop.The followings is a list of notations.
Notation Coq Notation
Inverse α♯ (inverse_relation α) (α #)Composite αβ (composite α β) (α · β)Identity idA (identity_relation A) (Id A)Empty ϕAB (empty_relation A B) (φ A B)Total ∇AB (universal_relation A B) (∇ A B)
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 26 / 64
Relational representation of properties of maps (1)
Properties of a function (total function), injection, surjection are not definedby logical formulas but relational expressions.
DefinitionLet α : A ⇁ B be a relation.
(1) α is total, if idA ⊑ αα♯.(2) α is univalent, if α♯α ⊑ idB.
(3) A univalent relation is also called as a partial function.
(4) α is (total) function, if α is total and univalent.
(3) A (total) function α : A ⇁ B is surjection, if α♯α = idB.
(4) A (total) function α : A ⇁ B is injection, if αα♯ = idA.
(5) A (total) function is bijection, if it is surjection and injection.
Note. We use letters f , g, h, · · · for (total) functions. For a function,surjection and injection, we use an arrow symbol→,↠ and↣.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 27 / 64
Relational representation of properties of maps (2)
� �Definition total_id {A B : eqType} (alpha : Rel A B) :=
(Id A) ≡ (alpha ・ (alpha #)).Definition univalent_id {A B : eqType} (alpha : Rel A B) :=
((alpha #) ・ alpha) ≡ (Id B).Definition total_r {A B : eqType} (alpha : Rel A B) :=
(Id A) ⊆ (alpha ・ (alpha #)).Definition univalent_r {A B : eqType} (alpha : Rel A B) :=
((alpha #) ・ alpha) ⊆ (Id B).Definition function_r {A B : eqType} (alpha : Rel A B) :=
(total_r alpha) /\ (univalent_r alpha).
Definition surjection_r {A B : eqType} (alpha : Rel A B) :=
(function_r alpha) /\ (total_r (alpha #)).
Definition injection_r {A B : eqType} (alpha : Rel A B) :=
(function_r alpha) /\ (univalent_r (alpha #)).
Definition bijection_r {A B : eqType} (alpha : Rel A B) :=
(surjection_r alpha) /\ (injection_r alpha).� �Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 28 / 64
composite of injections are injection(logical formula)
PropositionIf f : X → Y and g : Y → Z are injections, then f · g : X → Z is aninjection.
(∀x, x′ ∈ X, ∀y ∈ Y, (x, y) ∈ f ∧ (x′, y) ∈ f ⇒ x = x′)∧ (∀y, y′ ∈ Y, ∀z ∈ Z, (y, z) ∈ g ∧ (y′, z) ∈ g ⇒ y = y′)
⇒ (∀x, x′ ∈ X, ∀z ∈ Z, ((x, z) ∈ f · g) ∧ ((x′, z) ∈ f · g))⇒ x = x′
where,
(x, z) ∈ f · g ⇔ ∃y ∈ Y, (x, y) ∈ f ∧ (y, z) ∈ g(x′, z) ∈ f · g ⇔ ∃y′ ∈ Y, (x′, y′) ∈ f ∧ (y′, z) ∈ g
※ Not easy to find a strategy to make proof automatically.Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 29 / 64
composite of injections are injection(logical formula)
� �Theorem injection_composite_set
{X Y Z : eqType} {f : Rel X Y} {g : Rel Y Z}:
(forall (x x’ : X)(y : Y), f x y /\ f x’ y -> x = x’) /\
(forall (y y’ : Y)(z : Z), g y z /\ g y’ z -> y = y’) ->
(forall (x x’ : X)(z : Z),
(exists y : Y, f x y /\ g y z) /\ (exists y’ : Y, f x’ y’ /\ g y’ z) -> x = x’).
Proof.
intuition.
move:H2.
elim => y H4.
apply (H0 x x’ y).
split.
apply (proj1 H4).
move:H3.
elim =>y’ H5.
have: y=y’.
apply (H1 y y’ z).
apply (conj (proj2 H4) (proj2 H5)).
move => H6.
rewrite -H6 in H5.
apply (proj1 H5).
Qed.� �※ Of course, we can make a proof manually.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 30 / 64
composition of an injection and an injection is an injection(relational formula)
PropositionLet f : X → Y, g : Y → Z be injections. Then f · g : X → Z is aninjection.
( f · f ♯ ⊑ idX) ∧ (g · g♯ ⊑ idY) ⇒ (( f · g) · ( f · g)♯ ⊑ idX)
( f · g) · ( f · g)♯
= ( f · g) · (g♯ · f ♯) (∵ (α · β)♯ = β♯ · α♯)= f · (g · g♯) · f ♯ (∵ associative law)⊑ f · idY · f ♯ (∵ g · g♯ ⊑ idY)= f · f ♯ (∵ idY is unit)⊑ idX (∵ f · f ♯ ⊑ idX)
Proof can be done using symbolic transformations.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 31 / 64
composition of an injection and an injection is an injection(relational formula)
� �Theorem injection_composite_rel_tactic
{X Y Z : eqType} {f : Rel X Y} {g : Rel Y Z}:
(f ・ (f #)) ⊆ Id X /\ (g ・ (g #)) ⊆ Id Y ->((f ・ g) ・ ((f ・ g) #)) ⊆ Id X.
Proof.
Rel_simpl2.
Qed.� �※We can implement an automatic prover (Tactic).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 32 / 64
Elementary lemmas� �Lemma composite_include_left
(a ⊆ a’) -> ((a ・ b) ⊆ (a’ ・ b)).Lemma composite_include_left_a_id
(a ⊆ Id A) -> ((a ・ b) ⊆ b).Lemma composite_include_right
(b ⊆ b’) -> ((a ・ b) ⊆ (a ・ b’)).Lemma composite_include_right_b_id
(b ⊆ Id B) -> ((a ・ b) ⊆ a).Lemma composite_include_right_id_b
(Id B ⊆ b) -> (a ⊆ (a ・ b)).Lemma composite_include_left_right
(b ⊆ b’) -> ((a ・ (b ・ c)) ⊆ (a ・ (b’ ・ c))).Lemma composite_include_left_right_b_id
(b ⊆ Id B) -> ((a ・ (b ・ c)) ⊆ (a ・ c)).Lemma composite_include_left_right_id_b
(Id B ⊆ b) -> ((a ・ c) ⊆ (a ・ (b ・ c))).
� �Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 33 / 64
Automated proving (Tactic)
※ not only reductions.� �Ltac Rel_simpl1 :=
Rel_simpl_intro;
repeat match goal with
| [_ : _ |- _ ⊆ _ ] => apply f_include| [ H : _ |- _ ⊆ _ ] => apply H| [_ : _ |- (_ ・ _) ⊆ (_ ・ _) ] => apply composite_include| [_ : _ |- (_ ・ _) ⊆ _ ] => apply composite_include_left_a_id| [_ : _ |- _ ⊆ (_ ・ _) ] => apply composite_include_left_id_a| [_ : _ |- (_ ・ _) ⊆ _ ] => apply composite_include_right_b_id| [_ : _ |- _ ⊆ (_ ・ _) ] => apply composite_include_right_id_b| [ H : _ ⊆ _ , H0 : _ ⊆ _ |- _ ⊆ _ ] => apply (include_include H H0)| [ H : (Id _) ⊆ _ ,H0 : _ ⊆ (Id _) |- _ ] => rewrite (include_equal H H0)| [_ : _ |- (_ #) ⊆ (_ #) ] => apply include_inverse| [_ : _ |- _ ] => rewrite composite_inverse
| [_ : _ |- _ ] => rewrite composite_composite4
end.
Ltac Rel_simpl2 :=
Rel_simpl_intro;
repeat match goal with
| [ H : (Id _) ⊆ _ |- (Id _) ⊆ _ ] => apply (include_include H)| [ H : _ ⊆ (Id _) |- _ ⊆ (Id _) ] => apply (fun (H0 : _ ⊆ _) => (include_include H0 H))
end;Rel_simpl1.� �※ A transformation is not always a reduction. We may add an identityfunction(Rel_simpl2).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 34 / 64
composition of a surjection and a surjection is a surjection(relational formulation)
PropositionIf f : X → Y and g : Y → Z are surjections, then f · g : X → Z is asurjection.
(idX ⊑ f · f ♯) ∧ (idY ⊑ g · g♯) ⇒ (idX ⊑ ( f · g) · ( f · g)♯)
idX⊑ f · f ♯ (∵ idX ⊑ f · f ♯)= f · (idY · f ♯) (∵ idY is the unit)⊑ f · ((g · g♯) · f ♯) (∵ idY ⊑ g · g♯)= ( f · g) · (g♯ · g♯) (∵ associative)= ( f · g) · ( f · g)♯ (∵ inverse)
Proof can be done using symbolic transformations.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 35 / 64
composition of a surjection and a surjection is a surjection(relational formulation) (2)
� �Lemma total_composite2
{A B C : eqType} {f : Rel A B} {g : Rel B C}:
((Id A) ⊆ (f ・ (f #))) -> (Id B) ⊆ (g ・ (g #)) ->
(Id A) ⊆ ((f ・ g) ・ ((f ・ g) #)).Proof.
Rel_simpl2.
Qed.� �※We can implement an automatic prover (Tactic).
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 36 / 64
Section 5: Category Theory using Relational Calculus
Category Theory using Relational Calculus
Set Theory→ Category Theory→ Relational Calculus(using ∈)→ (logical formula)→ (relational formula)
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 37 / 64
From a logical formula to a relational formula(Equalizer)
Definition (Equalizer)
e = eq( f, g) ⇔de f
(∀d, ((d f = dg) ⇒ (∃!h, d = he)))
E e - Af -
g- B
�����
∀d
�
D
∃!h
6
A Definition using a relational formula.
e = eq( f, g) ⇔de f
((ee♯ = idE) ∧ (e♯e = f g♯ ⊓ idA))
We note h = de♯ for any d with d f = dg.Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 38 / 64
From a logical formula to a relational formula(Coequalizer)
Definition (Coequalizer)
c = coeq( f, g) ⇔de f
(∀d, (( f d = gd) ⇒ (∃!h, d = ch)))
Af -
g- B c - Q
@@@@@
∀dR
D
∃!h
?
A Definition using a relational formula.
c = coeq( f, g) ⇔de f
((c♯c = idQ) ∧ (cc♯ = ⊔n≥0
( f ♯g ⊓ g♯ f )n))
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 39 / 64
From a logical formula to a relational formula(Product)
Definition (Product)
Ap← T
q→ B is a product
⇔de f
(∀α, ∀β, ∃!γ, ((γp = α) ∧ (γq = β)))
A � pT
q - B
I@@@@@
∀α�����
∀β
�
X
∃!γ
6
A Definition using a relational formula.
⇔de f
((p♯q = ∇AB) ∧ (pp♯ ⊓ qq♯ = idT))
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 40 / 64
From a logical formula to a relational formula(Coproduct)
Definition (Coproduct)
Ai→ c
j← B is a coproduct
⇔de f
(∀α, ∀β, ∃!γ, ((iγ = α) ∧ ( jγ = β)))
A i - C � jB
@@@@@
∀αR �
����
∀β
X
∃!γ
?
A Definition using a relational formula.
⇔de f
((ii♯ = idA) ∧ ( j j♯ = idB) ∧ (i j♯ = 0AB) ∧ (i♯i ⊓ j♯ j = idC))
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 41 / 64
From a logical formula to a relational formula(Pushout (1))
Definition (Pushout)Assume f x = gy.
Pushout ⇔de f
(∀α, ∀β, ((αx = βy) ⇒ (∃!h, ((h f = α) ∧ (hg = β)))
Y
@@@@
∃!h
R
HHHHHHHHHH
∀α
j
AAAAAAAAAA
∀β
U
Xf - A
B
g
?
y- D
x
?
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 42 / 64
From a logical formula to a relational formula(Pushout (2))
Y
@@@@
∃!h
R
HHHHHHHHHH
∀α
j
AAAAAAAAAA
∀β
U
Xf - A
B
g
?
y- D
x
?
A Definition using a relational formula.
Pushout ⇔de f
(( f ♯ g = xy♯) ∧ ( f f ♯ ⊓ gg♯ = idX))
We assume the axiom of rationality:
∀α : X ⇁ Y, ∃ f : R → X, ∃g : R → Y, ((α = f ♯ g) ∧ ( f f ♯ ⊓ gg♯) = idR)Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 43 / 64
Section 6
Automata Theory using Relational Calculus
Y.Kawahara, Applications of relational calculus to computer mathematics,Bulletin of Informatics and Cybernetics, 23(1988), 67–78.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 44 / 64
Finite automaton
Let Σ = {a, b} be a finite set of symbols. We recall I = {∗}.
We illustrate M as: M : I τ⇁ Q δs⇁ Q β↽ I, (s ∈ Σ).
τ = {(∗, p0)}δa = {(p0, p1), (p1, p2), (p2, p2)}δb = {(p0, p2), (p1, p0), (p2, p2)}β = {(∗, p1)}
T(M) = {w ∈ Σ∗ | τδwβ♯ = idI}
= {a, aba, ababa, . . .}δaba = δaδbδa
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 45 / 64
Finite automaton (relational formula)
Let Σ be a finite set of symbols. We recall I = {∗} is the one point set.
DefinitionA finite automaton M over Σ is a 3-tuple
M = (τ : I ⇁ Q, δa : Q ⇁ Q (a ∈ Σ), β : I ⇁ Q),
where Q is a finite.
We illustrate M as:M : I τ⇁ Q δa⇁ Q β
↽ I.We define δw : Q ⇁ Q for w ∈ Σ∗, by
δε = idQ, and
δwa = δwδa (w ∈ Σ∗, a ∈ Σ).
For an automaton M, we define the recognized language T(M) by
T(M) = {w ∈ Σ∗ | τδwβ♯ = idI}
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 46 / 64
Reverse automaton
DefinitionLet M = (τ : I ⇁ Q, δa : Q ⇁ Q, β : I ⇁ Q) be a finite automaton. Theautomaton
MR = (τR : I ⇁ Q, δRa : Q ⇁ Q, βR : I ⇁ Q)
is the reverse automaton of M, where rR = β, δRa = δ
♯a and β = τ.
Proposition
T(MR) = T(M)R
where T(M)R = {anan−1 · · · a1 ∈ Σ∗ | a1a2 · · · an ∈ T(M)}.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 47 / 64
Coproduct of automata
DefinitionLet M = (τ : I ⇁ Q, δa : Q ⇁ Q, β : I ⇁ Q) andM′ = (τ′ : I ⇁ Q′, δ′a : Q′ ⇁ Q′, β′ : I ⇁ Q′) be finite tutomata. Theautomaton
M + M′ = (τ : I ⇁ Q + Q′, δa : Q + Q′ ⇁ Q + Q′, β : I ⇁ Q + Q′)
is the coproduct automaton of M and M′, where τ = (τi) ⊔ (τ′ j),
δ = (i♯δai) ⊔ ( j♯δ′a j), β = (i♯β) ⊔ ( j♯β′) and Qi→ Q + Q′
j← Q′ is a
coproduct of Q and Q′.
Proposition
T(M + M′) = T(M) ∪ T(M′)
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 48 / 64
Product of automata
DefinitionLet M = (τ : I ⇁ Q, δa : Q ⇁ Q, β : I ⇁ Q) andM′ = (τ′ : I ⇁ Q′, δ′a : Q′ ⇁ Q′, β′ : I ⇁ Q′) be finite tutomata. Theautomaton
M × M′ = (τ : I ⇁ Q × Q′, δa : Q × Q′ ⇁ Q × Q′, β : I ⇁ Q × Q′)
is the coproduct automaton of M and M′, where τ = τp♯ ⊔ τ′q♯,δ = pδa p♯ ⊓ qδ′aq♯, β = βp♯ ⊓ β′q♯ and Q
p← Q × Q′
q→ Q′ is a product of
Q and Q′.
Proposition
T(M × M′) = T(M) ∩ T(M′)
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 49 / 64
Concatenation of automata
DefinitionLet M = (τ : I ⇁ Q, δa : Q ⇁ Q, β : I ⇁ Q) andM′ = (τ′ : I ⇁ Q′, δ′a : Q′ ⇁ Q′, β′ : I ⇁ Q′) be finite tutomata. Theautomaton
M · M′ = (τ : I ⇁ Q + Q′, δa : Q + Q′ ⇁ Q + Q′, β : I ⇁ Q + Q′)
is the concatination automaton of M and M′, where τ = τ(i ⊔ (β♯τ′ j)),δ = (i♯δai) ⊔ (i♯β♯τ′δ′a j) ⊔ ( j♯δ′a j), β = β′(τ′♯βi ⊔ j) and
Qi→ Q + Q′
j← Q′ is a coproduct of Q and Q′.
Proposition
T(M · M′) = T(M) · T(M′),
where T(M) · T(M′) = {ww′ ∈ Σ∗ |w ∈ T(M) ∧ w′ ∈ T(M′)}.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 50 / 64
Section 7
Relational Graph Rewriting
Y.Mizoguchi,Y.Kawahara, Relational graph rewritings, TheoreticalComputer Sicnece 141(1995), 311–328.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 51 / 64
Category of relational graphs (1)
DefinitionA (simple) graph < A, α > is a pair of a set A and a relation α : A ⇁ A. Apartial morphism f of a graph < A, α > into a graph < B, β >, denoted byf :< A, α >→< B, β > is a partial function f : A → B satisifyingd( f )α f ⊏ fβ, where d( f ) = f f ♯ ⊓ idA.
We can define a category Pfn(Graph) of graphs and partial morphismsbetween them.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 52 / 64
Category of relational graphs (2)
PropositionThe category Pfn(Graph) of graphs and partial morphisms has pushouts.That is for given partial morphismsf :< A, α >→< B, β > and g :< A, α >→< C, γ >,there exist partial morphismsh :< B, β >→< D, δ > and k :< C, γ >→< D, δ >such that the following diagram is a pushout square:
< A, α >f- < B, β >
< C, γ >
g
?
k- < D, δ >
h
?
We note that f : A → B, g : A → C, h : B → D and k : C → D is a pushoutsquare in the category Pfn of sets and partial functions and δ = h♯βh ⊔ k♯γk.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 53 / 64
Graph Rewriting using relational calculus
DefinitionA rewriting rule p :< A, α >→< B, β >) is a partial morphism. A matching to p isa morphism g :< A, α >→< G, ξ > of graphs. Consider a pushout inPfn(Graph).
< A, α >f
(rewriting rule)- < B, β >
< G, ξ >
g (matching)
?
k- < H, η >
h
?
We say the graph < G, ξ > is said to be rewritten into a graph < H, η > byapplying a rewriting rule p along a matching g, and denote by< G, ξ >⇐p/g< H, η >.
In the rewriting, we note η = h♯βh ⊔ k♯(ξ − g♯αg)k.So we can investigate properties of graphs using relational calculus.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 54 / 64
Critical pairs
Definition (Critical Pairs)Let fλ be a rewriting rules (λ = 0, 1). A critical pair formd from f0 and f1 is a pairof morphism tλ :< S, σ >→< Tλ, τλ > (λ = 0, 1) of graphs such that all squaresin the following diagram are pushouts in Pfn(Graph) for some pair of injectivefunctiions iλ : A∩ → Aλ.
< A∩, ϕA∩A∩ >i0- < A0, α0 >
f0- < B0, β0 >
< A1, α1 >
i1
? s1- < S, σ >
s0
?
t0- < T0, τ0 >
u0
?
< B1, β1 >
f1
?
u1- < T1, τ1 >
t1
?
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 55 / 64
Critical pairs (Illustration)
A + B i0 - (−x) + xf0 - 0
(x + y) + (−z)
i1
? s1- ((−s) + s) + (−t))
s0
?
t0- 0 + (−t)
u0
?
x + (y + (−z))
f1
?
u1- (−s) + (s + (−t))
t1
?
Note: If every critical pair is confluent, then a graph rewriting system isconfluent.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 56 / 64
Rewriting System
Definition (Rewriting System)A rewriting system P is simply a family of rewriting rules (morphisms ofgraphs). Let < G, ξ >⇒ fλ/gλ< Hλ, ηλ > with rewriting rules fλ ∈ P forλ = 0, 1. The pair of graph rewritings < G, ξ >⇒ fλ/gλ< Hλ, ηλ > is calledconfluent on P if there exist rewriting rules f ′
λ∈ P and graph rewritings
< Hλ, ηλ >⇒ f ′λ/g′λ< H, η > for some graph < H, η >.
Theorem (Critical Pairs Lemma)A graph rewriting system P is confluent if and only if every critical pair in Pis confluent.
This Theorem is proved using pushout properties in a general category.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 57 / 64
General Pushout properties (1)
Af - B
(pushout)
C1
g1
?
k1- D1
h1
?
(pushout)
C2
g2
?
k2- D2
h2
?
PropositionIf f , g, h1 and k1 is a pushout square and k1, g2, h2 and k2 is a pushout square,then f , (g1 g2), (h1h2) and k2 is a pushout square.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 58 / 64
General Pushout properties (2)
Af1 - B1
f2 - B2
(pushout) (pushout)
C
g
?
k1- D1
h1
?
k2- D1
h2
?
PropositionIf f1, g, h1 and k1 is a pushout square and f2, h1, h2 and k2 is a pushout square,then ( f1 f2), g, h2 and (k1 k2) is a pushout square.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 59 / 64
Conclusion and future works
A proof assistant Coq is used not only for a verification of computersystem but for a formal proof of a theorem in Mathematics.(4-color thm, Keplay conj., Feit-Tompson thm., etc.)
Relational structure is rich for applying and relational calculus issuitable for using in a formal proof.An introduction of a stream of a theory from Set theory, Categorytheory to Relational calculus.
Small introductions about ’injection’ and ’surjection’.Relational formulas for notions in the category theory.Relational formulas for the theory of automata.Relational formulas for a theory of graph rewritings.
Future work includes to clarify the mechanism of computations inrelational calculus for developing a theory and a system of a relationalcalculus.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 60 / 64
References I
R. Berghammer, P. Hofner, and I. Stucke.Automated verification of relational while-programs.In P. Hofner, P. Jipsen, W. Kahl, and M. E. Muller, editors, Relational and Algebraic Methods inComputer Science (RAMiCS’14), volume 8428 of Lecture Notes in Computer Sciences, pages173–190, 2014.
Peter J. Freyd and Andre Scedrov.Categories, allegories, volume 39 of North-Holland mathematical library.North-Holland, Amsterdam, 1990.
Hitoshi Furusawa and Yasuo Kawahara.Point axioms and related conditions in dedekind categories.Journal of Logical and Algebraic Methods in Programming, 84:359–376, 2015.
Robin Hirsh and Ian Hodkinson.Relation algebras by games, volume 147 of Studies in Logic and Foundations.North-Holland, Amsterdam, 2002.
C. A. R. Hoare and HE Jifeng.The weakest prespecification.Information processing letter, 24:127–132., 1987.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 61 / 64
References II
T. Ishida, K. Honda, and Y. Kawahara.Formal concepts in Dedekind categories.In R. Berghammer, B. Moller, and G. Struth, editors, Relations and Kleene Algebras in ComputerScience, volume 4988 of Lecture Notes in Computer Science, pages 221–233, 2008.
Marcel Jackson and Tim Stokes.Semigroup with if–then–else and halting programs.International Journal of Algebra and Computation, 19(7):937–961, 2009.
Y. Kawahara.Applications of relational calculus to computer mathematics.Bull. Inform. Cybernet., 23:67–78, 1988.
Y. Kawahara and Y. Mizoguchi.Categorical assertion semantics in toposes.Advances in Software Science and Technology, 4:137–150, 1992.
Saunder Mac Lane.Categories for the working mathematicians.Springer-Verlag, 1971.
R. C. Lyndon.The representation of relational algebras.Annuals of Mathematics, 51:707–729, 1950.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 62 / 64
References III
Roger D. Maddux.The origin of relation algebras in the development and axiomatization of the calculus of relations.
Studia Logica: An International Journal for Symbolic Logic, 50:421–455, 1991.
Ralph N. McKenzie, George F. McNulty, and Walter F. Tylor.Algebras, lattices, varieties.The Wadsworth & Books/Cole mathematics series. Wadsworth & Books, 1987.
Y. Mizoguchi and Y. Kawahara.Relational graph rewritings.Theoret. Comput. Sci., 141:311–328, 1995.
A. De Morgan.On the syllogism: IV, and on the logic of relations.Transactions of the Cambridge Philosophcal Society, pages 331–358, 1966.
H. Okuma and Y. Kawahara.Relational aspects of relational database dependencies.Bull. Inform. Cybernet., pages 91–104, 2000.
J. P. Oliver and D. Serrato.Categories de dedekind morphismes dans les categories de Shroder.C. R. Acad. Sci. Paris, 290:939–941, 1980.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 63 / 64
References IV
C. S. Peirce.Note B: the logic of relatives, volume iviii+vi+203, pages 187–203.John Benjamins Publishing Co., Amsterdam and Philadelphia., 1983.
G. Schmidt.Relational Mathematics.Cambridge University Press, 2010.
Marshall H. Stone.The theory of representations of Boolean algebras.Transactions of American Mathematical Society, 40, 1936.
A. Tarski.On the calculus of relations.Journal of Symbolic Logic, 6:73–89, 1941.
Y.Mizoguchi Theory of Relational Calculus and its formalization 2016/06/29 64 / 64