computational applied logic · propositional logic statements and their uses what things can one...

77
Computational Applied Logic CSC 503 Fall 2005 Jon Doyle Department of Computer Science North Carolina State University Propositional logic NC State University 1 / 77 CSC 503 Fall 2005 c 2005 by Jon Doyle

Upload: others

Post on 04-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Computational Applied LogicCSC 503 Fall 2005

Jon Doyle

Department of Computer ScienceNorth Carolina State University

Propositional logic

NC State University 1 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 2: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Statements and their uses

What things can one express?

• Sounds/exclamations/marks• Words• Statements• Sets of statements = theories• Partial statements• Sets of partial statements• Sequences of statements or sets of statements

NC State University 2 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 3: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Statements and their uses

How to do things with sentences

• Declarative: facts and descriptions• Interrogative: questions• Imperative: commands and pleas

NC State University 3 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 4: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Statements and their uses

What can I express with statements?

• Knowledge/facts/opinions/conditions• Ignorance/uncertainty• Goals/desires/intentions• Procedures/methods• Propositional attitudes

NC State University 4 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 5: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Language

Statements• Complete statements = propositions

• “Snow is white”

• “Letters”• snow-is-white

• Four-score-and-seven-years-ago-our-fathers-brought-forth-on-this-continent-a-new-nation-conceived-in-Liberty-and-dedicated-to-the-proposition-that-all-men-are-created-equal

• Ignore spelling, just enumerate• A1, A2, . . .

NC State University 5 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 6: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Language

Propositional connectives

∨ Disjunction “or”∧ Conjunction “and”¬ Negation “not”→ Conditional “implies”↔ Biconditional “iff = if and only if”+ Exclusive or “xor”| Sheffer stroke “nand”∨n

at least n

And more besides, when we visit description logicsNC State University 6 / 77

CSC 503 Fall 2005c© 2005 by Jon Doyle

Page 7: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Language

Complex propositions

• All combinators use parentheses to provideunique parse tree.

• We omit parentheses when parse is clear.• p = ¬A ∨ B → C• p = (((¬A) ∨ B)→ C)

• Depth = depth of parse tree (root has depth 0)• Depth(p) = 3

• Support = set of letters appearing in tree• Support(p) = {A, B, C}

NC State University 7 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 8: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Meaning of propositions

We only consider standard meanings at this time.• Standard meanings

• True/False (= T/F, 1/0, >/⊥)• Multivalued logics

• Elements of boolean lattices• Belnap 4-valued logic {TT , TF , FT , FF}

• Probabilistic logics• Probability values in [0, 1]

• Fuzzy logics• Possibility values in [0, 1]

NC State University 8 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 9: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Logicians are weird

• Logical meaning 6= English (etc.) meaning• “If 1=2, then I’m the Man in the Moon.”• “She is either a lawyer or a professor.”• “I’ve won every World Cup game I’ve played.”

• Logical meaning is atemporal• 10:00AM — Assert α• 10:01AM — Assert ¬α• Simple inconsistency, or change?

NC State University 9 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 10: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Truth functionality

• Basic connectives are truth functional• Truth of compound statement determined by

truth of the connected substatements• Truth of compound a function of truth of

constituents• Truth tables represent these functions

NC State University 10 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 11: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Connective truth tables

α β (α ∨ β)

T T TT F TF T TF F F

α β (α ∧ β)

T T TT F FF T FF F F

α (¬α)

T FF T

NC State University 11 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 12: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Connective truth tables

α β (α→ β)

T T TT F FF T TF F T

α β (α↔ β)

T T TT F FF T FF F T

NC State University 12 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 13: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Connective truth tables

α β (α + β)

T T FT F TF T TF F F

α β (α | β)

T T FT F TF T TF F T

NC State University 13 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 14: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Truth tables• Complete truth tables

• One column for each proposition in formation tree

• Abbreviated truth tables• Omit one or more intermediate propositions

NC State University 14 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 15: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Non-truth-functional connectives

Truth values of component propositions do notdetermine truth value of compound proposition.• α because β

• α causes β

• α necessarily implies β

• α preceded β

• α is a shorter statement than β

• α expresses more information than β

• α is more likely than β

• Alice believes α but Bob claims β

NC State University 15 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 16: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Truth valuations

• Truth assignment A : L→ {T , F}• Truth valuation V : L(L)→ {T , F}

