logic for computer science transparency no. 3.2-1 chapter 3 propositional logic 3.2 the semantics

65
Logic for Computer Science Transparency No. 3.2- 1 Chapter 3 Propositional Logic 3.2 The semantics

Post on 19-Dec-2015

236 views

Category:

Documents


0 download

TRANSCRIPT

Logic for Computer Science

Transparency No. 3.2-1

Chapter 3

Propositional Logic

3.2 The semantics

Propositional Logic: semantics

Transparency No. 3.2-2

Interpretations and (truth) valuation

Def 3.1: An interpretation I for PL0 is a truth-assignment for PV, i.e., a mapping from PV to the truth set {0,1}. For each propositional variable p, if I(p) = 1, we say p is true; ot

herwise (I(p)=0), p is said to be false.

Note: Some textbooks use the term truth assignment, and we use the term interpretation. Both terms can be used interchangeably.

Def 3.2: A truth valuation V is a function which assign to each wff A a unique truth value V(A) s.t. the following conditions holds:1. V(~A) = 1- V (A),

2. V (A/\B) = min(V (A), V (B)),

3. V (A\/B)=max(V (A), V (B)),

4. V(A->B)= V (~A \/B) = max(1- V (A), V (B)),

5. V (A <-> B) = 1 iff V (A)= V (B)

Propositional Logic: semantics

Transparency No. 3.2-3

Equivalence of truth assignment and valuation

Theorem 3.3’: Every truth assignment I can be extended to one and only one truth valuation V.

pf: 1. existence: by ind. and unique readability of wffs.

2. uniqueness: Let V1 and V2 be two valuations extending I.

assume V1(A) V2(A) for some A.

a simple case analysis shows that such A does not exists, so V1 = V2. QED

Theorem 3.3’’: Let V1 and V2 be two valuations, then V1 = V2 iff

V1|PV = V2|PV

Corollary 3.3: There is one-one correspondence b/t truth assignments and truth valuation.

Note: By corollary 3.3, we can use truth valuation or truth assignment as the formal tool to define the meaning of wffs.

Propositional Logic: semantics

Transparency No. 3.2-4

Truth table

A B ~A A/\B A\/B A->B A<->B

0 0 1 0 0 1 1

0 1 1 0 1 1 0

1 0 0 0 1 0 0

1 1 0 1 1 1 1

•The meaning of logical connectives can be represented by a truth table.

Propositional Logic: semantics

Transparency No. 3.2-5

Truth-conditions of wffs in interpretations

Definition of |= (The satisfaction relation) 1. I |= p, where p is a propositional variable, if I(p) = 1.

2. I |= (A /\ B) if I |= A and I |= B.

3. I |= A \/ B if I |= A or I |= B.

4. I |= A-> B if I |= B whenever I |= A.

5. I |= A B if I |= A ->B and I |= B -> A

6. I |= ~A if it is not the case that I |= A.

Note: (1~6) can be simplified to:

I |= A iff V(A) = 1 where V is the unique truth valuation extending I.

7. If is a set of formula then I |= iff I |= A for each A in .

Note: I |= {} for any I. Why?

If I |= A, we say I is a model of A or A is satisfied( or true) at I or I satisfies A.

Propositional Logic: semantics

Transparency No. 3.2-6

Other usual connectives

Besides ~,/\,\/,-> and <->, there are also some other connectives as you have known in digital system.

xor, nand, nor. Rules: I(A xor B)= I(~(A<->B))=1 iff not I(A)=I(B) I(A nand B) = I(~(A/\B)). I(A nor B) = I(~( A \/B)).

Propositional Logic: semantics

Transparency No. 3.2-7

Logical consequence relations

• Logical consequence relation (|=)– Given a (possibly infinite or empty) set of formulas

{A1,A2,...,An,...} and a formula A,we say A is a logical consequence of in symbols,

if. for any interpretation I, if all formulas in are true in I, then

A is true in I

– i.e., for all I, if I |= Ai for every Ai in , then I |= A.

– I.e, Every model of is a model of A.

– notation:

|= A is abbreviated as A1,...,An |= A if is finite.

2. |= A is abbreviated as |= A.– Note: Both the satisfaction relation and the logical consequence relation

are denoted by the same symbol |=.

Propositional Logic: semantics

Transparency No. 3.2-8

Other logical notions:

A,B: wffs, : a set of formulas A and B are logically equivalent (A B) iff

A |= B and B |= A. i.e., for al linterp. I, I(A) = I(B).

A is said to be satisfiable iff A has a model. i.e.,A is true in some interpretation If A is not satisfiable -> A is said to be unsatisfiable.

A is said to be valid iff every interpretation is a model of A (i.e., A is true in all interpretations). notation: |= A

is satisfiable iff there is an interpretation satisfying all wffs in . is valid iff all interpretations satisfy all wffs of .

Logic for Computer Science

Transparency No. 3.2-9

Chapter 3 Propositional Logic

3.3 Some Properties of Propositional Logic

Propositional Logic: semantics

Transparency No. 3.2-10

Properties of propositional logic

A,B: wffs; : a set of wffs

1. A B iff |= A <->B

2. A |= B iff |= A B.

|= A iff ~A is unsatisfiable

3. if is finite. then

|= A iff /\ |= A iff |= /\ -> A.

4. , A |= B iff {A} |= A -> B. [deduction theorem] Notes:

1. /\ =def the conjunction of all wffs of .

e.g., /\{A,B,C} = A /\ B /\ C.

2. , A abbreviates U {A}. Proof: 1~3: left as exercises

Propositional Logic: semantics

Transparency No. 3.2-11

Proof of the (propositional) deduction theorem:

Proof:

(=>) : Let I be any interp. s.t, I |= / {A}.

If I|= A, then I |= U . Hence I |= B (since ,A |= B)

As a result I |= A -> B and / {A} |= A ->B.

(<=) : Let I be any interp. s.t., I |= U {A}.

Since / {A} |= A->B and I|= / {A}, I |=A->B.

Since I |= A, I |= B.

