equational logic part 1
play

Equational Logic. Part 1 Roland Backhouse February 6th, 2001 2 - PowerPoint PPT Presentation

1 Equational Logic. Part 1 Roland Backhouse February 6th, 2001 2 Outline The Logical Connectives. Properties of Equality. Properties of Equivalence. Negation 3 Logical Connectives Proofs involve two components: Reasoning


  1. 1 Equational Logic. Part 1 Roland Backhouse February 6th, 2001

  2. 2 Outline • The Logical Connectives. • Properties of Equality. • Properties of Equivalence. • Negation

  3. 3 Logical Connectives Proofs involve two components: • Reasoning dependent on properties of the data. • Reasoning that is independent of properties of the data: logical reasoning . For example, if the goal is to prove that l ≤ ( l + r − 1 ) ÷ 2 < r 0 ≤ l < r ≤ N ⇐ logical reasoning justifies splitting the proof into two parts, a proof that l ≤ ( l + r − 1 ) ÷ 2 0 ≤ l < r ⇐ and a proof that ( l + r − 1 ) ÷ 2 < r 0 ≤ l < r . ⇐ Logic is the glue that binds together the properties of the data.

  4. 4 Propositions A proposition is a statement that is either true or false. Examples : It is raining. The moon is made of cheese. Roses are red. True and false are called boolean values (after George Boole). Propositions thus have boolean values. Propositions are combined using the logical connectives . The logical connectives are functions from booleans to booleans.

  5. 5 And and (Inclusive) Or In English (and other natural languages) the logical connectives are expressed in many ways: Conjunction ( ∧ ) — “and”, “yet”, “but”, “however”, “moreover”, etc. The sky is blue and the clouds are grey. It is raining yet the sun is shining. It is nice outside but we have to stay inside. Disjunction ( ∨ ) — “or”, “and/or”, “either . . . or ”. Roses are red or they are yellow.

  6. 6 If and Only-If Follows-from ( ⇐ ) — “if”, “when”, etc. k is positive if l is positive. k is positive when l is positive. For k to be positive it is sufficient that l be positive. k ≥ 0 ⇐ l ≥ 0 . Implies ( ⇒ ) — “if . . . then . . . ”, “only if”, etc. If l is positive then k is positive. l is positive only if k is positive. A necessary condition for l to be positive is that k be positive. l ≥ 0 ⇒ k ≥ 0 .

  7. 7 Truth Tables ¬ p p true p false true true true false false false true false true false p = q p � = q p ≡ q p �≡ q p ∧ q p ∨ q p q true p ⇐ q p ⇒ q false true true true true false true true true true false true false true false true false true true false false false true true false true false true false true false false false true true false false false true true false

  8. 8 Equality of Booleans p = q p ≡ q p q true true true true false false false true false false false true

  9. 9 Logical Equivalence ≡ , = — “iff”, “whenever”, “exactly when” Equivalence is the equality operator on boolean values. Equality is the most basic and most important operator on any type. Equivalence is the most important of the logical connectives. In English we don’t really have a short name for it. Often equivalence is meant but “if” is stated: The work-force will go on strike if redundancies are announced. The fact that equivalence is rarely directly expressed in natural language has the consequence that we are unused to reasoning about or exploiting equivalences. One of the mathematical skills I want to convey is reasoning with equivalences.

  10. 10 Example — A Property of Integers l ≤ r − 1 = { l and r are integers. } l < r = { l and r are integers. } l + 1 ≤ r .

  11. 11 Properties of Equality Equality is reflexive . That is x = x whatever the value (or type) of x . Equality is symmetric . That is, x = y is the same as y = x . Equality is transitive . If x = y and y = z then x = z . Substitution of equals for equals ( Leibniz’s rule ). If x = y and f is any function then f.x = f.y (where the infix dot denotes function application).

  12. 12 Associativity Equality is a binary operator with range the boolean values true and false . This raises the question whether equality is associative. That is, is it the case that for arbitrary x , y and z , (( x = y ) = z ) = ( x = ( y = z )) ? Answer: 1. The question doesn’t usually make sense. Eg. for numbers x , y and z , ( x = y ) = z doesn’t make sense because x = y is a boolean and z is a number. 2. The question does make sense for booleans x , y and z .

  13. 13 Equivalence is Associative! For all booleans p , q and r , (( p = q ) = r ) = ( p = ( q = r )) .

  14. 14 A Notational Dilemma. We write 0 ≤ l ≤ r ≤ N . We also write m + n + p + q . Syntactically these two formulae have the same shape. But the notational convention that is being used is quite different. In the first case the convention is that the formula means 0 ≤ l ∧ l ≤ r ∧ r ≤ N . The formula is read conjunctionally . In the second case the convention is that the formula means whichever of the following one cares to choose: (( m + n )+ p )+ q ( m + n )+( p + q ) m +( n +( p + q )) The formula is read associatively .

  15. 15 A Notational Dilemma (Continued). “If” is a transitive relation. To exploit this property, we write p ⇐ q ⇐ r with the conjunctional meaning ( p ⇐ q ) ∧ ( q ⇐ r ) . (Beware: not everyone uses this convention.) “And” is an associative operator. To exploit this property, we write p ∧ q ∧ r with the associative meaning that it can be read either as ( p ∧ q ) ∧ r or as p ∧ ( q ∧ r ) whichever is the most useful at the time.

  16. 16 A Notational Dilemma (Continued). In order to be able to exploit the transitivity and associativity of equivalence we introduce a second symbol to denote equivalence of propositions. We write p ≡ q with the same meaning as p = q . For booleans p , q and r , the formula p = q = r is read (as usual) conjunctionally, thus ( p = q ) ∧ ( q = r ) . However, an expression of the form p ≡ q ≡ r is read associatively , i.e. as either ( p ≡ q ) ≡ r or as p ≡ ( q ≡ r ) whichever being the most convenient at the time.

  17. 17 Example m + n is even m is even n is even . ≡ ≡ We refer to whether or not a number is even or odd as the parity of the number. Then if we parenthesise the statement as m + n is even ( m is even ≡ n is even ) ≡ it states that the number m + n is even exactly when the parities of m and n are both the same. Parenthesising it as ( m + n is even ≡ m is even ) ≡ n is even it states that the operation of adding a number n to a number m does not change the parity of m exactly when n is even.

  18. 18 Example (Continued) Another way of reading the statement is to use the fact that, in general, the equivalence p ≡ q ≡ r is true exactly when an odd number of p , q and r is true. So the property captures four different cases: ( m + n is even ∧ m is even ∧ n is even ) ∨ ( m + n is odd ∧ m is odd ∧ n is even ) ∨ ( m + n is odd ∧ m is even ∧ n is odd ) ∨ ( m + n is even ∧ m is odd ∧ n is odd )

  19. 19 Axioms Constant true The associativity of equivalence is exploited in almost all of the laws of the propositional calculus. A first example is the law (1) true ≡ p ≡ p . There are two ways to parenthesise this formula. Reading it as true ≡ ( p ≡ p ) , which we write in the form true = ( p ≡ p ) for greater emphasis, the law states that equivalence is a reflexive relation. According to the other parenthesisation, ( true ≡ p ) = p , the law states that true is a unit of the equivalence operator.

  20. 20 Simplifying Continued Equivalences Example: suppose we want to simplify p ≡ p ≡ q ≡ p ≡ r ≡ q . Symmetry of equivalence allows us to rearrange all the terms so that repeated occurrences of “ p ” and “ q ” are grouped together. Thus we get p ≡ p ≡ p ≡ q ≡ q ≡ r . Now we can replace occurrences of “ p ≡ p ” and “ q ≡ q ” by “ true ” obtaining true ≡ p ≡ true ≡ r . Finally, we replace “ true ≡ x ” by “ x ”. The result is that the original formula is simplified to p ≡ r .

  21. 21 Simplifying Continued Equivalences An expression of the form p 1 ≡ p 2 ≡ . . . ≡ p n is simplified by replacing any term that is repeated an odd number of times by a single occurrence of the term, and removing any term that is repeated an even number of times. Thus, the expression p ≡ p ≡ q ≡ p ≡ r ≡ q ≡ q ≡ r ≡ p is simplified to q . If all terms in the original expression are repeated an even number of times as in, for example, p ≡ p ≡ p ≡ r ≡ q ≡ q ≡ r ≡ p the expression reduces to true . Compare continued addition. The expression p + p + q + p + r + q + q + r + p is simplified to 4p + 3q + 2r .

  22. 22 Exercise 2 Simplify the following. (a) p ≡ p ≡ p ≡ p ≡ p (b) p ≡ true ≡ q ≡ p (c) q ≡ p ≡ q ≡ p ≡ q ≡ p (d) false ≡ false ≡ false (e) p = p = p (f) ( false ≡ false ) = false = false (g) ( p = p ) = p = p ✷

  23. 23 Negation ¬ p ≡ p ≡ false . (3) Reading this as ¬ p = ( p ≡ false ) it functions as a definition of negation (denoted by the prefix operator “ ¬ ”). Reading it the other way: ( ¬ p ≡ p ) = false it provides a way of simplifying propositional expressions. In addition, the symmetry of equivalence means that we can rearrange the terms in a continued equivalence in any order we like. So we also get the property: p = ( ¬ p ≡ false ) .

Recommend


More recommend