• Required to respect truth tables in every connective

• Valuations must agree on a propositionwhenever they agree on the proposition’ssupport

NC State University 16 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 17: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Logical equivalence

α ≡ β

• Means α and β are logically equivalent• Logical equivalence = agreement w.r.t. every

valuation

• True just in case the truth table column forα↔ β contains only T ’s• Each row corresponds to a class of valuations• Truth table summarizes all valuations restricted to

support of a proposition

NC State University 17 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 18: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Lattice of meanings

Propositional equivalence classes• [α] = {β | α ≡ β}• 2n distinct truth tables over n letters• Thus 2n equivalence classes over n letters

• Form a Boolean lattice with respect to ∧, ∨, ¬• Define lattice order α ≤ β iff [α ∧ β] = [α]

NC State University 18 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 19: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Metalanguage vs. object language

≡ is part of the logical metalanguage• Part of the language we use to talk about logical

statements• Not part of the logical object language in which

propositions are expressed.

Other metalinguistic notions:• Entailment• Satisfiability• Provability

NC State University 19 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 20: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Adequacy

What can one say with a specific set of connectives?

• S is adequate iff every proposition is equivalentto some proposition constructed using onlyconnectives in S

• For every truth-functional α, there is some βover S such that α ≡ β

• Claim: {¬,∧,∨} is adequate. Why?• Claim: {¬,∨} is adequate. Why?

NC State University 20 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 21: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Normal forms

• Literal = letter or negation of a letter: A,¬A• Clause = disjunction of literals: A1 ∨ . . . ∨ An

• Conjunct = conjunction of literals: A1 ∧ . . . ∧ An

• CNF = Conjunctive normal form• Conjunction of clauses• (A1 ∨ . . . ∨ An) ∧ . . . ∧ (B1 ∨ . . . ∨ Bm)

• DNF = Disjunctive normal form• Disjunction of conjuncts• (A1 ∧ . . . ∧ An) ∨ . . . ∨ (B1 ∧ . . . ∧ Bm)

NC State University 21 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 22: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Linguistic expressiveness

Choose or change the basis connectives to improve• Consision of expression• Cardinality of expression• Complexity of expression• Clarity/comprehensibility/convenience of

expression

NC State University 22 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 23: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Validity

• α is valid iff every valuation makes it true• α is a tautology

• Taut = set of all tautologies

• α is nontrivial if neither α nor ¬α are valid

NC State University 23 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 24: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Satisfiability

• α is satisfiable iff some valuation makes it true• α is possibly true

• α is unsatisfiable iff no valuation makes it true• α is a contradiction• ¬α is a tautology

NC State University 24 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 25: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Consistency

• Σ is consistent just in case some valuationmakes every statement in Σ true

• For finite Σ, just in case∧

Σ is satisfiable

• Σ is inconsistent if no valuation makes allstatements true

• α and β are (in)consistent iff{α, β} is (in)consistent

NC State University 25 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 26: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Logical consequence

• α |= β means• V(β) = T whenever V(α) = T• α entails β

• Σ |= β means• V(β) = T whenever V(α) = T for each α ∈ Σ• Σ entails β

• Cn(Σ) is the set of consequences of Σ• Cn(Σ) = {α | Σ |= α}• Taut = Cn(∅)

NC State University 26 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 27: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Properties of consequences

• Monotonic: Σ ⊆ Σ′ implies Cn(Σ) ⊆ Cn(Σ′)• Supra-tautologous: Taut ⊆ Cn(Σ)

• Idempotent: Cn(Cn(Σ)) = Cn(Σ)

• Additive: Σ ⊆ Cn(Σ)

NC State University 27 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 28: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Completeness

A complete theory determines truth values for allpropositions• Σ is complete iff for each p either

• p ∈ Cn(Σ), or• ¬p ∈ Cn(Σ)

• Is {p,¬p} complete?

NC State University 28 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 29: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Meaning

Models

Models = interpretations that make true• V a model of Σ iff V(α) = T for each α ∈ Σ

• M(Σ) = {V | ∀α ∈ Σ.V(α) = T} is the set of allmodels of Σ.

• Σ ⊆ Σ′ impliesM(Σ′) ⊆M(Σ)

NC State University 29 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 30: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Formalizing theories

So what good is logic?