So ,A |= B. QED

Propositional Logic: semantics

Transparency No. 3.2-12

Substitution theorem

Theorem: If C D then A[p/C] A[p/D], where p is an atom occurrence (or nonoccurrence) in A and A[p/C] ( resp. A[p/D]) is the result of replacing the occurrence p in A by C if p does occurs in A.

Example: If A[p]= p \/ (q /\ ~r), then since ~(p /\q) <=> (~p \/ ~q), => A[p/ ~(p/\q)] = ~(p/\q) \/ (q /\~r)) <=> A[(p/ (~p\/~q)] = (~p \/~q) \/ (q /\ ~r))Pf: Lem 1: for any interp. I, I(C) = I(D) => I(A[p/C]) = I(A[p/D]). Now for any I, since C<=>D, I(C) = I(D). And by lem1, I(A[p/C]) = I(A[p/D]), so A[p/C] <=> A[p/D]. Lem 1 is proved by ind on the structure of A. Case 1: A is the occurrence p => I(A[p/C]) = I(C) = I(D) = I(A[p/D]).

A is an atom but not the occurrence p -> I(A[p/C]) = I(A) =I(A[p/D]). Case 2: A = E @ F, where @ is either /\,\/,-> or <->. Then

I(A[p/C]) = F@(I(E[p/C]), I(F[p/C])) = F@(I(E[p/D]),I(F[p/D])) = I(A[p/D]). Case 3: A = ~E. Similar to case 2. QED

Propositional Logic: semantics

Transparency No. 3.2-13

Simultaneous substitution theorem

If C1 D1, C2 D2,…,Ck Dk then

A{pi/Ci | i > 0 } A {pi/Di | i > 0}, where A{pi/Ci} is the result of replacing occurrence (or nonoccurrence) pi (0< i < k+1) in A by the corresponding Ci.

Pf: by induction on the structure of A. Similar to previous theorem.

[Multi-substitution thoerem :] If C D then A{p/C} A{p/D}, where A{p/C} is the result of replacing all occurrences of p in A by C.

Pf: Let p1,p2,…, pk be all occurrences of p in A.

Then A{p/C} = A{pi/C | i > 0} = A{pi/ D} = A{p/D}. qed

Propositional Logic: semantics

Transparency No. 3.2-14

P /\ T <=> P P \/ F <=> P P \/ T <=> P /\ F <=> ~(~P) <=> P \/ Q <=> P /\ Q <=> P \/ (Q \/ R) <=> P /\ (Q /\ R) <=> =-> P /\ (Q /\ R) = (P/\Q/\R) P /\(Q \/ R) <=> P \/(Q /\ R) <=> =-> ~(P1 /\ P1/\.../\Pn) <=>

Other important logical equivalences

• Identity law

• Domination law

• Double negation

•Commutative

•associative

•DeMorgan’s law

Propositional Logic: semantics

Transparency No. 3.2-15

Extend PL0 to allow for more connectives In PL0,

~: {0,1} -> {0,1} =-> unary(1-ary) connective. /\, \/, ->, <-> : {0,1}2 -> {0,1} =-> binary(2-ary) connectives T, F : {} -> {0,1} =-> nullary (0-ary) connective

We say that the meaning of an n-ary connective c is defined by an n-ary truth function (or truth-table) f if I((c A1,...,An) ) = 1 iff f( I(A1),...,I(An)) = 1 for all wff A1,..,An. Ex: What truth-functions are /\,<->,~, etc. defined ?

In general we can extend PL0 by preparing a connective Cf for each n-ary truth function f:{0,1}n->{0,1} with the syntactic rule:

If A1,A2,...,An are wffs then so are (Cf,A1,...,An) --- prefix notation. and the semantical rule:

I((Cf A1,...,An)) = 1 iff f(I(A1),...,I(An)) = 1.

Propositional Logic: semantics

Transparency No. 3.2-16

Definability of connectives C: a set of connectives c: a n-ary logical connective whose meaning is defined by a truth-functi

on f:{0,1}n -> {0,1}. c is said to be definable in C (by the formula A), iff

(c,p1,...,pn) A[p1,...,pn;q1,q2,..,qm], (i.e., I((c,p1,…,pn)) = I(A) for all I.)

where A is a wff A[p1,p2,...,pn ;q1,q2,..,qm] containing connectives from C and atoms from {p1, p2, ..., pn ,q1,q2,..,qm}.

Examples: 1. T (true) can be defined by (q1 \/ ~q1) in {~, \/}

Since I(T) = 1 = I( q1 \/ ~q1) for all interp. I.

2. \/ can be defined by {/\, ~}, since (p1 \/ p2) ~(~p1 /\~p2) 3. <-> can be defined by {->, /\} , since (p1 <-> p2) (p1 ->p2) /\ (p2 -> p1) 4. -> can be defined by {~, /\}, since p1 -> p2 ~(p1 /\ ~p2) 5. ~, \/ can be defined by { NAND } since ~p1 (NAND p1 p1) ; (p1 \/ p2) (nand (nand p1 p2) (nand p1 p2))

Propositional Logic: semantics

Transparency No. 3.2-17

Functional completeness

Definition: A connective c in a set of connectives C is said to be independ

ent if it cannot be defined by other connectives of C; If c is not independent, it is said to be redundant.

A set of connectives C is said to be functionally complete iff all connectives (of any arity ) can be defined by C.

Example: In PL0, C = {/\, \/, ~, ->, <-> }, and all connectives but ~ are re

dundant. It can be proven that {~, /\, \/} is functionally complete and redu

ndant. In logic, it is desirable to have a set of connectives that are b

oth functionally complete and independent.

Propositional Logic: semantics

Transparency No. 3.2-18

Functional completeness (cont'd) Propositions: 1. If C is functionally complete and c in C is redundant, then C / {c} is funct

ionally complete. 2. There are ? inequivalent 0-ary (1-ary, 2-ary) connectives. 3. All binary-connectives can be defined by {/\,\/,~,->,<->}. 4. If C can define all binary connectives, then it is functionally complete.

Intuition: c: n-ary connective => (c, p1,..,pn) <=> let A be the SOP of (c, p1,..pn) => A <=> c(p1,..pn) => c can be defined by a formula containing { ~,/\,\/ } only.

Ex: let ternary connective c be given by the semantical rule: I((c,p1,p2,p3)) = 1 iff |{pi | I(pi) = 1}| is odd. => (c p1,p2,p3) <=> (p1/\p2/\p3) \/ (p1 /\ ~p2/\~p3) \/ ... 5. The following sets of connectives are functionally complete and indepen

dent. {/\,~} , {~,\/}, {~,XOR}, {~,<->}, {~, ->}, {NAND}, {NOR}, {F, ->}.

Logic for Computer Science

Transparency No. 3.2-19

Chapter 3.4 Normal forms for propositional logic

Propositional Logic: semantics

Transparency No. 3.2-20

Normal forms: CNF Literals:

Every wff of the form p or ~ p, where p is a propositional variables.

Literal p and ~p are said to be complementary (to each other) Clause (disjunction; disjunctive formula)

Every wff of the form: L1 \/ L2 \/ L3\/...\/ Ln, where n 0 and each Li is a literal. note: empty clause (n=0) is denoted [] or {} and has truth value “false”

since you cannot find one literal that is true. usually we use set notation {L1,L2,…,Ln} to represent a clause.

CNF (conjunctive normal form) A wff is in cnf iff it is a conjunction of clauses. e.g., A = (p1\/p2) /\ (p2/\~p3) /\ (p3\/~p1) has 3 clauses again, we usually use set of clauses to represent its conjunction. Empty set of clauses {} is interpreted as true since you cannot fi

nd one clause that is false.

Propositional Logic: semantics

Transparency No. 3.2-21

Normal form (DNF) A formulas is said to be in DNF iff it is a disjunction of conjun

ctions of literals. 1. e.g. p1 /\ p2/\~p4, p3 /\ ~p1, p2 /\p3 are conjunctions

of literals.

-> A = (p1 /\ p2) \/ (p3 /\ ~p1) \/ (p2 /\p3) is a disjunction

of 3 conjunctions of literals.

-> A is in DNF (i.e., POS) Notes:

1. In digital system, DNFs are used more often, while

2. in logic, CNFs are used more popularly. why?

Fragments of knowledge are usually partly collected and they are usually conjunctive information.

3. In the field of automated reasoning (or theorem proving), formulas in cnf form are usually represented as sets of sets of literals (clausal form).

eg: (p1\/~p2) /\ (~p3 \/ p2) /\ p1 ==> { {p1,~p2}, {~p3,p2}, {p1}}.

Propositional Logic: semantics

Transparency No. 3.2-22

Determining properties of CNFs and DNFs

A CNF wff is valid iff each of its clauses contains complementary literals. Ex: (p1 \/~p1\/p2) /\ (p3 \/p2\/~p2) /\ (p1 \/~p1)

A DNF wff is satisfiable iff some of its conjunctions contains no complementary literlas. Ex: (p1/\ ~p1 /\ p3) \/ (p3 /\p2/\~p2) \/ (p3 /\~p1) (p1/\ ~p1 /\ p3) \/ (p3 /\p2/\~p2) \/ (p3 /\~p1 /\~p3)

Propositional Logic: semantics

Transparency No. 3.2-23

Transforming wffs into normal forms

Theorem: Every wff is logically equivalent to a wff in CNF and a wff in DNF.

Rules: (for converting wffs into cnfs) 1. removing -> and <-> A -> B ~A \/ B A <->B (~A \/B) /\ (~B \/A) 2. negation in: ~~A A ; ~(A /\ B) ~A \/ ~B ~(A \/B) ~A /\ ~B 3. Distribute \/ over /\ (/\-out and \/-in) A \/ (B /\ C) (A \/ B) /\ (A \/ C)

Propositional Logic: semantics

Transparency No. 3.2-24

Transforming wffs into dnfs

Rules: (for converting wffs into dnfs) 1. removing -> and <-> A -> B ~A \/ B A <->B (~A \/B) /\ (~B \/A) 2. negation in: ~~A A ; ~(A /\ B) ~A \/ ~B ~(A \/B) ~A /\ ~B 3. Distribute /\ over \/ (\/-out and /\-in) A /\ (B /\ C) (A /\ B) \/ (A /\ C)

Propositional Logic: semantics

Transparency No. 3.2-25

Examples:

1. Transform (p \/ ~q) -> r into cnf and dnf:

2. Transform (p->q) /\ ~q -> ~p into dnf and cnf.

Propositional Logic: semantics

Transparency No. 3.2-26

Formulate problems by PL0

The pigeon-hole principle: If n+1 objects are put into n holes, then there must exi

st a hole containing more than 1 objects. Proof: (by contradiction)

Let xi be the number of objects stored in hole i.

Assume no hole contains more than 1 objects (i.e., xi 1)

Then xi n < n+1 = xi, a contradiction.

Hence there must exist one hole containing more than 1 objects.

2-pigeon-hole principle: If 3 objects are put into 2 holes, then there must exist a hole contain more than 1 objects.

Propositional Logic: semantics

Transparency No. 3.2-27

Pigeon-hole principle Formalization: OBJ = {a, b, c}; Hole = {1,2} Let atom "xy" mean object x is stored in hole y. The Premises: 1. Every object must be put into a hole: A1 = (a1 \/ a2) /\ (b1 \/ b2) /\ (c1 \/ c2) 2. Every object cannot be stored in more than one hole: A2 = (a1 -> ~a2) /\ (a2 -> ~a1) /\ (b1 -> ~b2) /\ (b2 ->~b1)/\ (c1->~c2)/\(c2->~c1) The conclusion:

Hole 1 contains more than 1 objects : B1 = (a1 /\ b1) \/ (a1 /\ c1) \/ (b1 /\ c1) OR Hole 2 contain more than 1 objects: B2 = (a2 /\ b2) \/ (a2 /\ c2) \/ (b2 /\ c2)

Reformulation of the problems: If A1, A2 and A3 are true, then so are B1 \/ B2. I.e., A1,A2, A3 |= B1 \/ B2.

Logic for Computer Science

Transparency No. 3.2-28

Chapter 3.5 Proof theory for propositional logi

c

Propositional Logic: semantics

Transparency No. 3.2-29

Proof theory for propositional logic

What is a calculus? a game of finite objects Allow certain objects to be derived, deduced or proved

from known objects. Objects that can be initially written down are either a given

set of objects M or axioms of the calculus Notation: // A means A is an axiom Besides axioms, there are so called inference rules which

allow us to derive new objects from known derived objects. Notation: Each rule has the form:A1,...,An // B ( n 0)

meaning that if A1,...,An have been derived, then B can also be derived. A1,.,.An are called premises and B its conclusion of the rule.

Propositional Logic: semantics

Transparency No. 3.2-30

Example Calculus Consider a calculus with the following axioms and inference ru

les: ax: // a, //b r1: a//aa, b//ba, aa//aaa, ab//aba,..., r1': A// Aa (rule schema of r1) r2: a, b// bb

then we can get a sequence of derived objects as follows: 1. a ax 2. b ax 3. bb 1,2,r2 4. aa 1,r1 5. aaa 4,r1 6. aaaa 5,r1, ...

Propositional Logic: semantics

Transparency No. 3.2-31

More example of calculus:

The N calculus: ax: // 0 r1: A // sA, where A is any object

Then sss0 can be derived (proved, deduced) since there is a proof (derivation) of sss0: 0 s0 ss0 sss0

The Even calculus: ax: //0 r1: A// ssA, where A is any object. ==> ssss0 can be derived : 0, ss0, ssss0.

Propositional Logic: semantics

Transparency No. 3.2-32

Calculus: a formal definition

also called "formal system" or "proof system". A calculus C over an alphabet consisting of a finite number

of rules (schemas), each one of a certain arity n. A rule of arity n is a set of n+1 tuples (A1,...,An,B) of strings over . Each sequence (A1,...,An,B) in a rule is called an instance of that rule, with premises A1,..,An and conclusion B.

Some of 0-ary rules are called axiom schemas and their instances are called axioms.

Note: in general each rule must be a decidable set of n+1 tuples. I.e., There are programs that can determine whether a given se

quence (a1,..,am) is in the set.

Propositional Logic: semantics

Transparency No. 3.2-33

Some rules of Inference in PL0

A rule of inference is usually represented as a tuple consisting of one set of sentence patterns, called premises, and a second set of sentence patterns, called conclusions. A -> B A->B A A->B A ~B B A B A /\ B ------ -------- ----------- --------- ----------- ------- ---------- B ~A (A /\ B ) (A \/ B) A A->A B

An instance of a rule of inference is a rule in which all metavariables (A,B,C,...) have been consistently replaced by expressions in such a way that all premises and conclusions are wffs. Raining -> Wet Wet -> Slippery p->(q->r) (p->q)->r Raining Wet p (p->q) -------------- -------------- --------------- -------------

Wet Slippery q->r r

Propositional Logic: semantics

Transparency No. 3.2-34

What is a proof

C: a calculus over ; s: a string (or wff) over ; M: a set of strings over . A proof (or deduction or derivation) in C from M is a sequen

ce of strings D1,...,Dm (m >0) in which each Di ( 0 < i < m +1) is either: 1. a premise ( i.e., a member of M) or 2. there is an instance (A1,...,An,B) of a rule r of C s.t.

{A1,...,An} {D1,..,Di-1} and B = Di.

note: Di is said to be obtained by applying the rule r

on A1,..,An.

If Dm = s, we say the deduction D1,...,Dm is a proof (deductio

n, derivation) of s in C from M.

Propositional Logic: semantics

Transparency No. 3.2-35

An example deduction M: {p ->q, q->r} Axiom schemas:

A1. A ->(B ->A)

A2. (A->(B->C)) ->((A->B) ->(A->C)) Rule of inference: MP: A, A->B // B A deduction of p->r from M in the calculus C:

1. p -> q Premise

2. q -> r Premise

3. (q -> r) -> (p -> (q -> r)) A1

4. (p -> (q -> r)) MP:2,3

5. (p -> (q -> r)) -> ((p -> q) -> (p -> r)) A2

6. ((p -> q) -> (p -> r)) MP:4,5

7. (p -> r) MP:1,6

Propositional Logic: semantics

Transparency No. 3.2-36

Sample Proofs (cont'd)

When it is raining, the ground is wet. When the ground is wet, it is slippery. It is raining. Prove that it is slippery. 1. Raining -> Wet Premise 2. Wet -> Slippery Premise 3. Raining Premise 4. Wet MP:1,3 5. Slippery MP:2,4

Bad Proof When it is raining, it is cloudy. When it is raining, the groun

d is wet. Prove that, if it is cloudy, the ground is wet. 1. Raining -> Cloudy Premise 2. Raining -> Wet Premise 3. Cloudy -> Wet ?

Propositional Logic: semantics

Transparency No. 3.2-37

Provability in a Calculus

A wff A is provable(deduciable,derivable) from a set of sentences M (written M |-C A) if and only if there is a finite proof of A from M in C.

Notes: The subscript c in |-C may be omitted for convenience if it does not result in confusion.

Properties of the provability relations:1. If Mi |-C Ai (for i = 1,..,n) and (A1,..,An, B) is an instance of a rule

of C, then U Mi |-C B.

2. If M1 |- A and M2 U {A} |- B, then M1 U M2 |- B. --- cut rule

Pf: 1. Let i, Ai be a proof of Ai from Mi.

Then 1,A1, 2,A2,…, n,An, B is a proof of B from UMi.

2. Let 1, A be a proof of A from M1. and 2, B a proof of B from M2. Then 1, A, ’2,B is a proof of B from M1UM2., where ’2 is the resulting sequence of 2 with all A’s removed. qed

Propositional Logic: semantics

Transparency No. 3.2-38

Soundness and completeness of a calculus w.r.t a logical consequence relation

|= : a (semantical) logical consequence relation

|-C : a provability relation for a calculus C.

Note: Both the provability relation |-c and the logical consequence relation |= are a relation between 2Wff and wffs.

The calculus C is said to be sound (w.r.t |=) iff |-c is a subset of |=.

I.e., for all wff set M and wff A, M|-c A implies M |= A.

The calculus C is said to be complete if |= is a subset of |-C,

(i.e., for all M, A, M|= A implies M |-C A. If C is both sound and complete, we said C is a correct characterization

(or axiomatization) of |=. It is the work of logic to derive correct axiomatization of known logical c

onsequence relation.

Propositional Logic: semantics

Transparency No. 3.2-39

A Hilbert calculus H for PL0

Axiom schemas Ax1: A -> (B -> A) Ax2: (A -> (B -> C)) -> ((A -> B) -> (A -> C)) Ax3: (~A->~B) -> (~B->~A)

Definitions Ax4: (A<->B) -> (A->B) Ax5: (A<->B) -> (B->A) Ax6: (A->B) -> ((B->A) -> (A<->B) Ax7: (A \/ B) -> (~A->B) Ax8: (~A ->B) -> (A \/B) Ax9: (A /\ B) -> ~(A ->~B) Ax10: ~(A ->~B) -> (A /\ B)

Inference rules: Modus Ponens (MP): from A, A->B infer B.

Note: A4~A10 are not needed if we restrict formulas to those containing connectives from {~,->} only.

Propositional Logic: semantics

Transparency No. 3.2-40

Some proofs in H

Ex 1: Show that |-H A->A for any wff A.

1. (A->((A->A)->A)) -> ((A->(A->A))->(A->A)) Ax2

2. (A ->((A->A)->A) Ax1

3. (A ->(A->A)) ->(A->A) 1,2,MP

4. (A ->(A->A)) Ax1

5. (A->A) 3,4,Mp

Propositional Logic: semantics

Transparency No. 3.2-41

Soundness of H Theorem 3.1: For any wff A and any set of wffs M, if M |-H A then M |= A. Lem 3.2: All instances of Ax1 ~Ax10 are valid.I.e., |= A for any

instance A of Ax1,Ax2 or Ax3. pf: (only Ax1 and Ax2 are proved) 1. By truth-table (omitted). 2. Let I be any interp. If I |= A, then I |= B->A. Hence I |= A->(B->A) If I |= (A->(B->C)) then If I |= A->B then If I |= A then ( I |= B and I |= B->C) then I |= C hence I |= A->C hence I |= (A->B) -> (A->C) hence I |= (A-(B->C)) ->((A->B)->(A->C)) QED

Propositional Logic: semantics

Transparency No. 3.2-42

Soundness of H (cont'd) Lem 3.3: The inference rule MP preserves logical consequence. I.e., If

M|= A and M|= A-> B then so is M |= B. Pf: Trivial. Left as an exercise.

Pf: (of Theorem3.1) The proof is by induction on the length n of the deduction of A. Case 1: n = 1. then = A and either 1.1 A is an instance of Ax1~Ax10.By Lem 3.2 |= A, so M |= A. or 1.2 : A is a member of M. Then M |= A. Case 2.1 : A is obtained from B, and B->A by MP. By ind. hyp. M |= B and M |= B->A. ( since the deductions of B and B->A)

are shorter than that of A. Hence if I is any model of M, we have I |= B and I|= B->A. As a result I |= A. So M |= A. Case 2.2: A is an instance of Ax1~AX10 or a member of M: same as Case

1. QED

Propositional Logic: semantics

Transparency No. 3.2-43

Deduction theorem in H Theorem 3.2 [deduction theorem]

M, A |-H B iff M |-H A-> B. Pf: <=: Let D1,..,Dm=A->B be any deduction of A->B from M. Then D1,..,Dm, A, B is a deduction of B from M U {A}. =>: Let D1,..,Dn = B be any deduction of B from M U {A}. If n =1, then case 1: B is an axiom schema or B M. => B, B->(A->B), A->B is a proof of A->B from M. case 2: B = A. => |- A->B => M |- A->B. If n >1. Then case 3: there are Di, Dj=Di->B and B is obtained from Di,Dj by MP. => by ind.hyp. M |- A-> Di and M |- A->(Di->B) => (A->(Di->B)) ->((A->Di)->(A->B)), 1, 2, (A->Di)->(A->B), A->B is a de

duction of A->B from M. where 1 (2) are deductions of A->Di and A->Dj) from M, respectively.

case 5, 6: Dn is an axiom schema or a member of M. Similar to case 1,2. QED

Propositional Logic: semantics

Transparency No. 3.2-44

The benefit of deduction theorem

Problem: {P -> Q, Q -> R} |- P -> R Without Deduction Theorem:

1. P -> Q Premise 2. Q -> R Premise 3. (Q -> R) -> (P -> (Q -> R)) Ax1 4. (P -> (Q -> R)) MP:2,3 5. (P -> (Q -> R)) -> ((P -> Q) -> (P -> R)) Ax2 6. ((P -> Q) -> (P -> R)) MP:4,5 7. (P -> R) MP:1,6

With Deduction Theorem, the problem reduces to the following: {P -> Q,Q -> R, P} |- R

1. P -> Q Premise 2. Q -> R Premise 3. P Premise 4. Q MP:1,3 5. R MP:2,4

Propositional Logic: semantics

Transparency No. 3.2-45

Other Metatheorems

Rule T: If M|-A1,..., M|-An and {A1,...,An}|- A, then M|-A. M |- (p->q) ---- let 1 be the proof M |- (q->r) ---- let 2 be the proof (p->q),(q->r) |- (p->r) ---- 3 M |- (p->r) ---- ==>1,2,3 prove p->r.

Contraposition: M, A |- ~B iff M,B |- ~A. p->q, q->~r, p |- ~r iff p->q, q->~r, r |- ~p

Pf:(use concepts introduced later)

M, A |- ~B iff M U { A, B} is inconsistent

iff M, B |- ~A.

Propositional Logic: semantics

Transparency No. 3.2-46

Working with H

Lemma 3.4: The following formulas can be derived from H. 1. |- (A ->(B->B))2. |- (A->B) ->((B->C) ->(A->C))3. |- ~~A ->A4. |- A ->~~A5. |- (A->B) ->(~B->~A)6. |- (A->(~B->~(A->B))7. |- (~A-> (A ->B))8. |- ~(A->B) -> A9. |- ~(A->B) ->~B10. |- (A->~A) -> ~A11. |- (~A->A) -> A12. |- ~(A->A) ->B

Propositional Logic: semantics

Transparency No. 3.2-47

Proofs of some tautologies in H 1. |- (A ->(B->B)) 2. |- (A->B) ->((B->C) ->(A->C)) 3. |- ~~A ->A

(1) A, B |- B iff A |- B->B iff |- A ->(B->B) Try giving your proof w/o using deduction theorem !!(2) A->B, B->C, A |- C : can be proved A->B, B->C |- A->C : DT A->B |- (B->C) ->(A->C) :DT |- (A->B) ->((B->C)->(A->C)) :DT(3) 1. |- ~ ~A ->(~ ~ ~ ~A ->~ ~A) :Ax1 2. ~~A |- ~~~~A ->~~A :DT 3. ~~A |- (~ ~ ~ ~A ->~~A) ->(~A ->~ ~ ~A) :Ax3 4. ~~A |- ~A ->~~~A : MP, 2,3 5. ~~A |- ~A -> ~~~A ->(~~A ->A) : Ax3 6. ~~A |- ~~A ->A : MP,4,5 7. ~~A |- A :DT

8. |- ~~A ->A. :DT

Propositional Logic: semantics

Transparency No. 3.2-48

Proofs of some tautologies in H4. |- A ->~~A 5. |- (A->B) ->(~B->~A) 6. |- A->(~B->~(A->B))(4) 1. |- ~~~A -> ~A (3) 2. |- (~~~A ->~A ) ->(A ->~~A) Ax3 3. |- (A ->~~A) MP, 1,2(5) 1. |- (~~A-> ~~B) -> (~B -> ~A) Ax3 2. |- ~~A -> A (3) 2’. ~~A |- A DT2

3. A->B |- A->B 3’. ~~A, A->B |- B MP2’3

4. A->B |- ~~A -> B DT on 3’ 5. |- B -> ~~B instance of (4)

6. A->B |- ~~A -> ~~B MP+ 4,5 7. A->B |- ~B -> ~A MP 6,1 8 |- (A->B) -> (~B -> ~A) DT 7

Propositional Logic: semantics

Transparency No. 3.2-49

Proofs of some tautologies in H

7. |- (~A-> (A ->B)) 8. |- ~(A->B) -> A 9. |- ~(A->B) ->~B7: 1. |- ~A -> (~B -> ~A) Ax1 2. ~A |- (~B -> ~A) -> (A->B) Ax3

3. ~A |- (A->B) MP + 1,2 4. |- ~A -> (A->B) DT38. 1. |- (~A-> (A ->B)) (7)

2. |- (~A -> (A->B)) -> (~(A->B) -> ~~A) (5) 3. |- ~(A->B) -> ~~A MP: 1,2 4. |- ~~A -> A (3) 5. |- ~(A->B) -> A MP + 3 + 49. 1. |- B -> (A ->B) Ax1 2. |- B->(A->B) -> (~(A->B) -> ~B) (5) 3. |- ~(A->B) ->~B MP +1+2

Propositional Logic: semantics

Transparency No. 3.2-50

Proofs of some tautologies in H

10. |- (A->~A) -> ~A 11. |- (~A->A) -> A 12. |- ~(A->A) ->B

12. ~B |- A A |- AA

|- (AA) ~~(AA) (4)

~B |- ~~(AA) MP

|- ~B ~~(AA) DT

|- ~(AA) B Ax3 + MP

Propositional Logic: semantics

Transparency No. 3.2-51

Consistency and completeness of formula sets

M: a set of formulas M is consistent iff there is no formula A s.t. M|-H A and M |-H ~A.

M is inconsistent if it is not consistent. M is complete if for every formula A, either M |-H A or M|-H ~A.

Theorem 3.3 The following statements are equivalent1. M is consistent

2. There is no formula A s.t. M |-H ~(A->A)

3. There is one formula B s.t. not M |-H B.

Pf: (1=>2:) By contradiction. Assume M |-H ~(A->A) for some A.

==> by lem3.4(8,9): M |-A and M |- ~A => a contradiction!

(2=>3:) trivial. Simply let B = ~(p->p) for some atom p.

(3=>1:) By contraposition. M inconsistent => A s.t. M |-A and M |- ~A

==> by Lem3.4(7): M |- ~A->(A->B), we have M |- B for all wffs B. QED

Propositional Logic: semantics

Transparency No. 3.2-52

Lemma 3.5 (2),(3) M: a set of wffs

2. If M is satisfiable then M is consistent

3. M |-H A iff M U {~A} is inconsistent.Pf: (2) : I: any model of M. If M is inconsistent => M |- p and M |- ~p, => since H is sound, I |= p and I |= ~p => impossible! (3) (=>) : M U {~A} |- ~A; M |- A => M U{~A} |- A => M U {~A} is inconsistent. (<=:): M U {~A} inconsistent => 1. M,~A |- A theorem 3.3 (3) 2. M |- ~A -> A DT 3. M |- (~A ->A) ->A Lem3.4(11) 4. M |- A. 2,3, MP QED

Propositional Logic: semantics

Transparency No. 3.2-53

Extension theorem Lem 3.4: Every consistent set of formulas M can be extende

d to a consistent and complete set of formulas M'. Pf: Let A0,A1,...An,.. be an enumeration of all wffs. [Its existence will be

shown later.] The set M' is constructed as follows:

1. Initially let M0 = M.

2. for i 0, let Mi+1 = Mi if Mi |-H Ai

Mi+1 = Mi U {~Ai} if not Mi |-H Ai.

So we have M0 M1 M2 ...

Now let M' = Ui > 0 Mi.

First show the consistency of Mi for all i >0

the case for M0 is trivial. Let j be the least among all index i s.t. Mi is inconsistent. Now Mj Mj-1 (o/w j is not the least index). hence Mj = Mj-1 U {~Aj-1} and not Mj-1 |- Aj-1. => by lem3.5(3) : Mj is consistent. a contradiction!

Propositional Logic: semantics

Transparency No. 3.2-54

Proof of the Extension theoremSecondly show consistency of M': assume the converse.

=> There is a proof of ~(p->p) from M'.

Let Aj1,..,Ajm in M' be all premises used in the proof.

=> there is one Mk s.t. {Aj1,..Ajm} in Mk => Mk |- ~(p->p)

=> Mk is inconsistent. a contradiction!

Finally show the completeness of M': Let A = Aj be any wff.

If Mj |- Aj => Aj Mj = Mj+1 M'

If not M |- Aj => ~Aj -|Mj+1 M'

=> for all wff A, either M' |- A or M |- ~A => M' is complete. QED FACTS: The set of wffs is enumerable (even if the set of atoms is not finit

e.)

fact 1: if there is an onto mapping from N to an infinite set D, then there is a bijection from N to D.

pf: let f:N->D be any surjection. define g:N->D inductively as g(0) = f(0) and g(n+1) = f(j) where j = min {k > 0 | f(k) {g(0),...,g(n)} }. => g is a bijection. QED

Propositional Logic: semantics

Transparency No. 3.2-55

The enumerability of wffs(cont'd)

Fact 2: there is a 1-1 mapping from wffs to N.Pf: 1. For each pi in PV={p0,p1,... }

let cd(pi) = decimal string representation of 10i.

=> cd(p0) = "1", cd(p3) = "1000", etc.

For x in {/\,\/,~,->,<->,(,) }, define cd(x) to be string 2,3,4,5,6,7,8 for x = ~,/\,\/,->,<->,( and ), respectively.

Now define the mapping gn: wffs -> N by

gn(x1x2...xn) = [ ---- called goedel numbering in honor of Goedel ]

the number k whose decimal representation = "cd(x1) cd(x2).. cd(xn)".

for any wff A = x1x2...xn.

eg: gn( ~(p1 /\ p2)) = 4 7 10 2 100 8.

It is easy to show by induction on length of wffs that gn is 1-1. QED

[pf of main fact: ] Now let f: N -> wff be any function s.t. f(n) = A if gn(A) = n. ==> f is an onto mapping from N to wffs

==> there is a bijection f' from N to wffs => the set of all wffs are enumerable. QED

Propositional Logic: semantics

Transparency No. 3.2-56

Equivalence of Consistency and satisfiability If M is a consistent set of wffs, then M is satisfiable.Pf: let M' be any consistent and complete set of formulas including M. Define an interpretation I by I(p) = 1 if M' |- p and 0 if M' |- ~p. Since M' is consistent and complete, I is well defined. Now we show I is a model of M' (and hence also a model of M) by showing th

at for all wff A, I |= A iff M' |- A.The proof is by structural ind. on wffs A. basis case: A=p: Then I |= p iff M' |- p. Ind. cases: 1. I |= ~A iff not I|=A iff not M' |- A iff M' |- ~A. 2. I |= A->B iff I|= ~A or I|= B iff M' |- ~A or M' |- B iff M' |- A->B. Note:in the last line: M' |- ~A + |- ~A-> (A->B) ==> M' |- A->B. M' |- B + |- B->(A->B) ==> M' |- A->B. M'|- A->B and not M'|- ~A => M |- A ==> M |- B. QED

Corollary: M is consistent iff M is satisfiable.

Propositional Logic: semantics

Transparency No. 3.2-57

Soundness and completeness of H (or equivalence of |- and |=)

M: any set of wffs; A: any wff

then M |-H A iff M |= A.Pf: (=>,soundness): proved in Theorem 3.1. (<=, completeness): by contraposition. not M |- A => M U {~A} is consistent => M U{~A} is satisfiable.Let I be any model of M U {~A}.=> I |= M but not I |= A. Hence not M |= A. QED.

Propositional Logic: semantics

Transparency No. 3.2-58

Compactness of propositional logic

M: a set of wffs. Then M is satisfiable iff every finite subset of M is satisfiable.

Pf:

(=>): trivial since every model of M is a model of all its

subsets.

(<=): M unsatisfiable =>

M inconsistent =>

M |- ~(p->p) =>

finite subset M' of M with M' |- ~(p->p) =>

M' inconsistent =>

a finite subset M' of M is unsatisfiable. QED

Propositional Logic: semantics

Transparency No. 3.2-59

Semantic proof of compactness

Definition: M: an infinite set of wffs. We say M is finitely satisfiable if every finite subset of M is satisfiable.

Lemma: M: a set of wffs; A: a wff. If M is finitely satisfiable then either MU{A} or MU{~A} is finitely satisfiable.

pf: Assume neither MU{A} nor M U{~A} is finitely satisfiable. =>(*) finite sets M1 U {A} M U {A} and M2 U {~A} M U {~

A} that are not satisfiable and A M1 and ~A M2.

=> M1 U M2 is a finite subset of M and is satisfiable.

=> I s.t. I |= M1 and I |= M2 and (I |= A or I |=~A)

=> either I |= M1 U {A} or I |= M2 U {~A}. => either MU{A} or M U {~A} is satisfiable ! (contradicting (*))

qed

Propositional Logic: semantics

Transparency No. 3.2-60

Semantic proof of compactness(cont’d)

Theorem: Let M be an infinite set of wffs. Then M is satisfiable iff M is finitely satisfiable.

Pf: (=>:) trivial since every model of M is a model of every subset of M.

(<=): let D1,D2,… be an enumeration of all wffs. We define in stage a set M in the following ways:

1. M1 = M.

2 M k+1 = Mk U{ pk} if Mk U {Dk} is finitely satisfiable and

= Mk U {~pk} otherwise (MK U {~pk} is finitely satisfiable).

3. Let M = U {Mk | k N}.

It is easy to show that M is finitely satisfiable, o/w unsatisfiable finite subet M’ Mt for some t, impossible!.

Now define interp. I by I(pk) = 1 (0) iff pk M ( ~pk M) for k >0.

=> I is a model of M, o/w let A M be any wff s.t. I |= ~A and let

= { pk | pk occurs in A and I |= pk} U {~pk | pk occurs in A and I I= ~pk}. => |= ~A => U {A} is finite and unsatisfiable.

=> Mj is not finitely satisfiable, where j = max{k | pk or ~pk }. => a contradiction. qed

Propositional Logic: semantics

Transparency No. 3.2-61

Semantic proof of compactness(cont’d)

Theorem: Let M be an infinite set of wffs. Then M is satisfiable iff M is finitely satisfiable.

Pf: (=>:) trivial since every model of M is a model of every subset of M.

(<=): let D1,D2,… be an enumeration of all wffs. We define in stage a set M in the following ways:

1. M1 = M.

2 M k+1 = Mk U{ Dk} if Mk U {Dk} is finitely satisfiable and

= Mk U {~Dk} otherwise (MK U {~Dk} is finitely satisfiable).

3. Let M = U {Mk | k N}.

It is easy to show that M is finitely satisfiable, o/w unsatisfiable finite subet M’ Mt for some t, impossible!.

Now define interp. I by I(pk) = 1 (0) iff pk M ( ~pk M) for all atom pk.

=>Now it is easy to show by ind. that for all wff A, AM iff I |= A. M is sat.∴Basis. A = p: p M∈ => by def. I |= A; p∉M => ~p M∈ =>I(p)=0=>not I |= p.

Ind. 1. A=~B: A M∈ B∉ M not I |= B I |= ~B =A.

2. A=B /\ C: A M∈ B M∈ and C M∈ I|=B and I |= C I |= A.

Propositional Logic: semantics

Transparency No. 3.2-62

Some applications of the compactness theorem

Def: A (strict) poset (S, <) is said to have width at most n if it has at most n distinct elements that are pairwisely incomparable. A chain in S is a subset of S that are linearly ordered.

Theorem E7’: [Dilworth’s theorem]: Every finite poset (S, < ) of width n can be divided into n chains.

pf: can be proven by induction on |S|

Theorem E7: infinite poset (S, < ) of width 3 can be divided into 3 chains (not necessarily disjoint).

Pf: let S = {p1,p2, p3,..}

Let Ai (Bi,Ci) mean pi is in chain A (B, C, respectively).

Let Rij means Pi < Pj.

Then IR = { ~Rii | i >0}, Trans = {Rij /\ Rjk -> Rik | i,j,k > 0}

W3 = {(Rij \/ Rik \/ Ril \/ Rjk \/ Rjl \/ Rkl) | i,j,k,l > 0 }

IR U Trans U W3 says (S, <) is a poset of width ≤ 3.

Propositional Logic: semantics

Transparency No. 3.2-63

Proof of exercise 7:

Let CA = {Ai /\ Aj -> Rij \/ Rji | i j > 0}, CB = ? ; CC= ?

CA,CB and CC say that A, B and C are 3 chains. ABC = {Ai \/ Bi \/ Ci | i > 0} says AU BU C = S.

Theorem E7 says T =def IR U Trans U W3 U CA U CB U CC U ABC is satisfiable.

Let UJ = {Ai, Bi, Ci, Rij | i,j J } J > 0 ; TJ = { T | var(∈ ) U⊆ J }.

Tj says every poset of size J > 0 and with 3 can be divided into 3 chains.

=> Theorem E7’: TJ is satisfiable for all J > 0.

Theorem E7 : T = U J > 0 TJ is satisfiable. Let T’ be any finite subset of T and let J be the least index s.t.,

var(T’) U⊆ J, then T’ T⊆ J.

But since TJ is satisfiable, T’ must satisfiable, too. Hence very finite subset of T is satisfiable and by compactness theore

m, T is satisfiable. qed

Propositional Logic: semantics

Transparency No. 3.2-64

Definability of interpretations (skipped!)

Definition: [definability] K: a set of interpretations. We say K is definable in WFF if there is a set of wffs M such that

K = model(M), (i.e., K = {I | I |= A for all A ∈ M}). K is finitely definable if there is a finite set M of wffs s.t., K = model

(M).

Examples:1. K1 = { I | I |= p1 }. Then K1 = model( ____ ) and is definable.

2. K2 = { I | I |= pj <-> P2j | j > 0 }. Then K2 = model(M) where M = ____ is definable.

3. K = model(M) and K’ = model(M’) then K ⋂ K’ is definable by _____, and K U K’ is definable by _____. {A \/B | A ∈ M,B M’}.∈4. model(M U M’) = ____; model( M ⋂ M’) = ____.

model({fat}U{tall}) = model({fat,tall}); model({f} ⋂ {t}) = model({}) = All Interp.

5. M M’ => model(M) ____ model (M’).⊆

Propositional Logic: semantics

Transparency No. 3.2-65

Definability of interpretations (cont’d) skipped!

KT =def { I | I(p) = 1 for all atom p}. Note that KT is a singleton set and is definable by the set {pi | i > 0 }. show that KT is not finitely definable in WFF.

pf: assume K = model(M) for some finite M. let p be any atom not appearing in M. => I not |= p

Show that if K is finitely definable, then the complement K’ = the set of all interpretations - K is also finitely definable.

Hint: let K = model(M), where M = {A1,…,An} . then K’ is definable by the set ~M = ______ : {~A1 \/ ~A2\/…\/~An }.