SlideShare a Scribd company logo
Logic in computer sience
Propositional logic is a good vehicle to introduce basic properties of logic. It does not provide
means to determine the validity (truth or false) of atomic statements. Instead, it allows you to
evaluate the validity of compound statements given the validity of its atomic components.
For example, consider the following:
I like Pat or I like Joe.
If I like Pat then I like Joe.
Do I like Joe?
Accept as facts the first two statements, noting that the use of "or" here is not exclusive and thus
could really be thought of as saying "I like Pat, or I like Joe, or I like them both". Do these
statements imply that "I like Joe" is true? Try to convince yourself that "I like Joe" is true, and
consider another line of reasoning:
Pigs can fly or fish can sing.
If pigs can fly then fish can sing.
Can fish sing?
We can see that the answer is yes in both cases. The above two sets of statements can be both
abstracted as follows:
Q?
Here, we are concerned about the logical reasoning itself, and not the statements. Thus, instead
of working with pigs or Pats, we simply write Qs or Ps. We begin our study first with the syntax
of propositional logic: that is, we describe the elements in our language of logic and how they are
written. We then describe the semantics of these symbols: that is, what the symbols mean.
[edit] Syntax
The syntax of propositional logic is composed of propositional symbols, logical connectives, and
parenthesis. Rules govern how these elements can be written together. First, we treat
propositional symbols merely as a set of some symbols, for our purposes we'll use letters of the
Roman and Greek alphabets, and refer to the set of all symbols as Prop:
Propositional symbols: A set Prop of some symbols. For example
Second, we have the logical connectives:
Logical connectives:
Note that these are not the minimal required set; they can be equivalently represented only using
the single connective NOR (not-or) or NAND (not-and) as is used at the lowest level in computer
hardware. Finally, we use parenthesis to denote expressions (later on we make parenthesis
optional):
Parentheses: (,)
An expression is a string of propositional symbols, parenthesis, and logical connectives.
The expressions we consider are called formulas. The set Form of formulas is the smallest set of
expressions such that:
1.
2. If then
1. ,
2. ,
3. , and
4. .
Another way to define formulas is as the language defined by the following context-free
grammar (with start symbol Form):
, where Prop stands for any propositional symbol
Fact 1 (Unique Readability): The above context free grammar is unambiguous.
[edit] Semantics
The function of a formula is to create meanings of statements given meanings of atomic
statements. The semantics of a formula φ with propositional symbols is a mapping
associating to each truth assignment V to a truth value (0 or 1) for φ. (The truth
values true and false can be used instead of 1 or 0, respectively, as well as the abbreviations T
and F.)
The semantics are well defined due to Fact 1.
One way to specify semantics of a logical connective is via a truth table:
p q
0 0 0
0 1 0
1 0 0
1 1 1
Can one always find a formula that implements any given semantics? Yes, any truth table is
realized by a formula. The formula can be found as follows. "Represent" the rows where φ = 1
with conjunctions of the true proposition symbols and negations of the false ones. Finally write
the disjunction of the results.
For example,
p q φ Conjunctions (true values only)
0 0 1
0 1 0
1 0 1
1 1 0
Corollary: Every formula is equivalent to a disjunction of conjunctions of propositional symbols
or negation of propositional symbols (DNF).
Dual of DNF is CNF. To get φ in CNF:
1. Describe cases when φ is false. ex - DNF ψ
2. Note that φ is true when is false. Hence, negate ψ using DeMorgan's laws.
ex .
There are cases when DNF (resp. CNF) is exponentially larger than the original formula. For
example, for the equivalent DNF is exponential
in size.
Does each truth table have a polynomial size formula implementing it? More precisely, does
there exist k such that every truth table with n propositional symbols has a form φ of size ?
Answer: no.
Proof: Assume there exists such k. The number of truth tables for n propositional symbols is
. The number of formulas of size is (n propositional symbols, 4
connectives and parentheses.) Clearly, , for sufficiently large n.
[TODO: exposition to explain what these definitions are and provide their context]
 Satisfaction: Satisfaction of a formula φ by a truth assignment τ. Notation: (φ is
true for τ).
 Implication: A set of formulas Σ implies φ. Notation: . Σ implies φ if and only if