• Precise concepts for expressing theories• Precise concepts for critiquing theories

NC State University 30 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 31: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Formalizing theories

The process of logical formalization

• Commence with initial formulation• Common sense• Expertise• Informed speculation• Wild guesses

• Critique the formulation with respect to thedesired qualities

• Correct the visible flaws as seems fit• Continue this process until convergence

NC State University 31 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 32: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Formalizing theories

The N“C” State Knowledge DiscoveryMethod

• Commence to continuously correct the contentvia the critique categories until convergence

Truth

Correctness**Consistency**CompletenessCategoricity**ContingencyChanceCoverageCourageousness

Goodness

Computability**Complexity**CardinalityCompromisesConvenienceCharityCompactness

Beauty

ClarityComprehensibilityCleavageCogencyCommonsensicalityContinuity

Perfection

ClosenessCumulativityConvergenceConstancy

NC State University 32 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 33: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Formalizing theories

Logical formalization as search

• Different critiques might suggest incompatiblecorrections; what to desire?

• Applied corrections might not work• Confusion or contradiction can suggest retreat

to prior formulation; divergence• View this process as a search for the right

formulation• Process state as position in a space of assessment

dimensions• Assessment criteria as elements of heuristic

evaluation function• Correction methods as possible actions

NC State University 33 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 34: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Tableau proofs

• Tableaux = tables• Labeled trees, built up from atomic tableaux• Various nice computational properties

We will consider other proof formalisms later

NC State University 34 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 35: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Atomic propositional tableaux

TA FAT (¬α)

F (¬α)

NC State University 35 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 36: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Atomic propositional tableaux

T (α ∧ β)

F (α ∧ β)�

@@

T (α ∨ β)�

@@

F (α ∨ β)

NC State University 36 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 37: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Atomic propositional tableaux

T (α→ β)�

@@

F (α→ β)

T (α↔ β)�

@@

Tβ Fβ

F (α↔ β)�

@@

Fβ Tβ

NC State University 37 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 38: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Tableaux construction rules

• Root is proposition under consideration• Apply atomic tableau to some proposition in tree

• Append atomic tableau at end of branch beneath• Head of appended tableau duplicates proposition

being reduced

NC State University 38 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 39: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Tableau properties

Tableau τ , path P on τ , and E an entry on P

• E is reduced iff all entries on the atomic tableauwith root E appear on P

• P is contradictory iff both Tα and Fα appear onP

• P is finished iff it is contradictory or every entryon P is reduced on P

• τ is finished iff every path is finished• τ is contradictory iff every path is contradictory

NC State University 39 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 40: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Tableau proof

Proof by refutation• Tableau proof of α = a contradictory tableau with

root Fα

• ` α means α is tableau provable

• Tableau refutation of α = a contradictory tableauwith root Tα

• α is tableau refutable iff it has a tableaurefutation

NC State University 40 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 41: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Complete systematic tableaux

• Construct increasing sequence of tableaux• Find highest level with unreduced noncontradictory

entry E• Find leftmost path containing such an entry• Adjoin atomic tableau with root E to each such path• Adjunction means τm ⊆ τm+1

• Limit (union) of this sequence is the CST

NC State University 41 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 42: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Properties of CST

• Every CST is finished

• If a CST is contradictory, it contains a finitecontradictory tableau τm

• Thus if a CST is a proof, it is a finite tableau.

• Every CST is finite

NC State University 42 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 43: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Soundness and completeness

What is the relationship between truth and proof?Between entailment and provability?

• Soundness means truth preserving• A logic is sound if ` p implies |= p

• Completeness means proof preserving• A logic is complete if |= p implies ` p

Logicians often will use “completeness proof” tomean a proof of both soundness and completeness

NC State University 43 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 44: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Soundness of tableau proof

• Each satisfying valuation of a formula mustagree with the labels on some path through thetableau

• No valuation can agree with a contradictory path• In a proof, all paths are contradictory

NC State University 44 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 45: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Completeness of tableau proof

• Each finished but noncontradictory pathprovides a counterexample

• Assign T to A if TA appears on the path• Assign F to A otherwise

NC State University 45 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 46: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Tableau proof from premises

• Allow a set Σ of premises for use in proofs• Add a new atomic tableau Tp for each premise p• Tp can be added to any path that does not

contradict it

NC State University 46 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 47: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Complete systematic tableaux frompremises

• Assume an enumeration of the premises• Add premises sequentially to each

noncontradictory finished path

NC State University 47 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 48: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Soundness and completeness

• Sound: Σ ` p implies Σ |= p

