Galois Connections
Total Page:16
File Type:pdf, Size:1020Kb
1 Galois Connections Roland Backhouse 3rd December, 2002 2 Fusion Many problems are expressed in the form evaluate generate ◦ where generate generates a (possibly infinite) candidate set of solutions, and evaluate selects a best solution. Examples: shortest path ; ◦ (x ) L: 2 ◦ Solution method is to fuse the generation and evaluation processes, eliminating the need to generate all candidate solutions. 3 Conditions for Fusion Fusion is made possible when evaluate is an adjoint in a Galois connection, • generate is expressed as a fixed point. • Solution method typically involves generalising the problem. 4 Definition Suppose = (A; ) and = (B; ) are partially ordered sets and A v B suppose F A B and G B A . Then (F;G) is a Galois connection 2 2 of and iff, for all x B and y A, A B 2 2 F:x y x G:y : v ≡ F is called the lower adjoint. G is the upper adjoint. 5 Examples | Propositional Calculus :p q p :q ≡ p ^ q r q (p r) ) ≡ ( p _ q r (p r) ^ (q r) ) ≡ ) ) p q _ r p ^ :q r ) ≡ ) ) ) ) Examples | Set Theory :S T S :T ⊆ ≡ ⊇ S T U T :S U \ ⊆ ≡ ⊆ [ S T U S U ^ T U [ ⊆ ≡ ⊆ ⊆ S T U S :T U ⊆ [ ≡ \ ⊆ 6 Examples | Number Theory -x y x -y ≤ ≡ ≥ x+y z y z-x ≤ ≡ ≤ x n x n d e ≤ ≡ ≤ x y z x z ^ y z ≤ ≡ ≤ ≤ x y z x z=y for all y > 0 ×" ≤ ≡ ≤ 7 Examples | predicates even:m b (if b then 2 else 1) n m ≡ odd:m b (if b then 1 else 2) n m ( ≡ x S b S if b then fxg else φ 2 ) ≡ ⊇ x S b S if b then U else Unfxg 2 ( ≡ ⊆ S = φ b S if b then φ else U ) ≡ ⊆ S = φ b S if b then U else φ 6 ( ≡ ⊆ ) 8 Examples | programming algebra Languages ("factors") L M N L N=M · ⊆ ≡ ⊆ L M N M LnN · ⊆ ≡ ⊆ Relations ("residuals", "weakest pre and post specifications”) R S T R T=S ◦ ⊆ ≡ ⊆ R S T S RnT ◦ ⊆ ≡ ⊆ 9 Examples | program construction Conditional correctness: fpgSfqg means that after successful execution of statement S beginning in a state satisfying the predicate p the resulting state will satisfy predicate q: Weakest liberal precondition fpgSfqg p wlp(S; q) ≡ ) Strongest liberal postcondition fpgSfqg slp(S; p) q ≡ ) Hence slp(S; p) q p wlp(S; q) ≡ ) ) 10 Alternative Definitions | Cancellation (F;G) is a Galois connection between the posets (A; ) and (B; ) iff v the following two conditions hold. (a) For all x B and y A, 2 2 x G:(F:x) and F:(G:y) y : ≤ (b) F and G are both monotonic. 11 Alternative Definitions | Universal Property (F;G) is a Galois connection between the posets (A; ) and (B; ) iff v the following conditions hold. (a) G is monotonic. (b) For all x B, x G:(F:x) . 2 (c) For all x B and y A, x G:y F:x y. 2 2 v ) Informally, F:x is the least y such that x G:y. 12 Suprema and Infima Greatest divisor knm ^ knn kngcd(m; n) ; ≡ and least common multiple mnk ^ nnk lcm(m; n)nk : ≡ 13 Definition of Infimum Suppose ( ; ) and ( ; ) are partially ordered sets and f is A v B 2 A B a monotonic function. Then an infimum of f is a solution of the equation: x :: a :: a x b :: a f:b : (1) h8 v ≡ h8 v ii Equation (1) need not have a solution. If it does, for a given f, we denote its solution by f. By definition, then, u a :: a f b :: a f:b : h8 v u ≡ h8 v ii A complete lattice is a partially ordered set in which all functions have an infimum. 14 Galois connection a :: a f b :: a f:b : h8 v u ≡ h8 v ii b :: a f:b h8 v i f define the function K ( ) by (K:a):b = a g ≡ • 2 A B A b :: (K:a):b f:b h8 v i f definition of _ (pointwise ordering on functions) g ≡ v K:a _ f : v a f K:a _ f : v u ≡ v 15 Definition of Supremum A supremum of f is a solution of the equation: x :: a :: x a b :: f:b a : (2) h8 v ≡ h8 v ii As for infima, equation (2) need not have a solution. If it does, for a given f, we denote its solution by f. By definition, then, t a :: f a b :: f:b a : (3) h8 t v ≡ h8 v ii A cocomplete lattice is a partially ordered set in which all functions have an supremum. Note: Cocomplete equals complete. 16 Infimum Preservation Suppose , and are complete lattices. A B C Function f is inf-preserving if, for all functions g , 2 A B 2 B C f:( g) = (f g) : u u • Suppose that is a poset and is a complete poset. Then a B A monotonic function G is an upper adjoint in a Galois 2 B A connection equivales G is inf-preserving. Dually, a monotonic function F is a lower adjoint in a Galois 2 A B connection equivales F is sup-preserving. 17 Examples (p ^ q r) (p (q r)) ≡ Hence, ) ) ) p ^ x :: q:x x :: p ^ q:x : h9 i ≡ h9 i (:p q) (p :q) ≡ Hence, ) ( : x :: p:x x :: :(p:x) h8 i ≡ h9 i x S b S if b then U else Unfxg 2 ≡ ⊆ Hence, ) x P : P : x P 2 [S ≡ h9 2S 2 i x S b S if b then fxg else φ 2 ≡ ⊇ Hence, ( x P : P : x P 2 \S ≡ h8 2S 2 i.