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

equational logic part 1
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

1

Equational Logic. Part 1

Roland Backhouse February 6th, 2001

slide-2
SLIDE 2

2

Outline

  • The Logical Connectives.
  • Properties of Equality.
  • Properties of Equivalence.
  • Negation
slide-3
SLIDE 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.

slide-4
SLIDE 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.

slide-5
SLIDE 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.

slide-6
SLIDE 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 .

slide-7
SLIDE 7

7

Truth Tables

p true p ¬p false true true true false false false true false true false p = q p = q p q true p ≡ q p ≡ q p ∧ q p ∨ q 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

slide-8
SLIDE 8

8

Equality of Booleans

p = q p q p ≡ q true true true true false false false true false false false true

slide-9
SLIDE 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

  • r exploiting equivalences. One of the mathematical skills I want to

convey is reasoning with equivalences.

slide-10
SLIDE 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 .

slide-11
SLIDE 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).

slide-12
SLIDE 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.
slide-13
SLIDE 13

13

Equivalence is Associative!

For all booleans p, q and r, ((p= q) = r) = (p = (q= r)) .

slide-14
SLIDE 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.

slide-15
SLIDE 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

  • r as

p∧ (q∧ r) whichever is the most useful at the time.

slide-16
SLIDE 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

  • r as

p≡(q≡r) whichever being the most convenient at the time.

slide-17
SLIDE 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.

slide-18
SLIDE 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

  • f 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)

slide-19
SLIDE 19

19

Axioms

Constant true

The associativity of equivalence is exploited in almost all of the laws

  • f the propositional calculus. A first example is the law

true ≡ p ≡ p . (1) 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.

slide-20
SLIDE 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”

  • btaining

true ≡ p ≡ true ≡ r . Finally, we replace “true≡x” by “x”. The result is that the original formula is simplified to p ≡ r .

slide-21
SLIDE 21

21

Simplifying Continued Equivalences

An expression of the form p1 ≡ p2 ≡ . . . ≡ pn 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 .

slide-22
SLIDE 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 ✷

slide-23
SLIDE 23

23

Negation

¬p ≡ p ≡ false . (3) Reading this as ¬p = (p≡false) it functions as a definition of negation (denoted by the prefix

  • perator “¬”). 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) .

slide-24
SLIDE 24

24

Simplification

To simplify ¬p ≡ p ≡ q ≡ ¬p ≡ r ≡ ¬q . begin by rearranging all the terms so that repeated occurrences of “p” and “q” are grouped together. ¬p ≡ ¬p ≡ p ≡ q ≡ ¬q ≡ r . Now use (1) and (3) to reduce the number of occurrences of “p” and “q” to at most one (possibly negated). true ≡ p ≡ false ≡ r . Finally, we use (1) and (3) again. The result is that the original formula is simplified to ¬p ≡ r . Compare simplification of p+(−p) +q+(−p) +r + q+(−q) +r + p to q+ 2r .

slide-25
SLIDE 25

25

Some Rules

¬false ≡ true . (4) ¬(p≡q) ≡ p ≡ ¬q . (5) p ≡ q ≡ ¬p ≡ ¬q . (6)

slide-26
SLIDE 26

26

Example Calculation.

The propostion ¬(p≡q) is usually written p ≡ q. The operator is called inequivalence (or exclusive-or, abbreviated xor). As a final worked example we show that inequivalence associates with equivalence: (p ≡ q) ≡ r = { expanding the definition of p ≡ q } ¬(p≡q) ≡ r = { ¬(p≡q) ≡ p ≡ ¬q } p ≡ ¬q ≡ r = { the law (5) is applied in the form ¬(p≡q) ≡ ¬q ≡ p with p,q := q,r } p ≡ ¬(q≡r) = { definition of q ≡ r } p ≡ (q ≡ r) .

slide-27
SLIDE 27

27

Exercise 7 Simplify the following. (Note that in each case it does not matter in which order you evaluate the subexpressions. Also rearranging the variables and/or constants doesn’t make any difference.) (a) false ≡ false ≡ false (b) true ≡ true ≡ true ≡ true (c) false ≡ true ≡ false ≡ true (d) p≡p≡¬p≡p≡¬p (e) p ≡ q≡q≡p (f) p ≡ q≡r ≡p (g) p≡p ≡ ¬p ≡ p≡¬p (h) p≡p ≡ ¬p ≡ p≡¬p ≡ ¬p ✷