• Complete: Σ |= p implies Σ ` p

NC State University 48 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 49: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Compactness

Propositional logic is a compact logic• Σ |= p iff Σ′ |= p for some finite subset Σ′ ⊆ Σ

• One only needs finitely many premises to getany particular consequence

• An infinite set Σ is satisfiable iff every finitesubset of Σ is satisfiable

NC State University 49 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 50: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Deductive closure

The deductive closure of a set of propositionscontains all the statements deducible from the set• Th(Σ) = {p | Σ ` p}

Soundness and completeness mean• Th(Σ) = Cn(Σ)

NC State University 50 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 51: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Deduction theorem

If Σ is finite and∧

Σ is the conjunction of thesestatements, the following conditions are equivalent:• Σ |= α

• |=∧

Σ→ α

• Σ ` α

• `∧

Σ→ α

This shows the desired matching of truth and proof

NC State University 51 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 52: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Alternative proof systems

• Proof by intimidation• “ ‘Shut up’, he explained.”• “Five-finger” argument

• Axiomatic proofs• Natural Deduction proofs

NC State University 52 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 53: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Axiomatic logics

• Axioms• Maybe lots• Axiom schemata

• (α→ (β → α))• ((α→ (β → γ))→ ((α→ β)→ (α→ γ)))• ((¬β → ¬α)→ ((¬β → α)→ β))

• Inference rules• Usually a small set• Modus ponens

• p, p → q ` q

NC State University 53 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 54: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Axiomatic proofs

• Proof = sequence of statements• Each statement either

• An axiom, or• A conclusion of an inference rule applied to preceding

statements

• Final statement is the “theorem”

NC State University 54 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 55: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

Natural deduction proofs

• No axioms• Lots of inference rules

• Rules ` p correspond to axioms

• Introduction and discharge of assumptions• Dependency tracking

NC State University 55 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 56: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Inference

A sample proof

In the style of Kalish and Montague

Line Statement Justification Deps.1. A→ B Premise {1}2. B → C Premise {2}3. A Hypothesis {3}4. B MP 1,3 {1,3}5. C MP 2,4 {1,2,3}6. A→ C Discharge 3,5 {1,2}7. A→ B ∧ B → C ∧-introduction {1,2}8. (A→ B ∧ B → C)→ (A→ C) Discharge 7,6 {}

NC State University 56 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 57: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution

• Language• Inference method• Proof automation• Logic programming

NC State University 57 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 58: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Language

• CNF language:• Literals• Clauses• Formulas

• Set notation:• Clauses as finite sets of literals

• Empty clause � is always false• Formulae as finite sets of clauses

• Empty formula {} is always true

Sets mean syntactic irredundance

NC State University 58 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 59: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Linguistic models

• Partial truth assignment = consistent set ofliterals• Does not contain both A and ¬A• Literals in set = what is assigned T

• Complete truth assignment contains each letteror its negation

• A |= S• Means assignment A satisifies formula (set) S• For each C ∈ S, C ∩ A 6= ∅

• S (un)satisfiable iff there is an (no) assignmentthat satisfies S

NC State University 59 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 60: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Prolog

• Divide clauses into positive and negative literals• Interpret each clause as implication

• A1 ∨ . . . ∨ An ∨ ¬B1 ∨ . . . ∨ ¬Bm• B1 ∧ . . . ∧ Bm → A1 ∨ . . . ∨ An

• Horn clause: at most one positive literal• Program clause: exactly one positive literal• Prolog program = set of program clauses

NC State University 60 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 61: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Prolog notation

• Rule: some negative literals• Fact or unit clause: no negative literals• Goal clause: no positive literals

Rule A← B1, . . . , Bm A :− B1, . . . , BmFact A← A :−Goal ← B1, . . . , Bm :− B1, . . . , Bm

Nomenclature for clause parts:head :− bodygoal :− subgoals

NC State University 61 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 62: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Modus Ponens in Clausal Form

Modus Ponens:• From α and α→ β infer β

• From α and ¬α ∨ β infer β

Cut rule generalizes Modus Ponens:• From α ∨ γ and α→ β infer β ∨ γ

• From α ∨ γ and ¬α ∨ β infer β ∨ γ

NC State University 62 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 63: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution rule

Resolving on literal A:• Clause {A} ∪ C1

• Clause {¬A} ∪ C2

• Infer C1 ∪ C2

NC State University 63 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 64: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution deduction

A resolution deduction of C from S consists of• A finite sequence C1, . . . , Cn with Cn = C• Each Ci is either

• A clause in S or• The resolvent of two preceding clauses in the

sequence

NC State University 64 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 65: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution refutations

A resolution refutation of S is a resolution proof of �from S• Resolution preserves satisfiability

• Clauses {A} ∪ C1, {¬A} ∪ C2• Resolvent C1 ∪ C2

• Hence refutation is sound

NC State University 65 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 66: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution trees

A resolution tree deduction of C from S:• A labeled binary tree such that• The root is labeled with clause C• The leaves are labeled with the clauses of S• Each nonleaf node is labeled with resolvents of

its children

NC State University 66 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 67: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Resolution closure

The resolution closure R(S) of a set of clauses S isthe closure of S under the operation of takingresolutions• S ⊆ R(S)

• If C1, C2 ∈ R(S) and C is a resolvent of C1 andC2, then C ∈ R(S)

There is a resolution refutation of S iff � ∈ R(S)

NC State University 67 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 68: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Semantic analysis

Formula S, literal `

• Literal reductions:S(`) = {C ∈ R(S) | `,¬` /∈ C}• If S is unsatisfiable, then so is S(`)

• S` = {C − {`} | C ∈ S ∧ ` /∈ C}• Formula reduced by assuming ` is true• If S is unsatisfiable, both S` and S¬` must be

unsatisifable

NC State University 68 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 69: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Soundness and completeness

• S is satisfiable iff either S` or S¬` is satisfiable• The unsatisifiable sentences U are generated

by• If � ∈ S, then S ∈ U• If S` ∈ U and S¬` ∈ U, then S ∈ U

• If S is unsatisfiable, then � ∈ R(S)

NC State University 69 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 70: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Computational complexity

SAT = set of all satisfiable formulae

Is S satisfiable?• Resolution answer

• 2-SAT is linear time• SAT is NP-complete• 3-SAT is NP-complete

This is good news too, not just bad;more on this later

NC State University 70 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 71: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Restricted resolution

• T -resolution: never resolve a tautology• Semantic resolution: one parent is falsified by

assignment A• Ordered resolution: order letters, always resolve

on highest-index letter possible• Support restriction: never resolve two clauses

outside support clauses

These are sound and complete, but others are not

NC State University 71 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 72: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Linear resolution

A linear resolution deduction of C from S is asequence of pairs 〈C0, B0〉, . . . , 〈Cn, Bn〉 such that• C = Cn

• C0 ∈ S• Each Bi is either in S or is some preceding Cj

• Each Ci+1 is a resolvent of Ci and Bi .

C is linearly deducible (refutable) from S if there is alinear deduction (refutation) of C from S

NC State University 72 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 73: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Nomenclature

• S = input clauses• C0 = starting clauses• Ci = center clauses• Bi = side clauses

NC State University 73 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 74: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Soundness and completeness

• Linear resolution is sound (by restriction)• Linear resolution is complete

NC State University 74 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 75: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Linear input resolution

• Starts with goal clause• All side clauses are input clauses

• Incomplete in general• Consider all clauses of two literals

• Complete when all inputs are program clauses

NC State University 75 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 76: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Refinements• LD-resolution = linear definite resolution

• Ordered literals = definite clauses• Resolutions maintain ordering within insertions

• SLD-resolution = selected linear definiteresolution• Resolutions follow syntactic ordering of literals• Prolog: always resolve on first goal literal

Both are sound and complete

NC State University 76 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle

Page 77: Computational Applied Logic · Propositional logic Statements and their uses What things can one express? •Sounds/exclamations/marks •Words •Statements •Sets of statements

Propositional logic Resolution

Search and backtracking

• Success and failure on resolution paths• Success = find � on path• Failure = end path with no �

• Search all paths until success or exhaustion

• Depth-first search, breadth-first search, etc.• Pure backtracking DFS can fail!• “Intelligent” backtracking schemes

NC State University 77 / 77CSC 503 Fall 2005

c© 2005 by Jon Doyle