every truth assignment that satisfies Σ also satisfies φ.
[edit] Formula Classes of Special Interest
 VALID - the set of formulas that are always true (also known as tautologies). For
example, are valid formulas.
 UNSAT - the set of formulas that are never true (unsatisfiable).
 In between: SAT - the set of formulas for which there exists a satisfying assignment (not
unsatisfiable).
Note. .
Claim:
Claim: SAT is NP-complete.
Proof:
 : guess a satisfying assignment, then verify that the formula is true (a
satisfying assignment is a certificate).
 Hardness. graph 3-coloring (there also exists a direct proof). We reduce 3-
coloring to SAT. Let G = (V,E) be a graph with n nodes . We use
propositional variables pi,g,pi,r,pi,b to indicate that vertex i is colored with green, red, or
blue. Construct φ as follows:
Claim: .
It is also possible to prove that directly
Claim: .
[edit] Horn Clauses
Special case for which SAT is in polynomial time. Example:
A Horn clause is a disjunction of literals of which at most one is positive. There are two kinds of
possible Horn clauses:
1. clause has 1 positive literal
1. p, or
2.
2. no positive literal
1.
2.
Claim: For every set Σ of Horn formulas, checking whether Σ is satisfiable is in P.
Proof Idea: Let Σ1 be the subset of Σ containing only clauses of type 1, and Σ2 the subset of Σ
containing clauses of type 2. Note first that Σ1 is satisfiable. To obtain a minimum satisfying
assignment σ, start with literals from single-literal clauses and crank the rules. It now remains to
check consistency of σ with the clauses in Σ2. To do this, it is enough to check that for each
clause in Σ2, σ is not true for all of .
Example: Consider the set Σ of Horn clauses:
p
q
r
The set Σ1 of clauses of type 1 consists of the first 5 clauses, and Σ2 consists of the last clause.
Note that Σ1 can also be written as:
p
q
r
The minimum satisfying assignment for Σ1 is obtained as follows:
1. start with {p,q,r}
2. use the first implication to infer s
3. use the second implication to infer t
Thus, the minimum satisfying assignment makes {p,q,r,s,t} true. This contradicts Σ2, which
states that t must be false. Thus, Σ is not satisfiable.
[edit] Deductive Systems
A deductive system is a mechanism for proving new statements from given statements.
Let Σ be a set of known valid statements (propositional formulas). In a deductive system, there
are two components: inference rules and proofs.
Inference rules
An inference rule indicates that if certain set of statements (formulas) is
true, then a given statement must be true. An inference rule H is denoted as
.
Example (modus ponens):
Proofs
A proof of from Σ is sequence of formulas such that and for all
 Each formula , or
 There are a subset of formulas , such that,
is an inference rule.
If has a proof from Σ using inference rule H we write .
Properties:
 Soundness: If then (i.e., all provable sentences are true). This property
is fundamental for the correctness of the deductive system.
 Completeness: If then (i.e., all true sentences are provable). This is a
