cs156 the calculus of
play

CS156: The Calculus of E : { = , a , b , c , . . . , f , g , h , . . - PowerPoint PPT Presentation

The Theory of Equality T E CS156: The Calculus of E : { = , a , b , c , . . . , f , g , h , . . . , p , q , r , . . . } Computation uninterpreted symbols: constants a , b , c , . . . Zohar Manna functions f , g , h , . . . Autumn


  1. The Theory of Equality T E CS156: The Calculus of Σ E : { = , a , b , c , . . . , f , g , h , . . . , p , q , r , . . . } Computation uninterpreted symbols: • constants a , b , c , . . . Zohar Manna • functions f , g , h , . . . Autumn 2008 • predicates p , q , r , . . . Example: x = y ∧ f ( x ) � = f ( y ) T E -unsatisfiable f ( x ) = f ( y ) ∧ x � = y T E -satisfiable f ( f ( f ( a ))) = a ∧ f ( f ( f ( f ( f ( a ))))) = a ∧ f ( a ) � = a T E -unsatisfiable Chapter 9: Quantifier-free Equality and Data x = g ( y , z ) → f ( x ) = f ( g ( y , z )) T E -valid Structures Page 1 of 48 Page 2 of 48 Axioms of T E Axiom schema 1. ∀ x . x = x (reflexivity) 5. for each positive integer n and n -ary predicate symbol p , 2. ∀ x , y . x = y → y = x (symmetry) � n � 3. ∀ x , y , z . x = y ∧ y = z → x = z (transitivity) � ∀ ¯ x , ¯ y . x i = y i → ( p (¯ x ) ↔ p (¯ y )) define = to be an equivalence relation. i =1 Axiom schema (predicate) 4. for each positive integer n and n -ary function symbol f , Thus, for unary p , the axiom is � n � � ∀ ¯ x , ¯ y . x i = y i → f (¯ x ) = f (¯ y ) ∀ x ′ , y ′ . x ′ = y ′ → ( p ( x ′ ) ↔ p ( y ′ )) i =1 (function) Therefore, a = b → ( p ( a ) ↔ p ( b )) For example, for unary f , the axiom is is T E -valid. ( x ′ → a , y ′ → b ). ∀ x ′ , y ′ . x ′ = y ′ → f ( x ′ ) = f ( y ′ ) Therefore, x = g ( y , z ) → f ( x ) = f ( g ( y , z )) is T E -valid. ( x ′ → x , y ′ → g ( y , z )). Page 3 of 48 Page 4 of 48

  2. We discuss T E -formulae without predicates Equivalence and Congruence Relations: Basics For example, for Σ E -formula Binary relation R over set S • is an equivalence relation if F : p ( x ) ∧ q ( x , y ) ∧ q ( y , z ) → ¬ q ( x , z ) ◮ reflexive: ∀ s ∈ S . s R s ; introduce fresh constant • and fresh functions f p and f q , and ◮ symmetric: ∀ s 1 , s 2 ∈ S . s 1 R s 2 → s 2 R s 1 ; transform F to ◮ transitive: ∀ s 1 , s 2 , s 3 ∈ S . s 1 R s 2 ∧ s 2 R s 3 → s 1 R s 3 . G : f p ( x ) = • ∧ f q ( x , y ) = • ∧ f q ( y , z ) = • → f q ( x , z ) � = • . Example: Define the binary relation ≡ 2 over the set Z of integers m ≡ 2 n iff ( m mod 2) = ( n mod 2) That is, m , n ∈ Z are related iff they are both even or both odd. ≡ 2 is an equivalence relation • is a congruence relation if in addition n � ∀ s , t . s i R t i → f ( s ) R f ( t ) . i =1 Page 5 of 48 Page 6 of 48 Classes Quotient � equivalence � equivalence � � For relation R over set S , The quotient S / R of S by relation R is the congruence congruence � equivalence � equivalence � � the class of s ∈ S under R is partition of S into classes congruence congruence = { s ′ ∈ S : sRs ′ } . def [ s ] R S / R = { [ s ] R : s ∈ S } . Example: It satisfies total and disjoint conditions. The equivalence class of 3 under ≡ 2 over Z is Example: The quotient Z / ≡ 2 is a partition of Z . The set of [3] ≡ 2 = { n ∈ Z : n is odd } . equivalence classes Partitions {{ n ∈ Z : n is odd } , { n ∈ Z : n is even }} A partition P of S is a set of subsets of S that is � � � Note duality between relations and classes ◮ total S ′ = S S ′ ∈ P ◮ disjoint ∀ S 1 , S 2 ∈ P . S 1 � = S 2 → S 1 ∩ S 2 = ∅ Page 7 of 48 Page 8 of 48

  3. Refinements Closures Two binary relations R 1 and R 2 over set S . Given binary relation R over S . The equivalence closure R E of R is the equivalence relation s.t. R 1 is a refinement of R 2 , R 1 ≺ R 2 , if ◮ R refines R E , i.e. R ≺ R E ; ∀ s 1 , s 2 ∈ S . s 1 R 1 s 2 → s 1 R 2 s 2 . ◮ for all other equivalence relations R ′ s.t. R ≺ R ′ , either R ′ = R E or R E ≺ R ′ R 1 refines R 2 . That is, R E is the “smallest” equivalence relation that “covers” R . Examples: Example: If S = { a , b , c , d } and R = { aRb , bRc , dRd } , then ◮ For S = { a , b } , • aR E b , bR E c , dR E d since R ⊆ R E ; R 1 : { aR 1 b } R 2 : { aR 2 b , bR 2 b } • aR E a , bR E b , cR E c by reflexivity; Then R 1 ≺ R 2 • bR E a , cR E b by symmetry; ◮ For set Z • aR E c by transitivity; R 1 : { xR 1 y : x mod 2 = y mod 2 } • cR E a by symmetry. R 2 : { xR 2 y : x mod 4 = y mod 4 } Then R 2 ≺ R 1 . Similarly, the congruence closure R C of R is the “smallest” congruence relation that “covers” R . Page 9 of 48 Page 10 of 48 T E -satisfiability and Congruence Classes I T E -satisfiability and Congruence Classes II Given Σ E -formula F Definition: For Σ E -formula F : s 1 = t 1 ∧ · · · ∧ s m = t m ∧ s m +1 � = t m +1 ∧ · · · ∧ s n � = t n F : s 1 = t 1 ∧ · · · ∧ s m = t m ∧ s m +1 � = t m +1 ∧ · · · ∧ s n � = t n with subterm set S F , F is T E -satisfiable iff there exists a the subterm set S F of F is the set that contains precisely congruence relation ∼ over S F such that the subterms of F . ◮ for each i ∈ { 1 , . . . , m } , s i ∼ t i ; Example: The subterm set of ◮ for each i ∈ { m + 1 , . . . , n } , s i �∼ t i . F : f ( a , b ) = a ∧ f ( f ( a , b ) , b ) � = a Such congruence relation ∼ defines T E -interpretation I : ( D I , α I ) of F . D I consists of | S F / ∼ | elements, one for each congruence is class of S F under ∼ . S F = { a , b , f ( a , b ) , f ( f ( a , b ) , b ) } . Note: we consider only quantifier-free conjunctive Σ E -formulae. Instead of writing I | = F for this T E -interpretation, we abbreviate Convert non-conjunctive formula F to DNF � i F i , where each ∼ | = F disjunct F i is a conjunction of =, � =. Check each disjunct F i . F is The goal of the algorithm is to construct the congruence relation T E -satisfiable iff at least one disjunct F i is T E -satisfiable. over S F , or to prove that no congruence relation exists. Page 11 of 48 Page 12 of 48

  4. Congruence Closure Algorithm Congruence Closure Algorithm (Details) F : s 1 = t 1 ∧ · · · ∧ s m = t m ∧ s m +1 � = t m +1 ∧ · · · ∧ s n � = t n Initially, begin with the finest congruence relation ∼ 0 given by the � �� � � �� � partition generate congruence closure search for contradiction {{ s } : s ∈ S F } . Decide if F is T E -satisfiable. That is, let each term over S F be its own congruence class. Then, for each i ∈ { 1 , . . . , m } , impose s i = t i by merging the The algorithm performs the following steps: congruence classes 1. Construct the congruence closure ∼ of [ s i ] ∼ i − 1 and [ t i ] ∼ i − 1 { s 1 = t 1 , . . . , s m = t m } to form a new congruence relation ∼ i . over the subterm set S F . Then To accomplish this merging, ∼ | = s 1 = t 1 ∧ · · · ∧ s m = t m . ◮ form the union of [ s i ] ∼ i − 1 and [ t i ] ∼ i − 1 ◮ propagate any new congruences that arise within this union. 2. If for any i ∈ { m + 1 , . . . , n } , s i ∼ t i , return unsatisfiable. The new relation ∼ i is a congruence relation in which s i ∼ t i . 3. Otherwise, ∼| = F , so return satisfiable. How do we actually construct the congruence closure in Step 1? Page 13 of 48 Page 14 of 48 Congruence Closure Algorithm: Example 1 I Congruence Closure Algorithm: Example 1 II This partition represents the congruence closure of S F . Given Σ E -formula Is it the case that F : f ( a , b ) = a ∧ f ( f ( a , b ) , b ) � = a {{ a , f ( a , b ) , f ( f ( a , b ) , b ) } , { b }} | = F ? Construct initial partition by letting each member of the subterm No, as f ( f ( a , b ) , b ) ∼ a but F asserts that f ( f ( a , b ) , b ) � = a . set S F be its own class: Hence, F is T E -unsatisfiable. 1. {{ a } , { b } , { f ( a , b ) } , { f ( f ( a , b ) , b ) }} According to the first literal f ( a , b ) = a , merge { f ( a , b ) } { a } and to form partition 2. {{ a , f ( a , b ) } , { b } , { f ( f ( a , b ) , b ) }} According to the (function) congruence axiom, f ( a , b ) ∼ a , b ∼ b f ( f ( a , b ) , b ) ∼ f ( a , b ) , implies resulting in the new partition 3. {{ a , f ( a , b ) , f ( f ( a , b ) , b ) } , { b }} Page 15 of 48 Page 16 of 48

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend