159.302LECTURE 159.302 LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Inference Rules Universal Instantiation Existential Generalization
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Logic Use mathematical deduction to derive new knowledge.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Propositional Logic Russell and Norvig: Chapter 6 Chapter 7, Sections 7.1—7.4 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Logic Concepts Lecture Module 11.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
ITCS 3153 Artificial Intelligence Lecture 11 Logical Agents Chapter 7 Lecture 11 Logical Agents Chapter 7.
Knowledge Representation I (Propositional Logic) CSE 473.
Methods of Proof Chapter 7, second half.
Cooperating Intelligent Systems Logical agents Chapter 7, AIMA This presentation owes some to V. Rutgers and D. OSU.
Knoweldge Representation & Reasoning
Artificial Intelligence
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Chapter 3 Propositional Logic
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
I NTRO TO L OGIC Dr Shlomo Hershkop March
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
Knowledge Representation Use of logic. Artificial agents need Knowledge and reasoning power Can combine GK with current percepts Build up KB incrementally.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 05 : Knowledge Base & First Order Logic.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Review: What is a logic? A formal language –Syntax – what expressions are legal –Semantics – what legal expressions mean –Proof system – a way of manipulating.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 04 : Logic.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Knowledge Representation and Reasoning
The Propositional Calculus
ARTIFICIAL INTELLIGENCE
Logical Inference: Through Proof to Truth
Logical Agents Reading: Russell’s Chapter 7
Logic Use mathematical deduction to derive new knowledge.
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Back to “Serious” Topics…
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Presentation transcript:

LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare

Propositional Logic What is a logic? A formal language

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal Semantics – what legal expressions mean

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal Semantics – what legal expressions mean Proof System – a way of manipulating syntactic expressions to get other syntactic expressions (which will tell us something new)

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal Semantics – what legal expressions mean Proof System – a way of manipulating syntactic expressions to get other syntactic expressions (which will tell us something new) Why proofs? Two kinds of inferences an agent might want to make:

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal Semantics – what legal expressions mean Proof System – a way of manipulating syntactic expressions to get other sytactic expressions (which will tell us something new) Why proofs? Two kinds of inferences an agent might want to make: Multiple percepts => conclusions about the world

Propositional Logic What is a logic? A formal language Syntax – what expressions are legal Semantics – what legal expressions mean Proof System – a way of manipulating syntactic expressions to get other sytactic expressions (which will tell us something new) Why proofs? Two kinds of inferences an agent might want to make: Multiple percepts => conclusions about the world Current state & operator => properties of next state

Propositional Logic Syntax: what you’re allowed to write for( thing t=fizz; t == fuzz; t++ ){…}

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously.

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously. Sentences (wffs: well-formed formulas)

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) true and false are sentences

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously. Sentences (wwfs: well-formed formulas) true and false are sentences Propositional variables are sentences: P, Q, R, Z

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously. Sentences (wffs: well-formed formulas) true and false are sentences Propositional variables are sentences: P, Q, R, Z If φ and ψ are sentences, then so are

Propositional Logic Syntax: what you’re allowed to write for(thing t=fizz; t == fuzz; t++){…} Colorless green ideas sleep furiously. Sentences (wffs: well-formed formulas) true and false are sentences Propositional variables are sentences: P, Q, R, Z If φ and ψ are sentences, then so are Nothing else is a sentence

Precedence

LECTURE LECTURE Propositional Logic Semantics 2 Source: MIT OpenCourseWare

Propositional Logic Semantics Meaning of a sentence is truth value {t, f}

Propositional Logic Semantics Meaning of a sentence is truth value {t, f} Interpretation is an assignment of truth values to the propositional variables holds(, i) [Sentence is t in interpretation i]

Propositional Logic Semantics Meaning of a sentence is truth value {t, f} Interpretation is an assignment of truth values to the propositional variables holds(, i) [Sentece is t in interpretation i] fails(, i) [Sentence is f in interpretation i]

Propositional Logic Semantic Rules holds(true, i) for all i

Propositional Logic Semantic Rules holds(true, i) for all i fails(false, i) for all i

Propositional Logic Semantic Rules holds(true, i) for all i fails(false, i) for all i holds(, i) if and only if fails(, i) (negation)

Propositional Logic Semantic Rules holds(true, i) for all i fails(false, i) for all i holds(, i) if and only if fails(, i) (negation) holds(, i) iff holds(,i) and holds(, i) (conjunction)

Propositional Logic Semantic Rules holds(true, i) for all i fails(false, i) for all i holds(, i) if and only if fails(, i) (negation) holds(, i) iff holds(,i) and holds(, i) (conjunction) holds(, i) iff holds(,i) or holds(, i) (disjunction)

Propositional Logic Semantic Rules holds(true, i) for all i fails(false, i) for all i holds(, i) if and only if fails(, i) (negation) holds(, i) iff holds(,i) and holds(, i) (conjunction) holds(, i) iff holds(,i) or holds(, i) (disjunction) holds( P, i) iff i(P) = t fails( P, i) iff i(P) = f

Propositional Logic Some important shorthand (antecedent consequent)

Propositional Logic Some important shorthand (antecedent consequent)

Propositional Logic Some important shorthand (antecedent consequent) fftffttt fttfttff tffftftf ttfttttt

Propositional Logic Some important shorthand (antecedent consequent) fftffttt fttfttff tffftftf ttfttttt Note that implication is not “causality”, if P is f then is t Implication doesn't mean "is related" in any kind of real-world way

Propositional Logic Terminology A sentence is valid iff its truth value is t in all interpretations A sentence is satisfiable iff its truth value is t in at least one interpretation A sentence is unsatisfiable iff its truth value is f in all interpretations All are finitely decidable.

Examples SentenceValid?Interpretation that make sentence’s truth value = f valid satisfiable, not valid valid contrapositive

Examples SentenceValid?Interpretation that make sentence’s truth value = f valid satisfiable, not valid valid contrapositive

Examples SentenceValid?Interpretation that make sentence’s truth value = f valid satisfiable, not valid valid contrapositive

Examples SentenceValid?Interpretation that make sentence’s truth value = f valid satisfiable, not valid valid contrapositive

Examples SentenceValid?Interpretation that make sentence’s truth value = f valid satisfiable, not valid valid contrapositive

Satisfiability Related to constraint satisfaction Given a sentence S, try to find an interpretation i such that holds(S,i) Analogous to finding an assignment of values to variables such that the constraints hold

Satisfiability Related to constraint satisfaction Given a sentence S, try to find an interpretation i such that holds(S,i) Analogous to finding an assignment of values to variables such that the constraints hold Brute force method: enumerate all interpretations and check

Satisfiability Related to constraint satisfaction Given a sentence S, try to find an interpretation i such that holds(S,i) Analogous to finding an assignment of values to variables such that the constraints hold Brute force method: enumerate all interpretations and check Better methods: Heuristic search Constraint propagation Stochastic search

Satisfiability Problems Scheduling nurses to work in a hospital propositional variables represent for example, that Pat is working on Tuesday at 2pm constraints on the schedule are represented using logical expressions over the variables Finding bugs in software propositional variables represent state of the program use logic to describe how the program works and to assert there is a bug if the sentence is satisfiable, you’ve found the bug!

LECTURE LECTURE Propositional Logic Proof 3 Source: MIT OpenCourseWare

A Good lecture? Imagine we knew that: If today is sunny, then Tomas will be happy Should we conclude that the lecture will be good? If Tomas is happy, the lecture will be good Today is sunny

Checking Interpretations SHG S H H G SGttttttt ttftftf tftfttt tfffttf fttttft ftftfff fftttft fffttff Good lecture!

Adding a variable LSHG S H H G SGtttttttt tttftftf ttftfttt ttfffttf tfttttft tftftfff tfftttft tfffttff fttttttt fttftftf …………

Entailment KBentailsS KBSA knowledge base (KB) entails a sentence S iff every interpretation that makes KB true also makes S true

Computing Entailment enumerate all interpretations KB select those in which all elements of KB are true S check to see if S is true in all of those interpretations

Computing Entailment enumerate all interpretations KB select those in which all elements of KB are true S check to see if S is true in all of those interpretations Way too many interpretations, in general!!

Entailment and Proof proof A proof is a way to test whether a KB entails a sentence, without enumerating all possible interpretations

Proof proof A proof is a sequence of sentences KB First ones are premises (KB) inference rule Then, you can write down on the next line the result of applying an inference rule to previous lines provedSKB When S is on a line, you have proved S from KB soundSKBKB If inference rules are sound, then any S you can prove from KB is entailed by KB completeSKB KB If inference rules are complete, then any S that is entailed by KB can be proven from KB

Natural Deduction inference rules Some inference rules: Modus ponens

Natural Deduction Some inference rules: Modus ponensModus tolens

Natural Deduction Some inference rules: Modus ponensModus tolensAnd- Introduction

Natural Deduction Some inference rules: Modus ponensModus tolensAnd- Introduction And- Elimination

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given Prove S

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given 4P 1 And-Elim Prove S

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given 4P 1 And-Elim 5R 4,2 Modus-Ponens Prove S

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given 4P 1 And-Elim 5R 4,2 Modus-Ponens 6Q 1 And-Elim Prove S

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given 4P 1 And-Elim 5R 4,2 Modus-Ponens 6Q 1 And-Elim 7 5,6 And-Intro Prove S

