Galois
Galois: A Language for Proofs Using Galois connections and ... - ALFA
Galois: A Language for Proofs Using Galois connections and ... - ALFA
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Galois</strong>:<br />
A Language for Proofs Using <strong>Galois</strong> connections and Fork Algebras<br />
Paulo Silva 1 Joost Visser 2 José Oliveira 1<br />
1 CCTC<br />
University of Minho<br />
Braga, Portugal<br />
2 Software Improvement Group<br />
The Netherlands<br />
PLMMS’09<br />
August 21, 2009<br />
Munich, Germany<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 1 / 28
Outline<br />
Outline<br />
1 Introduction<br />
Motivation<br />
Objectives<br />
2 Theoretical background<br />
Indirect equality<br />
<strong>Galois</strong> connections<br />
Fork algebras<br />
Point-free transform<br />
3 <strong>Galois</strong> and Galculator<br />
<strong>Galois</strong><br />
Galculator<br />
4 Summary<br />
Summary<br />
Future work<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 2 / 28
Outline<br />
Introduction<br />
1 Introduction<br />
Motivation<br />
Objectives<br />
2 Theoretical background<br />
Indirect equality<br />
<strong>Galois</strong> connections<br />
Fork algebras<br />
Point-free transform<br />
3 <strong>Galois</strong> and Galculator<br />
<strong>Galois</strong><br />
Galculator<br />
4 Summary<br />
Summary<br />
Future work<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 3 / 28
Introduction<br />
Motivation<br />
Whole division<br />
Prove<br />
(a ÷ b) ÷ c = a ÷ (c × b)<br />
for b and c ≠ 0.<br />
Easy if ÷ is the real number division<br />
Also valid in natural numbers but the proof is not so straightforward<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 4 / 28
Introduction<br />
Whole division specification<br />
Motivation<br />
Implicit definition<br />
Explicit definition<br />
c = x ÷ y ⇔ 〈∃ r : 0 r < y : x = c × y + r〉<br />
x ÷ y = 〈 ∨ z :: z × y x〉<br />
<strong>Galois</strong> connection<br />
z × y x ⇔ z x ÷ y (y > 0)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 5 / 28
Introduction<br />
Whole division specification<br />
Motivation<br />
Implicit definition<br />
Explicit definition<br />
c = x ÷ y ⇔ 〈∃ r : 0 r < y : x = c × y + r〉<br />
x ÷ y = 〈 ∨ z :: z × y x〉<br />
<strong>Galois</strong> connection<br />
z × y x ⇔ z x ÷ y (y > 0)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 5 / 28
Introduction<br />
Whole division specification<br />
Motivation<br />
Implicit definition<br />
Explicit definition<br />
c = x ÷ y ⇔ 〈∃ r : 0 r < y : x = c × y + r〉<br />
x ÷ y = 〈 ∨ z :: z × y x〉<br />
<strong>Galois</strong> connection<br />
z × y x ⇔ z x ÷ y (y > 0)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 5 / 28
Introduction<br />
Motivation<br />
Proof.<br />
n (a ÷ b) ÷ c<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n × c a ÷ b<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
(n × c) × b a<br />
⇔ { multiplication is associative }<br />
n × (c × b) a<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n a ÷ (c × b)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 6 / 28
Introduction<br />
Motivation<br />
Proof.<br />
n (a ÷ b) ÷ c<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n × c a ÷ b<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
(n × c) × b a<br />
⇔ { multiplication is associative }<br />
n × (c × b) a<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n a ÷ (c × b)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 6 / 28
Introduction<br />
Motivation<br />
Proof.<br />
n (a ÷ b) ÷ c<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n × c a ÷ b<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
(n × c) × b a<br />
⇔ { multiplication is associative }<br />
n × (c × b) a<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n a ÷ (c × b)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 6 / 28
Introduction<br />
Motivation<br />
Proof.<br />
n (a ÷ b) ÷ c<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n × c a ÷ b<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
(n × c) × b a<br />
⇔ { multiplication is associative }<br />
n × (c × b) a<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n a ÷ (c × b)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 6 / 28
Introduction<br />
Motivation<br />
Proof.<br />
n (a ÷ b) ÷ c<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n × c a ÷ b<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
(n × c) × b a<br />
⇔ { multiplication is associative }<br />
n × (c × b) a<br />
⇔ { z × y x ⇔ z x ÷ y }<br />
n a ÷ (c × b)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 6 / 28
Introduction<br />
Objectives<br />
Objectives<br />
Galculator = <strong>Galois</strong> connection + calculator<br />
<strong>Galois</strong><br />
Build a proof assistant based on <strong>Galois</strong> connections, their algebra<br />
and associated tactics<br />
Language for mathematical reasoning<br />
Equivalent to first-order logic<br />
Typed language<br />
Front-end for the Galculator<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 7 / 28
Outline<br />
Theoretical background<br />
1 Introduction<br />
Motivation<br />
Objectives<br />
2 Theoretical background<br />
Indirect equality<br />
<strong>Galois</strong> connections<br />
Fork algebras<br />
Point-free transform<br />
3 <strong>Galois</strong> and Galculator<br />
<strong>Galois</strong><br />
Galculator<br />
4 Summary<br />
Summary<br />
Future work<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 8 / 28
Theoretical background<br />
Indirect equality<br />
Indirect inequality<br />
Definition (Indirect inequality)<br />
a ⊑ b ⇔ 〈∀ x :: x ⊑ a ⇒ x ⊑ b〉<br />
a ⊑ b ⇔ 〈∀ x :: b ⊑ x ⇒ a ⊑ x〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 9 / 28
Theoretical background<br />
Indirect equality<br />
Proof.<br />
a = b<br />
⇔ { Anti-symmetry }<br />
a ⊑ b ∧ b ⊑ a<br />
⇔ { Indirect inequality }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b〉 ∧ 〈∀ x :: x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Rearranging quantifiers }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b ∧ x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Mutual implication }<br />
〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 10 / 28
Theoretical background<br />
Indirect equality<br />
Proof.<br />
a = b<br />
⇔ { Anti-symmetry }<br />
a ⊑ b ∧ b ⊑ a<br />
⇔ { Indirect inequality }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b〉 ∧ 〈∀ x :: x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Rearranging quantifiers }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b ∧ x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Mutual implication }<br />
〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 10 / 28
Theoretical background<br />
Indirect equality<br />
Proof.<br />
a = b<br />
⇔ { Anti-symmetry }<br />
a ⊑ b ∧ b ⊑ a<br />
⇔ { Indirect inequality }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b〉 ∧ 〈∀ x :: x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Rearranging quantifiers }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b ∧ x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Mutual implication }<br />
〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 10 / 28
Theoretical background<br />
Indirect equality<br />
Proof.<br />
a = b<br />
⇔ { Anti-symmetry }<br />
a ⊑ b ∧ b ⊑ a<br />
⇔ { Indirect inequality }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b〉 ∧ 〈∀ x :: x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Rearranging quantifiers }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b ∧ x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Mutual implication }<br />
〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 10 / 28
Theoretical background<br />
Indirect equality<br />
Proof.<br />
a = b<br />
⇔ { Anti-symmetry }<br />
a ⊑ b ∧ b ⊑ a<br />
⇔ { Indirect inequality }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b〉 ∧ 〈∀ x :: x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Rearranging quantifiers }<br />
〈∀ x :: x ⊑ a ⇒ x ⊑ b ∧ x ⊑ b ⇒ x ⊑ a〉<br />
⇔ { Mutual implication }<br />
〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 10 / 28
Theoretical background<br />
Indirect equality<br />
Indirect equality<br />
Definition (Indirect equality)<br />
a = b ⇔ 〈∀ x :: x ⊑ a ⇔ x ⊑ b〉<br />
a = b ⇔ 〈∀ x :: a ⊑ x ⇔ b ⊑ x〉<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 11 / 28
<strong>Galois</strong> connections<br />
Theoretical background<br />
<strong>Galois</strong> connections<br />
Definition (<strong>Galois</strong> connection)<br />
Given two preordered sets (A, ⊑ A ) and (B, ⊑ B ) and two functions<br />
B f<br />
A and g<br />
A B , the pair (f , g) is a <strong>Galois</strong> connection<br />
if and only if, for all a ∈ A and b ∈ B:<br />
f a ⊑ B b ⇔ a ⊑ A g b<br />
Graphical notation<br />
⊑ A<br />
A<br />
f<br />
g<br />
B<br />
⊑ B<br />
(f ,g)<br />
or (A, ⊑ A ) (B, ⊑ B )<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 12 / 28
Properties<br />
Theoretical background<br />
<strong>Galois</strong> connections<br />
Property<br />
f a ⊑ B b ⇔ a ⊑ A g b<br />
a ⊑ A a ′ ⇒ f a ⊑ B f a ′<br />
b ⊑ B b ′ ⇒ g b ⊑ A g b ′<br />
a ⊑ A g (f a)<br />
f (g b) ⊑ B b<br />
f (g (f a)) = f a<br />
g (f (g b)) = g b<br />
g (b ⊓ B b ′ ) = g b ⊓ A g b ′<br />
f (a ⊔ A a ′ ) = f a ⊔ B f a ′<br />
g ⊤ B = ⊤ A<br />
f ⊥ A = ⊥ B<br />
Description<br />
“Shunting rule”<br />
Monotonicity (LA)<br />
Monotonicity (UA)<br />
Lower cancellation<br />
Upper cancellation<br />
Semi-inverse<br />
Semi-inverse<br />
Distributivity (UA over meet)<br />
Distributivity (LA over join)<br />
Top-preservation (UA)<br />
Bottom-preservation (LA)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 13 / 28
Theoretical background<br />
<strong>Galois</strong> connections — Algebra<br />
<strong>Galois</strong> connections<br />
Identity connection<br />
(id,id)<br />
(A, ⊑ A ) (A, ⊑ A )<br />
Composition<br />
(f ,g)<br />
(h,k)<br />
(h◦f ,g◦k)<br />
if (A, ⊑) (B, ≼) and (B, ≼) (C, ) then (A, ⊑) (C, )<br />
Composition is associative and the identity is its unit.<br />
<strong>Galois</strong> connections form a category.<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 14 / 28
Theoretical background<br />
<strong>Galois</strong> connections — Algebra<br />
<strong>Galois</strong> connections<br />
Converse<br />
(f ,g)<br />
(g,f )<br />
if (A, ⊑) (B, ≼) then (B, ≽) (A, ⊒)<br />
Relator<br />
For every relator F<br />
(f ,g)<br />
(Ff ,Fg)<br />
if (A, ⊑) (B, ≼) then (FA, F ⊑) (FB, F ≼)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 15 / 28
Logic vs. algebra<br />
Theoretical background<br />
Fork algebras<br />
Logic Algebra<br />
Propositional logic Boolean algebra<br />
Intuitionistic propositional logic Heyting algebra<br />
Predicate logic ??<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 16 / 28
Theoretical background<br />
Fork algebras<br />
Relation algebras<br />
Extension of Boolean algebras<br />
Original work of De Morgan, Peirce and Schröder<br />
Further developed by Tarski in his attempt to formalize set theory<br />
without variables<br />
Amenable for syntactic manipulation<br />
Only one inference rule is needed: substitution of equals by<br />
equals<br />
Equational reasoning<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 17 / 28
Theoretical background<br />
Fork algebras<br />
Relation algebras<br />
Extension of Boolean algebras<br />
Original work of De Morgan, Peirce and Schröder<br />
Further developed by Tarski in his attempt to formalize set theory<br />
without variables<br />
Amenable for syntactic manipulation<br />
Only one inference rule is needed: substitution of equals by<br />
equals<br />
Equational reasoning<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 17 / 28
Theoretical background<br />
Fork algebras<br />
Fork algebras<br />
Limitation of relation algebras<br />
Relations algebras can express first-order predicates with at most<br />
three variables<br />
Fork algebras<br />
Extend relation algebras with a pairing operator<br />
Equivalent in expressive and deductive power to first-order logic<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 18 / 28
Theoretical background<br />
Fork algebras<br />
Fork algebras<br />
Limitation of relation algebras<br />
Relations algebras can express first-order predicates with at most<br />
three variables<br />
Fork algebras<br />
Extend relation algebras with a pairing operator<br />
Equivalent in expressive and deductive power to first-order logic<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 18 / 28
Theoretical background<br />
Point-free transform summary<br />
Point-free transform<br />
Pointwise<br />
Pointfree<br />
¬(bRa)<br />
b(¬R)a<br />
bRa ∧ bSa<br />
b(R ∩ S)a<br />
bSa ∨ bSa<br />
b(R ∪ S)a<br />
True<br />
b ⊤ a<br />
False<br />
b ⊥ a<br />
b = a<br />
b id a<br />
aRb<br />
bR ◦ a<br />
〈∃ c :: bRc ∧ cSa〉 b(R ◦ S)a<br />
〈∀ x :: xRb ⇒ xSa〉 b(R \ S)a<br />
〈∀ x :: aRx ⇒ bSx〉 b(S/R)a<br />
bRa ∧ cSa (b, c)(R ∇ S)a<br />
bRa ∧ dSc (b, d)(R × S)(a, c)<br />
〈∀ a, b :: bRa ⇒ bSa〉 R ⊆ S<br />
〈∀ a, b :: bRa ⇔ bSa〉 R = S<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 19 / 28
Theoretical background<br />
Point-free transform<br />
Point-free definitions<br />
Definition (<strong>Galois</strong> connection)<br />
Definition (Indirect equality)<br />
f ◦ ◦ ⊑ B = ⊑ A ◦ g<br />
f = g ⇔ ≼ ◦ f = ≼ ◦ g<br />
f = g ⇔ f ◦ ◦ ≼ = g ◦ ◦ ≼<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 20 / 28
Outline<br />
<strong>Galois</strong> and Galculator<br />
1 Introduction<br />
Motivation<br />
Objectives<br />
2 Theoretical background<br />
Indirect equality<br />
<strong>Galois</strong> connections<br />
Fork algebras<br />
Point-free transform<br />
3 <strong>Galois</strong> and Galculator<br />
<strong>Galois</strong><br />
Galculator<br />
4 Summary<br />
Summary<br />
Future work<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 21 / 28
<strong>Galois</strong> and Galculator<br />
Sub-languages of <strong>Galois</strong><br />
<strong>Galois</strong><br />
Module<br />
GC<br />
Definition Axiom Theorem Strategy<br />
Definition<br />
Type<br />
Fork<br />
Formula<br />
Term<br />
Proof Step<br />
Rewriting<br />
Combinator<br />
Derivation<br />
Order<br />
Function<br />
<strong>Galois</strong><br />
connection<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 22 / 28
<strong>Galois</strong> and Galculator<br />
Architecture of Galculator<br />
Galculator<br />
Combine<br />
GC<br />
Derive<br />
Laws<br />
Relation<br />
algebra<br />
Properties<br />
Theory<br />
domain<br />
Derive<br />
Derive<br />
Derive<br />
Rules<br />
TRS<br />
Strategies<br />
Combine<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 23 / 28
Outline<br />
Summary<br />
1 Introduction<br />
Motivation<br />
Objectives<br />
2 Theoretical background<br />
Indirect equality<br />
<strong>Galois</strong> connections<br />
Fork algebras<br />
Point-free transform<br />
3 <strong>Galois</strong> and Galculator<br />
<strong>Galois</strong><br />
Galculator<br />
4 Summary<br />
Summary<br />
Future work<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 24 / 28
Summary<br />
Summary<br />
Summary<br />
Fork algebras<br />
Equivalent to first-order logic (same expressive and deductive<br />
power)<br />
Single inference rule: substitution of equals for equals<br />
Equational<br />
No variables<br />
Integrates <strong>Galois</strong> connections and indirect equality<br />
<strong>Galois</strong> connections<br />
Provide structure<br />
Introduce semantic information in syntactic reasoning<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 25 / 28
Summary<br />
Summary<br />
Summary<br />
<strong>Galois</strong><br />
Follows the mathematical concepts<br />
Alternative to first-order languages<br />
Typed approach<br />
Galculator<br />
Proof assistance prototype based on <strong>Galois</strong> connections<br />
Innovative approach<br />
Uses a point-free equational approach<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 26 / 28
Summary<br />
Future work<br />
Future work<br />
Mechanization of point-free transform<br />
Automated proofs<br />
Extension of the type system<br />
Free-theorems<br />
Evaluation of the language<br />
Integration with host theorem provers (e.g., Coq)<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 27 / 28
The End<br />
Download<br />
Source code and documentation available from<br />
www.di.uminho.pt/research/galculator<br />
Contact<br />
Questions to paufil@di.uminho.pt<br />
Paulo Silva (UMinho) <strong>Galois</strong> PLMMS’09 28 / 28