Professional Documents
Culture Documents
Mahesh Viswanathan
vmahesh@cs.uiuc.edu
3232 Siebel Center
Spring 2012
1.1
Introduction
Logic
Contrariwise . . . if it was so, it might be; and if it were so, it would be; but as it isnt, it aint.
Thats logic.
Lewis Carroll
1.2
Instructional Staff
Instructor: Mahesh Viswanathan (vmahesh)
Office Hours: 2:303:30 on Tuesdays and Thursdays, and by appointment
And you?
Electronic Bulletin Boards
Webpage: wiki.engr.illinois.edu/display/cs498mv/
Textbooks
Prerequisites: All material in CS 173, CS 225 and CS 373. In particular,
Familiarity with expressing properties in propositional logic and first order logic
Basic graph concepts and algorithms
Automata theory
Text-book: None!
Lecture Notes: Available on the web-page after every class
Additional References: See papers and books mentioned on the website
Grading Scheme
A Brief History
Prehistory of Logic
Egyptians discovered empirical facts about geometry
Ancient Greeks: Move from empirical methods to a demonstrative science
Assume certain facts to be true without demonstration
Derive other facts from these using valid reasoning principles
Plato and Aristotle (400300 B.C.E)
Figure 1: Plato
Figure 2: Aristotle
Plato: What is truth? What is the relationship between the assumptions and conclusions of
a valid argument?
4
Modern Logic
Logic evolves to become a mathematical discipline
Constructs, terms, and reasoning are purely symbolic
Rather than abstracting theorems from ordinary language, it constructs theorems through
mechanical methods
Tarski: Truth in a formalized language is a correspondence between a metalanguage and an
object language through an interpretation.
Syntax
5.1
Introduction
Another Example
Syntax
i+j
i
5
Semantics1
(i+j)!
i!j!
5.2
Propositional Logic
Defining Syntax
Task
Defining syntax involves describing the sequence of symbols that are well formed
Turtle Rules: Any sequence of F , +, and .
Regular Expressions: Rules that describe (syntactically) correct expressions: If r1 and r2 are
regular expressions then so is r1 + r2 , . . .
Propositions
Basic Building Block
Propositions represent declarative sentences that are either true or false
Examples: Springfield is capital of Illinois, 1 + 1 = 2, 2 + 2 = 3
Non-examples: What is it?, Location of robot, x + 1 = 2
5.3
Notation
Logical Abbreviations
Short-hand
The following are useful macros in writing formulas
Negation A, read as not A, will denote the formula A
Disjunction A B, read as A or B, will denote the formula (A) B
Conjunction A B, read as A and B, will denote the formula (A B).
True >, read as true, will denote the formula or
Notational Simplifications
Notation
We will make the following notational simplifications when writing formulas
The outermost parentheses will be dropped. Thus we will write p3 ( p1 ) instead of
(p3 ( p1 ))
We will sometimes omit subscripts of propositions. Thus we will write p instead of p1 , or q
instead of p2 , r instead of p3 , or s instead of p4 , and so on.
The following precedence of operators will be assumed: , , , . Thus p q r will
mean (((p) q) r)
Semantics
6.1
Truth Valuations
Defining Semantics
Task
The semantics of something describes its meaning
Turtle Rules: F draws a line of 1 unit, + turns 60 degree left, . . .
Regular Expressions: L(r1 + r2 ) = L(r1 ) L(r2 ), . . .
Truth Valuations
Definition 2. There are two truth values: truth and falsity. We denote, truth by 1 and falsity by
0
Definition 3. A (truth) valuation is a function v that assigns truth values to each of the propositions.
The value of a proposition p under valuation v is given by v(p)
Formal Semantics of Propositional Logic
Definition 4. The value of a wff A under valuation v, denoted by v[[A]], is inductively defined as
follows
v[[pi ]] = v(pi )
v[[]] = 0
0 if v[[A]] = 1 and v[[B]] = 0
v[[A B]] =
1 otherwise
Definition 5. 2- The models of wff A are the set of valuations that satisfy A. More precisely,
[[A]] = {v | v[[A]] = 1}
Relevant Propositions
Theorem 6. Let v1 and v2 be truth valuations such that for all propositions p appearing
formula A, v1 (p) = v2 (p). Then v1 [[A]] = v2 [[A]].
Proof. By induction on the structure of A.
in
v[[A]]
1
1
0
0
v[[B]]
1
0
1
0
v[[B A]]
1
1
0
1
v[[A (B A)]]
1
1
1
1
6.2
Tautologies
Tautologies
Definition 7. A wff A is a tautology if and only if v[[A]] = 1, for every valuation v.
Example 8. A (B A) is a tautology, for any wffs A and B. This can be seen because
Satisfiability
Definition 9. A formula A is said to be satisfiable if and only if [[A]] 6= .
Example 10. (p q) r is satisfiable because: Consider the valuation v that assigns 1 to every
proposition. Now, v[[p q]] = 1 and v[[(p q) r]] = 1 as well.
Computational Problems
Satisfiability Given a formula A, is A satisfiable?
Validity Given a formula A, is A a tautology?
Algorithms
To check if A, over propositions {p1 , . . . pn }, is satisfiable (is a tautology), compute v[[A]] for every
truth assignment v to the propositions {p1 , . . . pn }.
Running time = O(2n ).
Question: Is this the best algorithm?
6.3
Logical Consequence
Logical Consequence
T
Definition 11. A wff A is said to be logical consequence of set of formulas iff B [[B]] [[A]].
We denote this by |= A. Observe that when = , it means that A is a tautology.
10
v[[A]]
0
1
v[[A]]
1
0
v[[A]]
0
1
B
1
0
1
0
AB
1
0
1
1
A
0
0
1
1
B
0
1
0
1
B A
1
0
1
1
11