Natural Deduction Example StepFormulaDerivation1Given 2Given 3Given 4P 1 And-Elim 5R 4,2 Modus-Ponens 6Q 1 And-Elim 7 5,6 And-Intro 8S 7,3 Modus-Ponens Prove S

Proof Systems There are many natural deduction systems; they are typically “proof checkers”, sound but not complete

Proof Systems There are many natural deduction systems; they are typically “proof checkers”, sound but not complete Natural deduction Natural deduction uses lots of inference rules which introduces a large branching factor in the search for a proof.

Proof Systems There are many natural deduction systems; they are typically “proof checkers”, sound but not complete Natural deduction Natural deduction uses lots of inference rules which introduces a large branching factor in the search for a proof. proof by cases In general, you need to do “proof by cases” which introduces even more branching.StepFormula1 2 3 Prove R

Propositional Resolution Resolution rule: Single inference rule is a sound and complete proof system Requires all sentences to be converted to conjunctive normal form

LECTURE LECTURE Propositional Logic Conjunctive Normal Form (CNF) 4 Source: MIT OpenCourseWare

Conjunctive Normal Form CNF Formulas:

Conjunctive Normal Form CNF Formulas:

Conjunctive Normal Form CNF Formulas:, which is a disjunction of literals

Conjunctive Normal Form CNF Formulas:, which is a disjunction of literals

Conjunctive Normal Form CNF Formulas:, which is a disjunction of literals, each of which is a variable or the negation of a variable.

Conjunctive Normal Form CNF Formulas:, which is a disjunction of literals, each of which is a variable or the negation of a variable. Each clause is a requirement that must be satisfied and can be satisfied in multiple ways Each clause is a requirement that must be satisfied and can be satisfied in multiple ways

Conjunctive Normal Form CNF Formulas:, which is a disjunction of literals, each of which is a variable or the negation of a variable. Each clause is a requirement that must be satisfied and can be satisfied in multiple ways Each clause is a requirement that must be satisfied and can be satisfied in multiple ways Every sentence in propositional logic can be written in CNF Every sentence in propositional logic can be written in CNF

Converting to CNF 1.Eliminate arrows using definitions

Converting to CNF 1.Eliminate arrows using definitions 2.Drive in negations using De Morgan’s Laws

Converting to CNF 1.Eliminate arrows using definitions 2.Drive in negations using De Morgan’s Laws 3.Distribute or over and

Converting to CNF 1.Eliminate arrows using definitions 2.Drive in negations using De Morgan’s Laws 3.Distribute or over and 4.Every sentence can be converted to CNF, but it may grow exponentially in size

CNF Conversion Example

1.Eliminate arrows using definitions

CNF Conversion Example 1.Eliminate arrows using definitions 2.Drive in negations using De Morgan’s Laws

CNF Conversion Example 1.Eliminate arrows using definitions 2.Drive in negations using De Morgan’s Laws 3.Distribute or over and

LECTURE LECTURE Propositional Resolution 5 Source: MIT OpenCourseWare

Propositional Resolution Resolution rule: Convert all sentences to CNF Negate the desired conclusion (converted to CNF) Resolution refutation: Apply resolution rule until either Derive false (a contradiction) Can’t apply anymore soundcomplete Resolution refutation is sound and complete If we derive a contradiction, then the conclusion follows from the axioms If we can’t apply anymore, then the conclusion cannot be proven from the axioms

Propositional Resolution StepFormula1 2 3 Prove RStepFormulaDerivation1Given 2Given 3Given 4 Negated conclusion 51,2 62,4 73,4 85,7 9▪4,8

Propositional Resolution StepFormula1 2 3 Prove RStepFormulaDerivation1Given 2Given 3Given 4 Negated conclusion 51,2 62,4 73,4 85,7 9▪4,8

Propositional Resolution StepFormula1 2 3 Prove RStepFormulaDerivation1Given 2Given 3Given 4 Negated conclusion 51,2 62,4 73,4 85,7 9▪4,8 unnecessary

The Power of False StepFormula1 2 Prove ZStepFormulaDerivation1Given 2Given 3 Negated conclusion 4▪1,2 Any conclusion follows from a contradiction – and so strict logic systems are very brittle.

Example Problem StepFormula1 2 3 Prove R Convert to CNF

Example Problem Step Neg Prove RStepFormula1 2 3

Example Problem Step Neg 84,7 96,8 101,9 113,10 12▪7,11 Prove RStepFormula1 2 3

Proof Strategies Produces a shorter clause – which is good since we are trying to produce a zero-length clause, that is, a contradiction. Unit Preference: prefer a resolution step involving a unit clause (clause with one literal). We’re trying to produce a contradiction that follows from the negated goal, so these are “relevant” clauses Set of support: choose a resolution involving the negated goal or any clause derived from the negated goal. If a contradiction exists, one can find one using the set-of-support strategy.