desirable property in deductive systems.
[edit] Natural Deduction
Natural deduction is a collection of inference rules. Let denote contradiction, falsity. The
following are the inference rules of natural deduction:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Rule (13) allows us to prove valid statements of the form "If then ψ" even if we don't know the
truth value of the statement (i.e., is not in the set Σ of known valid statements). Indeed, for
this rule, we start assuming is valid. If we can conclude ψ is valid in a world where are
valid, then we conclude that the relation is true, and we "release" the assumption is
valid.
We now show how to apply the above inference rules.
Example: De Morgan's Law for negated or-expressions says:
Proof: By rule (8) if we can prove and
we can infer the desired result.
To prove the first direction, we use rule 13 and assume the hypothesis . Then
(assumed)
(assumed)
(by rule 11)
(by rule 5)
(by rule 14)
ψ (assumed)
(by rule 11)
(by rule 5)
(by rule 14)
(by rule 1)
(by rule 13)
We now prove the second direction.
(assumed)
(by rule 2)
(by rule 3)
(assumed)
(assumed)
(by rule 5)
(by rule 16)
(by rule 14)
(by rule 13)
Proof of Pierce's Law:
.
(assumed) (1*)
(assumed)
A (assumed)
(by rule 5)
B (by rule 7)
(by rule 13)
A (by assumption (1*) and rule 4)
(by rule 5)
A (by rule 14)
(by rule 13)
Fact 2: Natural deduction is sound.
To show that natural deduction is also complete we need to introduce propositional resolution.
[edit] Propositional Resolution
Resolution is another procedure for checking validity of statements. It involves clauses,
formulas and a single resolution rule.
Some terminology:
Clause
A clause is a propositional formula composed by disjunction of literals. For example
. It is usually denoted as the set of literals, e.g. .
The empty clause, denoted as an open box " ", is the disjunction of no literals. It is
always false.
Formula
A set of clauses, each of them satisfiable. For example,
represents the CNF formula .
The empty formula, denoted as , is the set that contains no clauses. It is always true.
Resolution Rule
It is a rule that, given two clauses C (containing some literal y) and C' (containing some
literal ), allows to infer a new clause, called the resolvent of C and C' (with respect to
y).
A proof system for resolution contains a single resolution rule, where the resolvent is defined as
follows. Assume C and C' are clauses such that and , then
.
The smallest set of clauses containing and closed under resolution is denoted .
Example: If C = {p,y} and , then resy(C,C') = {p,q}.
It is possible to show that the resolution rule, as defined, computes a clause that can be inferred
using natural deduction.
Claim: Let C and C' be any two clauses such that and . Then
.
In order to prove the validity of a statement ψ, we will prove the negated statement is
unsatisfiable. To prove unsatisfiability of a formula , we need to define the resolution
refutation of the formula :
The resolution refutation tree of the formula is a tree rooted at the empty clause, where every
leaf is a clause in and each internal node is computed as the resolvent of the two
corresponding children.
Notice that clauses of can appear repeated as leaves. From above claim we can conclude that:
Claim: If there exists a resolution refutation tree for formula , then , that is, is
unsatisfiable.
Example: The formula
has the following resolution refutation tree:
The order in which clauses are selected to compute the resolvent matters when computing the
resolution refutation tree, as the following example shows: Consider the formula
.
Even though a resolution refutation tree may exist for ψ, order is important when trying to build
the tree. Below are two different resolution refutation trees, but only one is successful:
Unsuccessful attempt of resolution refutation tree for ψ.
A successful resolution refutation tree for ψ.
[edit] Properties of Propositional Resolution
Soundness: Propositional resolution is sound, that is, if there exists a resolution refutation tree
for a given formula , then must be unsatisfiable.
Theorem: For any formula , if , then .
Completeness: Propositional resolution is complete, that is, if a given formula is unsatisfiable,
then has a resolution refutation tree.
Theorem: For any formula , if , then .
Proof: By induction on the number of variables in .
Basis: We have one variable, say p. All possible clauses of are {p} and . If is
unsatisfiable then both clauses occur, and therefore .
Induction step: Suppose the hypothesis is true for formulas with less than n variables. Let be a
formula with n variables. Suppose ; we will show is satisfiable. Let p be a
variable of . Then either or (if both hold then
immediately).
Assume . We define the formula as containing all clauses that do not
contain {p} and where the literal has been removed from each clause (in other words, is
equivalent to the formula resulting from setting p true).
Formally,
.
First, notice that
and thus,
.
Also, since we have that . By the induction hypothesis, is
satisfiable. Then is satisfiable by an extension of the satisfying assignment of with p equal
true. The case is analogous.
[edit] Completeness of Natural Deduction
Theorem: Let H be the set of inference rules of Natural Deduction. If then .
The idea behind the proof of completeness of natural deduction is as follows. Suppose is valid
(then is unsatisfiable). We then show there exists a resolution refutation for and then by
applying the contradiction rule (rule 15):
we conclude can be inferred.
Proof: (Sketch) Given a formula valid under Σ, we perform the following steps:
1. Prove that is equivalent to some ψ, where ψ is in CNF.
2. Prove that , for all ψ.
3. By completeness of resolution, if ψ is unsatisfiable then . Therefore, {p}
and for some literal p. This implies .
4. Conclude that and therefore is valid.
Step (1) can be easily done by repeated application of De Morgan's laws. Step (2) can be proven
using natural deduction. Finally, step (3) can be proven by induction on the number of steps to
obtain Res(ψ). Clearly, each step can be simulated using natural deduction.
It is very likely that any algorithm for propositional resolution will take very long on the worst
case (recall that checking validity of a formula is co-NP complete).
[edit] Linear Resolution and PROLOG
Linear resolution is a particular resolution strategy that always resolves the most recent resolvent
with a clause. The resolution refutation tree so obtained is therefore linear. It is possible to prove
that, if the set of clauses are Horn clauses, there exists a linear resolution strategy for any
formula. That is, linear resolution is complete for the set of Horn clauses.
The language PROLOG uses resolution on a set of Horn clauses. Each clause is called a
program clause. Moreover, clauses composed by a single literal are called facts. A clause with a
single negated literal is called a query. The table below shows a comparison of the different
notations. In PROLOG, to query a statement t, the idea is to negate the statement ( ) and to
perform resolution with the set of known true statements. If a resolution refutation tree is found,
the statement t is implied by the program.
Example: An example of linear resolution for the formula
is shown here:
Propositional logic is a good vehicle to introduce basic properties of logic

More Related Content

What's hot (19)

PPT
Logic (PROPOSITIONS)
D Nayanathara
 
PDF
Chapter 1 Logic of Compound Statements
guestd166eb5
 
PPT
Mathematical Logic - Part 1
blaircomp2003
 
PPTX
Mathematical Logic
Septi Ratnasari
 
PDF
Sentient Arithmetic and Godel's Incompleteness Theorems
Kannan Nambiar
 
PPTX
Propositional logic
Mamta Pandey
 
PPTX
Logic - Logical Propositions
JosefMikaeldelCorro
 
PPT
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Dr. Khaled Bakro
 
PDF
Mathematical Logic
Joey Fontanilla Valdriz
 
PDF
Logic (slides)
IIUM
 
PPT
Propositional And First-Order Logic
ankush_kumar
 
PDF
Mathematical Logic
endahnurfebriyanti
 
PPTX
Truth table
Abdur Rehman
 
PPT
Logic
Jeane Paguio
 
PPTX
Introduction to mathematical analysis
AnoojaI
 
PPT
Discrete mathematics
University of Potsdam
 
PPT
Logic&proof
Fathan Hakim
 
PPTX
Truth tables complete and p1 of short method
Nat Karablina
 
PPT
Predicate logic_2(Artificial Intelligence)
SHUBHAM KUMAR GUPTA
 
Logic (PROPOSITIONS)
D Nayanathara
 
Chapter 1 Logic of Compound Statements
guestd166eb5
 
Mathematical Logic - Part 1
blaircomp2003
 
Mathematical Logic
Septi Ratnasari
 
Sentient Arithmetic and Godel's Incompleteness Theorems
Kannan Nambiar
 
Propositional logic
Mamta Pandey
 
Logic - Logical Propositions
JosefMikaeldelCorro
 
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Dr. Khaled Bakro
 
Mathematical Logic
Joey Fontanilla Valdriz
 
Logic (slides)
IIUM
 
Propositional And First-Order Logic
ankush_kumar
 
Mathematical Logic
endahnurfebriyanti
 
Truth table
Abdur Rehman
 
Introduction to mathematical analysis
AnoojaI
 
Discrete mathematics
University of Potsdam
 
Logic&proof
Fathan Hakim
 
Truth tables complete and p1 of short method
Nat Karablina
 
Predicate logic_2(Artificial Intelligence)
SHUBHAM KUMAR GUPTA
 

Similar to Propositional logic is a good vehicle to introduce basic properties of logic (20)

PPTX
lec3 AI.pptx
someyamohsen2
 
PPTX
MACHINE LEARNING-LEARNING RULE
DrBindhuM
 
PPTX
Logic in Computer Science Unit 2 (1).pptx
PriyalMayurManvar
 
PPTX
EQUIVALENCES and ARGUMENT FORMS and VALIDITY (Updated, 11-10-23) [GROUP 7 REP...
BigV Jkv
 
PPTX
First order predicate logic(fopl)
surbhi jha
 
PPT
Godels First Incompleteness Theorem
mmanning02474
 
PDF
AppTheories_L3
Manu Muñoz H
 
PPTX
Knowledge Representation, Inference and Reasoning
Sagacious IT Solution
 
PPTX
DISCRETE MATHEMATICS for IT students.pptx
ReymartVillapea
 
PDF
Unit-4-Knowledge-representation.pdf
HrideshSapkota2
 
PDF
theory of computation chapter 2 notes pdf
laleshpawar2025
 
PPT
Discrete Maths141 - Course Outline and Lecture Slides
AryanZia3
 
PPT
Semantics
Mohammed Al-Meqdad
 
PPTX
4AMT122-PART 1-SLIDES.pptx
Bongisipho Hlophe
 
PPTX
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Ashish Duggal
 
PDF
Unit-8.pdf
drinkMilk1
 
PPTX
3 computing truth tables
jennytuazon01630
 
PPTX
DM(1).pptx
PradeeshSAI
 
PDF
The axiomatic power of Kolmogorov complexity
lbienven
 
lec3 AI.pptx
someyamohsen2
 
MACHINE LEARNING-LEARNING RULE
DrBindhuM
 
Logic in Computer Science Unit 2 (1).pptx
PriyalMayurManvar
 
EQUIVALENCES and ARGUMENT FORMS and VALIDITY (Updated, 11-10-23) [GROUP 7 REP...
BigV Jkv
 
First order predicate logic(fopl)
surbhi jha
 
Godels First Incompleteness Theorem
mmanning02474
 
AppTheories_L3
Manu Muñoz H
 
Knowledge Representation, Inference and Reasoning
Sagacious IT Solution
 
DISCRETE MATHEMATICS for IT students.pptx
ReymartVillapea
 
Unit-4-Knowledge-representation.pdf
HrideshSapkota2
 
theory of computation chapter 2 notes pdf
laleshpawar2025
 
Discrete Maths141 - Course Outline and Lecture Slides
AryanZia3
 
4AMT122-PART 1-SLIDES.pptx
Bongisipho Hlophe
 
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Ashish Duggal
 
Unit-8.pdf
drinkMilk1
 
3 computing truth tables
jennytuazon01630
 
DM(1).pptx
PradeeshSAI
 
The axiomatic power of Kolmogorov complexity
lbienven
 
Ad

Recently uploaded (20)

PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPTX
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PPT on the Development of Education in the Victorian England
Beena E S
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
Ad

Propositional logic is a good vehicle to introduce basic properties of logic

  • 1. Logic in computer sience Propositional logic is a good vehicle to introduce basic properties of logic. It does not provide means to determine the validity (truth or false) of atomic statements. Instead, it allows you to evaluate the validity of compound statements given the validity of its atomic components. For example, consider the following: I like Pat or I like Joe. If I like Pat then I like Joe. Do I like Joe? Accept as facts the first two statements, noting that the use of "or" here is not exclusive and thus could really be thought of as saying "I like Pat, or I like Joe, or I like them both". Do these statements imply that "I like Joe" is true? Try to convince yourself that "I like Joe" is true, and consider another line of reasoning: Pigs can fly or fish can sing. If pigs can fly then fish can sing. Can fish sing? We can see that the answer is yes in both cases. The above two sets of statements can be both abstracted as follows: Q? Here, we are concerned about the logical reasoning itself, and not the statements. Thus, instead of working with pigs or Pats, we simply write Qs or Ps. We begin our study first with the syntax of propositional logic: that is, we describe the elements in our language of logic and how they are written. We then describe the semantics of these symbols: that is, what the symbols mean. [edit] Syntax The syntax of propositional logic is composed of propositional symbols, logical connectives, and parenthesis. Rules govern how these elements can be written together. First, we treat propositional symbols merely as a set of some symbols, for our purposes we'll use letters of the Roman and Greek alphabets, and refer to the set of all symbols as Prop: Propositional symbols: A set Prop of some symbols. For example Second, we have the logical connectives:
  • 2. Logical connectives: Note that these are not the minimal required set; they can be equivalently represented only using the single connective NOR (not-or) or NAND (not-and) as is used at the lowest level in computer hardware. Finally, we use parenthesis to denote expressions (later on we make parenthesis optional): Parentheses: (,) An expression is a string of propositional symbols, parenthesis, and logical connectives. The expressions we consider are called formulas. The set Form of formulas is the smallest set of expressions such that: 1. 2. If then 1. , 2. , 3. , and 4. . Another way to define formulas is as the language defined by the following context-free grammar (with start symbol Form): , where Prop stands for any propositional symbol Fact 1 (Unique Readability): The above context free grammar is unambiguous. [edit] Semantics The function of a formula is to create meanings of statements given meanings of atomic statements. The semantics of a formula φ with propositional symbols is a mapping associating to each truth assignment V to a truth value (0 or 1) for φ. (The truth values true and false can be used instead of 1 or 0, respectively, as well as the abbreviations T and F.) The semantics are well defined due to Fact 1. One way to specify semantics of a logical connective is via a truth table:
  • 3. p q 0 0 0 0 1 0 1 0 0 1 1 1 Can one always find a formula that implements any given semantics? Yes, any truth table is realized by a formula. The formula can be found as follows. "Represent" the rows where φ = 1 with conjunctions of the true proposition symbols and negations of the false ones. Finally write the disjunction of the results. For example, p q φ Conjunctions (true values only) 0 0 1 0 1 0 1 0 1 1 1 0 Corollary: Every formula is equivalent to a disjunction of conjunctions of propositional symbols or negation of propositional symbols (DNF). Dual of DNF is CNF. To get φ in CNF: 1. Describe cases when φ is false. ex - DNF ψ 2. Note that φ is true when is false. Hence, negate ψ using DeMorgan's laws. ex . There are cases when DNF (resp. CNF) is exponentially larger than the original formula. For example, for the equivalent DNF is exponential in size. Does each truth table have a polynomial size formula implementing it? More precisely, does there exist k such that every truth table with n propositional symbols has a form φ of size ? Answer: no.
  • 4. Proof: Assume there exists such k. The number of truth tables for n propositional symbols is . The number of formulas of size is (n propositional symbols, 4 connectives and parentheses.) Clearly, , for sufficiently large n. [TODO: exposition to explain what these definitions are and provide their context]  Satisfaction: Satisfaction of a formula φ by a truth assignment τ. Notation: (φ is true for τ).  Implication: A set of formulas Σ implies φ. Notation: . Σ implies φ if and only if every truth assignment that satisfies Σ also satisfies φ. [edit] Formula Classes of Special Interest  VALID - the set of formulas that are always true (also known as tautologies). For example, are valid formulas.  UNSAT - the set of formulas that are never true (unsatisfiable).  In between: SAT - the set of formulas for which there exists a satisfying assignment (not unsatisfiable). Note. . Claim: Claim: SAT is NP-complete. Proof:  : guess a satisfying assignment, then verify that the formula is true (a satisfying assignment is a certificate).  Hardness. graph 3-coloring (there also exists a direct proof). We reduce 3- coloring to SAT. Let G = (V,E) be a graph with n nodes . We use propositional variables pi,g,pi,r,pi,b to indicate that vertex i is colored with green, red, or blue. Construct φ as follows: Claim: . It is also possible to prove that directly
  • 5. Claim: . [edit] Horn Clauses Special case for which SAT is in polynomial time. Example: A Horn clause is a disjunction of literals of which at most one is positive. There are two kinds of possible Horn clauses: 1. clause has 1 positive literal 1. p, or 2. 2. no positive literal 1. 2. Claim: For every set Σ of Horn formulas, checking whether Σ is satisfiable is in P. Proof Idea: Let Σ1 be the subset of Σ containing only clauses of type 1, and Σ2 the subset of Σ containing clauses of type 2. Note first that Σ1 is satisfiable. To obtain a minimum satisfying assignment σ, start with literals from single-literal clauses and crank the rules. It now remains to check consistency of σ with the clauses in Σ2. To do this, it is enough to check that for each clause in Σ2, σ is not true for all of . Example: Consider the set Σ of Horn clauses: p q r The set Σ1 of clauses of type 1 consists of the first 5 clauses, and Σ2 consists of the last clause. Note that Σ1 can also be written as: p q r The minimum satisfying assignment for Σ1 is obtained as follows:
  • 6. 1. start with {p,q,r} 2. use the first implication to infer s 3. use the second implication to infer t Thus, the minimum satisfying assignment makes {p,q,r,s,t} true. This contradicts Σ2, which states that t must be false. Thus, Σ is not satisfiable. [edit] Deductive Systems A deductive system is a mechanism for proving new statements from given statements. Let Σ be a set of known valid statements (propositional formulas). In a deductive system, there are two components: inference rules and proofs. Inference rules An inference rule indicates that if certain set of statements (formulas) is true, then a given statement must be true. An inference rule H is denoted as . Example (modus ponens): Proofs A proof of from Σ is sequence of formulas such that and for all  Each formula , or  There are a subset of formulas , such that, is an inference rule. If has a proof from Σ using inference rule H we write . Properties:  Soundness: If then (i.e., all provable sentences are true). This property is fundamental for the correctness of the deductive system.  Completeness: If then (i.e., all true sentences are provable). This is a desirable property in deductive systems. [edit] Natural Deduction Natural deduction is a collection of inference rules. Let denote contradiction, falsity. The following are the inference rules of natural deduction:
  • 8. 14. 15. 16. Rule (13) allows us to prove valid statements of the form "If then ψ" even if we don't know the truth value of the statement (i.e., is not in the set Σ of known valid statements). Indeed, for this rule, we start assuming is valid. If we can conclude ψ is valid in a world where are valid, then we conclude that the relation is true, and we "release" the assumption is valid. We now show how to apply the above inference rules. Example: De Morgan's Law for negated or-expressions says: Proof: By rule (8) if we can prove and we can infer the desired result. To prove the first direction, we use rule 13 and assume the hypothesis . Then
  • 9. (assumed) (assumed) (by rule 11) (by rule 5) (by rule 14) ψ (assumed) (by rule 11) (by rule 5) (by rule 14) (by rule 1) (by rule 13) We now prove the second direction. (assumed) (by rule 2) (by rule 3) (assumed) (assumed) (by rule 5) (by rule 16) (by rule 14) (by rule 13) Proof of Pierce's Law: . (assumed) (1*) (assumed) A (assumed) (by rule 5) B (by rule 7) (by rule 13) A (by assumption (1*) and rule 4) (by rule 5) A (by rule 14) (by rule 13) Fact 2: Natural deduction is sound. To show that natural deduction is also complete we need to introduce propositional resolution. [edit] Propositional Resolution
  • 10. Resolution is another procedure for checking validity of statements. It involves clauses, formulas and a single resolution rule. Some terminology: Clause A clause is a propositional formula composed by disjunction of literals. For example . It is usually denoted as the set of literals, e.g. . The empty clause, denoted as an open box " ", is the disjunction of no literals. It is always false. Formula A set of clauses, each of them satisfiable. For example, represents the CNF formula . The empty formula, denoted as , is the set that contains no clauses. It is always true. Resolution Rule It is a rule that, given two clauses C (containing some literal y) and C' (containing some literal ), allows to infer a new clause, called the resolvent of C and C' (with respect to y). A proof system for resolution contains a single resolution rule, where the resolvent is defined as follows. Assume C and C' are clauses such that and , then . The smallest set of clauses containing and closed under resolution is denoted . Example: If C = {p,y} and , then resy(C,C') = {p,q}. It is possible to show that the resolution rule, as defined, computes a clause that can be inferred using natural deduction. Claim: Let C and C' be any two clauses such that and . Then . In order to prove the validity of a statement ψ, we will prove the negated statement is unsatisfiable. To prove unsatisfiability of a formula , we need to define the resolution refutation of the formula : The resolution refutation tree of the formula is a tree rooted at the empty clause, where every leaf is a clause in and each internal node is computed as the resolvent of the two corresponding children. Notice that clauses of can appear repeated as leaves. From above claim we can conclude that:
  • 11. Claim: If there exists a resolution refutation tree for formula , then , that is, is unsatisfiable. Example: The formula has the following resolution refutation tree: The order in which clauses are selected to compute the resolvent matters when computing the resolution refutation tree, as the following example shows: Consider the formula . Even though a resolution refutation tree may exist for ψ, order is important when trying to build the tree. Below are two different resolution refutation trees, but only one is successful: Unsuccessful attempt of resolution refutation tree for ψ.
  • 12. A successful resolution refutation tree for ψ. [edit] Properties of Propositional Resolution Soundness: Propositional resolution is sound, that is, if there exists a resolution refutation tree for a given formula , then must be unsatisfiable. Theorem: For any formula , if , then . Completeness: Propositional resolution is complete, that is, if a given formula is unsatisfiable, then has a resolution refutation tree. Theorem: For any formula , if , then . Proof: By induction on the number of variables in . Basis: We have one variable, say p. All possible clauses of are {p} and . If is unsatisfiable then both clauses occur, and therefore . Induction step: Suppose the hypothesis is true for formulas with less than n variables. Let be a formula with n variables. Suppose ; we will show is satisfiable. Let p be a variable of . Then either or (if both hold then immediately). Assume . We define the formula as containing all clauses that do not contain {p} and where the literal has been removed from each clause (in other words, is equivalent to the formula resulting from setting p true). Formally, . First, notice that
  • 13. and thus, . Also, since we have that . By the induction hypothesis, is satisfiable. Then is satisfiable by an extension of the satisfying assignment of with p equal true. The case is analogous. [edit] Completeness of Natural Deduction Theorem: Let H be the set of inference rules of Natural Deduction. If then . The idea behind the proof of completeness of natural deduction is as follows. Suppose is valid (then is unsatisfiable). We then show there exists a resolution refutation for and then by applying the contradiction rule (rule 15): we conclude can be inferred. Proof: (Sketch) Given a formula valid under Σ, we perform the following steps: 1. Prove that is equivalent to some ψ, where ψ is in CNF. 2. Prove that , for all ψ. 3. By completeness of resolution, if ψ is unsatisfiable then . Therefore, {p} and for some literal p. This implies . 4. Conclude that and therefore is valid. Step (1) can be easily done by repeated application of De Morgan's laws. Step (2) can be proven using natural deduction. Finally, step (3) can be proven by induction on the number of steps to obtain Res(ψ). Clearly, each step can be simulated using natural deduction. It is very likely that any algorithm for propositional resolution will take very long on the worst case (recall that checking validity of a formula is co-NP complete). [edit] Linear Resolution and PROLOG
  • 14. Linear resolution is a particular resolution strategy that always resolves the most recent resolvent with a clause. The resolution refutation tree so obtained is therefore linear. It is possible to prove that, if the set of clauses are Horn clauses, there exists a linear resolution strategy for any formula. That is, linear resolution is complete for the set of Horn clauses. The language PROLOG uses resolution on a set of Horn clauses. Each clause is called a program clause. Moreover, clauses composed by a single literal are called facts. A clause with a single negated literal is called a query. The table below shows a comparison of the different notations. In PROLOG, to query a statement t, the idea is to negate the statement ( ) and to perform resolution with the set of known true statements. If a resolution refutation tree is found, the statement t is implied by the program. Example: An example of linear resolution for the formula is shown here: