130 likes | 261 Views
CA 208 Logic. CA 208 Logic. So far we have been a little bit sloppy ... Because we focused on intuitions ... And that’s important Today we make things a bit more formal: What we have been dealing with so far is “ Propositional Logic ”
E N D
CA 208 Logic • So far we have been a little bit sloppy ... • Because we focused on intuitions ... And that’s important • Today we make things a bit more formal: • What we have been dealing with so far is “Propositional Logic” • We’ll define the syntax of Propositional Logic (i.e. the grammar of formulas in Propositional Logic) • We’ll define the semantics (meaning) of formulas in Propositional Logic
CA 208 Logic • Syntax (Grammar) of Propositional Logic • Defines what is a formula in Propositional Logic and what is not ...
CA 208 Logic • Let Π be a (coutably infinite ...) set of propositional variables Π = {A, B, C, ...} (this is the lexicon, the basic building blocks ..) • If Φ Π, then Φ is a formula (atomic formula) • If Φ is a formula, then Φ is a formula • If Φ and Ψ are formulas, then (ΦΨ) is a formula • If Φ and Ψ are formulas, then (Φ Ψ) is a formula • If Φ and Ψ are formulas, then (ΦΨ) is a formula • If Φ and Ψ are formulas, then (ΦΨ) is a formula • Nothing else is a formula. • Comment: notice that we introduced brackets ( ) ...
CA 208 Logic • Which of the following are formulas of propositional logic, which are not and why ....? • A • B • B • B • (C A) • C A • A B C • A (B C) • (A (B C)) • B • A B
CA 208 Logic • Notion of a parse-tree/derviationtree • (A (B C)) ((A B) C) / \ / \ A C / \ / \ B C A B
CA 208 Logic A string of symbols over Π {,,,,,(,)} is a formula of propositional logic • iff it is constructed by the formation rules (syntax) of propositional logic • iff it has a valid derivation tree
CA 208 Logic • Now the semantics (the meaning M ..) (Alfred) Tarski-style • Let V be a valuation, i.e. an assignment of truth values to each propositional variable in Π: (formally) V: Π {0,1} (V is a total function from Π to {0,1}) • If Φ Π, then M(Φ) = V(Φ) (atomic formula) • M(Φ) = 1 iff M(Φ) = 0, else 0 • M(ΦΨ) = 1 iff M(Φ ) = 1 and M(Ψ) = 1, else 0 • M(Φ Ψ) = 1 iff M(Φ ) = 1 or M(Ψ) = 1, else 0 • M(ΦΨ) = 1 iff M(Φ ) = 0 or M(Ψ) = 1, else 0 • M(ΦΨ) = 1 iff M(Φ ) = M(Ψ), else 0 • Comment: notice that I was a bit slopy here: missed the brackets ( ) ...
CA 208 Logic • So how does this Tarski-style semantics work and how does it compare to the truth tables we have seen earlier on in the course? • A valuation function V effectively defines/describes one row in a truth table • Let V(A) = 1, V(B) = 0. • What is M( (A B) B) )? • M( (A B) B) ) = 1 iff M( (A B) ) = 1 and M( B ) = 1 • M( (A B) ) = 1 iff M( A ) = 1 or M( B ) = 1 • M( A ) = V( A ) = 1, hence M( (A B) ) = 1 • M( B ) = V( B ) = 0, hence it is not the case that M( B ) = 1, hence it is not the case that M( (A B) B) ) = 1, hence M( (A B) B) ) = 0 Note that M is always relative to some particular V! • If Φ Π, then M(Φ) = V(Φ) (atomic formula) • M(Φ) = 1 iff M(Φ) = 0, else 0 • M(ΦΨ) = 1 iff M(Φ ) = 1 and M(Ψ) = 1, else 0 • M(Φ Ψ) = 1 iff M(Φ ) = 1 or M(Ψ) = 1, else 0 • M(ΦΨ) = 1 iff M(Φ ) = 0 or M(Ψ) = 1, else 0 • M(ΦΨ) = 1 iff M(Φ ) = M(Ψ), else 0
CA 208 Logic A valuation function V effectively defines/describes one row in a truth table Let e.g. V(A) = 1, V(B) = 0. Under this V, what is M( (A B) B) )? M( (A B) B) ) = 0
CA 208 Logic • So how does it all hang together? • Truth tables, Tarski-style semantics, situations in which propositions are true ...? • We are talking semantics (meaning) • As opposed to formal proof • Truth tables, Tarski-style semantics, situations in which propositions are true ... all define the meaning of the logical connectives {, , , , }, of the relational logical symbols {, } and the semantic consequence relation |= • Truth tables, Tarski-style semantics, situations in which propositions are true ... are alternative ways of doing the same thing • Truth tables, Tarski-style semantics formalise (i.e. give a compact systematic account of) situations in which propositions are true. • Truth tables, Tarski-style semantics allow us to give formal definitions of such notions as the logical connectives, tautologies, contradictions, contingencies, logical equivalence, logical consequence and the semantic consequence relation ... all in terms of “meaning” • And they allow us to do computation: e.g. check whether {P_1, ..., P_n} |= C ...
CA 208 Logic • Some examples: • A formula P is a tautology iff and only if it is true in all situations iff it comes out true (1) in all cases (rows) in the truth table iff for all valuations V, M(P) = 1 • A formula P is a contradiction iff and only if it is false in all situations iff it comes out false (0) in all cases (rows) in the truth table iff for all valuations V, M(P) = 0 • A formula P is a contingency iff ... • Two formulas P and Q are logically equivalent (P Q )iff they are true in all situations iff (P Q) is a tautology iff(P Q) comes out true (1) in all cases (rows) in the truth table iff for all valuations V, M(P Q) = 1 • ... the Boolean Equivalences .. and you can do computation ... simplification/rewriting .... • Q is a logical consequence of P (P Q)iff in all situations where P is true, then Q is true as well, iff (P Q) is a tautology iff(P Q) comes out true (1) in all cases (rows) in the truth table iff for all valuations V, M(P Q) = 1 • C is a semantic consequence of premises P_1 to P_n ({P_1, ..., P_n} |= C) iff in all situations where all of P_1 to P_n are true, then C is true as well iff (P_1 ... P_n) C iff(P_1 ... P_n) C is a tautology iff(P_1 ... P_n) C comes out true (1) in all cases (rows) in the truth table iff for all valuations V, M((P_1 ... P_n) C ) = 1 • Allows us to do computation/inference: check whether {P_1, ..., P_n} |= C ...
CA 208 Logic • This is all grand, but ... there are some disadvantages to the semantic view of logic in terms of truth tables, Tarski-style semantics and the semantic consequence relation |= defined in terms of these • Truth tables and Tarski-style valuations are exponential in size: 2ⁿ so for n distinct propositional variable (types) you have 2ⁿ rows in te truth table or valuations V. That’s not very efficient – in fact very expensive for large n ... • There is also a view that Logic is not really concerned with the meaning of individual propositions (e.g. in the premises) but it is more about the abstract structure of valid inferencing (irrespective of meaning): {P, Q} |= (PQ) {P, P→Q} |= Q • This leads to the syntactic (proof-theoretic) view of Logic with the syntactic consequence relation |- which is defined just in terms of symbol manipulation, without recourse to “meaning” (semantics). • Logic as a calculus: Propositional Calculus, (First Order) Predicate Calculus ... • Of course, in the end |= and |- are just flip sides of each other (at least for the basic classical or “well behaved”logics), as we’ll see later on ... • This means that what you can do in the one |= you can do in the other |-, and vice versa (soundness and completeness) ...