ai propsitional logic

Upload: ambynith

Post on 10-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 AI Propsitional Logic

    1/88

    Propositional Logic-

    Introduction

  • 8/8/2019 AI Propsitional Logic

    2/88

    Outline

    Symbolic AI

    Some Applications of Propositional Logic

    Propositional Logic

    Syntax

    Semantic

    Truth Table

    Inference rules Limitations of Propositional Logic

  • 8/8/2019 AI Propsitional Logic

    3/88

    Symbolic AI

    AI relies on the Physical Symbol System Hypothesis:

    Intelligent activity is achieved through the use of

    symbol patterns to represent the problem operations on those patterns to generate potential solutions

    search to select a solution among the possibilities

    An AI representation language must

    handle qualitative knowledge

    allow new knowledge to be inferred from facts & rules

    allow representation of general principles

    capture complex semantic meaning

    allow for meta-level reasoning

    e.g., Predicate Calculus (also, the basis of Prolog)

  • 8/8/2019 AI Propsitional Logic

    4/88

    Logic

    A tool for reasoning

    Provides basic concept used in many

    computer science fields (Artificial Intelligence,

    Information Retrieval, DataBases etc. )

  • 8/8/2019 AI Propsitional Logic

    5/88

    A logic language consists of semantics and syntax

    Semantics:What the sentences mean.

    Syntax: How sentences can be assembled.

  • 8/8/2019 AI Propsitional Logic

    6/88

    Formal Logic

    Step 1: Use certain symbols to express the abstract

    form of certain statements

    Step 2: Use a certain procedure based on these

    abstract symbolizations to figure out certain logicalproperties of the original statements.

  • 8/8/2019 AI Propsitional Logic

    7/88

    Truth Tables

    Slow

    Systematic

    Reveals consequence as well as non-

    consequence

    Only works for truth-functional logic

  • 8/8/2019 AI Propsitional Logic

    8/88

    Formal Proofs

    Pretty fast (with practice!)

    Not systematic

    Can only reveal consequence

    Can be made into systematic method (that can then

    also check for non-consequence) but becomes

    inefficient

    Can be used for predicate logic

  • 8/8/2019 AI Propsitional Logic

    9/88

    Truth Trees

    Fast

    Systematic

    Can reveal consequence as well as non-consequence

    Can be used for truth-functional as well as

    predicate logic

  • 8/8/2019 AI Propsitional Logic

    10/88

    Propositional Satisfiability

    Find the truth assignment that satisfies logical sentence

    Propositional SatisfiabilityTesting:

    1990: 100 variables/200 clauses (constraints)

    1998: 10,000-100,000 variables/10^6 clauses

    Some Applications:

    Diagnosis, workflow analysis, planning, software/circuit

    testing, machine learning, bioinformatics

  • 8/8/2019 AI Propsitional Logic

    11/88

  • 8/8/2019 AI Propsitional Logic

    12/88

  • 8/8/2019 AI Propsitional Logic

    13/88

    Electronic Circuit

    &

    &

    1

    1

    P

    Q

    R

  • 8/8/2019 AI Propsitional Logic

    14/88

    Formal Languages and CommitmentsLanguage Ontological

    CommitmentEpistemologicalCommitment

    Propositional Logic facts true, false, unknown

    First-order Logic facts, objects,

    relations

    true, false, unknown

    Temporal Logic facts, objects,

    relations, times

    true, false, unknown

    Probability Theory facts degree of belief [0,1]

    Fuzzy Logic facts with degree of

    truth [0,1]

    known interval

    value

  • 8/8/2019 AI Propsitional Logic

    15/88

    MotivationMotivation formal methods to perform reasoning are required when dealing

    with knowledge

    propositional logic is a simple mechanism for basic reasoning tasks

    it allows the description of the world via sentences

    simple sentences can be combined into more complex ones

    new sentences can be generated by inference rules applied to existingsentences

    predicate logic is more powerful, but also considerably morecomplex

    it is very general, and can be used to model or emulate many othermethods

    although of high computational complexity, there is a subclass that can betreated by computers reasonably well

  • 8/8/2019 AI Propsitional Logic

    16/88

    ObjectivesObjectives know the important aspects of propositional and predicate logic

    syntax, semantics, models, inference rules, complexity

    understand the limitations of propositional and predicate logic

    apply simple reasoning techniques to specific tasks

    learn about the basic principles of predicate logic

    apply predicate logic to the specification of knowledge-basedsystems

    use inference rules to deduce new knowledge from existingknowledge bases

  • 8/8/2019 AI Propsitional Logic

    17/88

    Evaluation Criteria

    check sentences for syntactical correctness

    check if a sentence is true or false

    formulate simple sentences for simple

    problems

  • 8/8/2019 AI Propsitional Logic

    18/88

    Concerns What does it mean to say a statement is true?

    What are sound rules for reasoning

    What can we represent in propositional logic?

    What is the efficiency?

    Can we guarantee to infer all true statements?

  • 8/8/2019 AI Propsitional Logic

    19/88

    Propositional Logic a relatively simple framework for reasoning

    can be extended for more expressiveness at the cost ofcomputational overhead

    important aspects

    syntax semantics

    validity and inference

    models inference rules

    complexity

  • 8/8/2019 AI Propsitional Logic

    20/88

    Semantics Model = possible world

    x+y = 4 is true in the world x=3, y=1.

    x+y = 4 is false in the world x=3, y = 1.

    Entailment S1,S2,..Sn |= S means in every world whereS1Sn are true, S is true.

    Some cognitive scientists argue that this is the way people

    reason.

  • 8/8/2019 AI Propsitional Logic

    21/88

    Reasoning or Inference Systems

    Proof is a syntactic property.

    Rules for deriving new sentences from old ones.

    Sound: any derived sentence is true.

    Complete: any true sentence is derivable.

    NOTE: Logical Inference is monotonic.

  • 8/8/2019 AI Propsitional Logic

    22/88

    Forms of Reasoning:

    Deduction,Abduction,

    InductionTheorem Proving,

    Sherlock Holmes,

    and All Swans are White...

  • 8/8/2019 AI Propsitional Logic

    23/88

    Basic Types of Inferences: Induction

    Induction: Derive a general rule (axiom) from backgroundknowledge and observations.

    Example:

    Socrates is a human (background knowledge)

    Socrates is mortal (observation/ example)

    Therefore, I hypothesize that all humans are mortal (generalization)

    Remarks:

    Induction means to infer generalized knowledge from exampleobservations: Induction is the inference mechanism for (machine)learning.

  • 8/8/2019 AI Propsitional Logic

    24/88

    Basic Types of Inferences: Abduction Abduction: From a known axiom (theory) and some

    observation, derive a premise.

    Example:

    All humans are mortal (theory)Socrates is mortal (observation)

    Therefore, Socrates must have been a human (diagnosis)

    Remarks:

    Abduction is typical for diagnostic and expert systems. If one has the flue, one has moderate fewer. Patient X has moderate fewer. Therefore, he has the flue.

    Strong relation to causation

  • 8/8/2019 AI Propsitional Logic

    25/88

    Deduction

    Deductive inferences are also called theorem

    proving or logical inference.Deduction is truth preserving: If the premises (axioms

    and facts) are true, then the conclusion (theorem) is

    true.

    To perform deductive inferences on a machine, acalculus is needed:

    A calculus is a set of syntactical rewriting rules definedfor some (formal) language. These rules must be soundand should be complete.

  • 8/8/2019 AI Propsitional Logic

    26/88

    Proposition A proposition is a symbolic variables whose value must

    be either True or False, and which stands for a natural

    language statement which could be either true or false

    Examples:

    A = Smith has chest pain

    B = Smith is depressed

    C = it is raining

  • 8/8/2019 AI Propsitional Logic

    27/88

    Propositional Logic

    Representing simple facts

    It is raining

    RAINING

    It is sunny

    SUNNY

    It is windy

    WINDY

    If it is raining, then it is not sunny

    RAINING SUNNY

  • 8/8/2019 AI Propsitional Logic

    28/88

    Propositional Logic

    VocabularyA set ofpropositionalsymbols

    P, Q, R, .

    A set of logical connectives

    , , ,,

    (and) (or) (not) (implication) (equivalence)

    Parenthesis (for grouping)( )

    Logical constantsTrue,False

  • 8/8/2019 AI Propsitional Logic

    29/88

    Propositional Logic

    Each symbol P, Q, R etc is a (atomic) sentence

    Both True and False are (atomic) sentences

    A sentence enclosed in parentheses is a sentence

    If and are sentences, then so are

    conjunction disjunction negation implication

    equivalence

    The above are complex sentences

    Precedence is , , , ,

  • 8/8/2019 AI Propsitional Logic

    30/88

    BNF Grammar Propositional Logic

    Sentence AtomicSentence | ComplexSentence

    AtomicSentence True | False | P | Q | R | ...

    ComplexSentence (Sentence )

    | Sentence Connective Sentence

    | Sentence

    Connective | | |

    ambiguities are resolved through precedence or parenthesese.g. P Q R S is equivalent to ( P) (Q R)) S

  • 8/8/2019 AI Propsitional Logic

    31/88

    Truth Tables for Connectives

    PTrue

    TrueFalseFalse

    P QFalseFalseFalseTrue

    P QFalse

    TrueTrueTrue

    P Q

    TrueTrueFalseTrue

    P QTrue

    FalseFalseTrue

    QFalse

    TrueFalseTrue

    PFalse

    FalseTrueTrue

  • 8/8/2019 AI Propsitional Logic

    32/88

    Sample Sentences

    P (P Q) RTrue (P Q) (Q P)(P Q) (P R )

    What do the sentences mean?

    The meaning depends on user defined semantics. If P is defined asit is hot and Q is defined as it is raining, then

    P means it is hotP Q means either is hot or it is raining (or both)Q means that it is not raining

  • 8/8/2019 AI Propsitional Logic

    33/88

    Well- Formed Formulas Formula

    A term (string) in propositional logic.

    Well formed formula (WFF)

    A term that is constructed correctly according topropositional logic syntax rules.

  • 8/8/2019 AI Propsitional Logic

    34/88

    WFF Constants: False, True

    Variables: P,Q,R

    If a and b are WFF, a b are WFF

    If a and b are WFF, a b are WFF

    If a and b are WFF, ab are WFF

    If a and b are WFF, ab are WFF

    Any formula that cannot be constructed using these rulesare not WFF.

  • 8/8/2019 AI Propsitional Logic

    35/88

    Semantics interpretation of the propositional symbols and constants

    symbols can stand for any arbitrary fact

    sentences consisting of only a propositional symbols are satisfiable, but notvalid

    the value of the symbol can be True or False

    must be explicitly stated in the model

    the constants True and False have a fixed interpretation

    True indicates that the world is as stated

    False indicates that the world is not as stated

    specification of the logical connectives

    frequently explicitly via truth tables

  • 8/8/2019 AI Propsitional Logic

    36/88

    Semantics Interpretation

    Evaluation function of a formula Properties of wffs

    Valid / tautology

    Satisfiable

    Contradiction

    Equivalent formulas

  • 8/8/2019 AI Propsitional Logic

    37/88

    Semantics A formula F is a logical consequence of a formula P

    A formula F is a logical consequence of a set of formulas P1,Pn

    Notation of logical consequence P1,PnF.

    Theorem. Formula F is a logical consequence of a set of formulas P1,Pn if the formula P1,Pn F isvalid.

    Theorem. Formula F is a logical consequence of a setof formulas P1,Pn if the formula P1 Pn ~F is acontradiction.

  • 8/8/2019 AI Propsitional Logic

    38/88

    Some terms: summary

    The meaning or semantics of a sentence determinesits interpretation.

    Given the truth values of all symbols in a sentence, itcan be evaluated to determine its truth value

    (True or False).

    A model for a KB is a possible world (assignmentof truth values to propositional symbols) in whicheach sentence in the KB is True.

  • 8/8/2019 AI Propsitional Logic

    39/88

    39

    More terms A valid sentence or tautology is a sentence that is True

    under all interpretations, no matter what the world is actuallylike or how the semantics are defined. Example: Its raining or

    its not raining.

    An inconsistent sentence or contradiction is a sentencethat is False under all interpretations. The world is never like

    what it describes, as in Its raining and its not raining.

    P entails Q, written P |= Q, means that whenever P is True,

    so is Q. In other words, all models of P are also models of Q.

    M d l

  • 8/8/2019 AI Propsitional Logic

    40/88

    Models

    if there is an interpretation for a sentence such that

    the sentence is true in a particular world, that world is

    called a model

    refers to specific interpretations

    models can also be thought of as mathematical objects these mathematical models can be viewed as equivalence

    classes for worlds that have the truth values indicated by

    the mapping under that interpretation

    a model then is a mapping from proposition symbols to

    True or False

  • 8/8/2019 AI Propsitional Logic

    41/88

    Propositional Logic: Semantics A modelMM of a propositional language consists of

    a collection of atoms, say B = { bi : 0 < i }, where _|_ is

    excluded from B, and

    a partial mapping M from

    A = { ai : 0 < i } to B = { bi : 0 < i }.

    IfM(ai) B, we say that ai is true inM.M.

    We write ai is true inMM asMM |= ai. (ReadMM satisfies ai).

    |= is referred to as the satisfaction relation.

  • 8/8/2019 AI Propsitional Logic

    42/88

    Propositional Semantics Extend M, and therefore the satisfaction relation to

    all propositions using the following inductive

    definition:

    MM |= X ^ Y iff MM |= X and MM |= Y.

    MM |= X v Y iff MM |= X or MM |= Y.

    MM |= X => Y if MM |= X then MM |= Y.

    MM |= X, if it is not the case that MM |= X.

  • 8/8/2019 AI Propsitional Logic

    43/88

    Propositional Logic: Example B = { a1, a3} where M given as

    M(a1) = a1 and M(a2) = a2 has the following properties.

    MM |= a1

    MM |= a1 a3MM |= a2MM |= a2 a4

    MMdoes not satisfy the following propositions.

    MM |= a4

    MM |= a1 a4

  • 8/8/2019 AI Propsitional Logic

    44/88

    Models and Entailment a sentence is entailed by a knowledge base KB if the models of

    the knowledge base KB are also models of the sentence

    KB |= inference rules allow the construction of new sentences from

    existing sentences

    an inference procedure generates new sentences on the basis ofinference rules

    if all the new sentences are entailed, the inference procedure iscalled sound or truth-preserving

  • 8/8/2019 AI Propsitional Logic

    45/88

    Tautology and Contradiction

    Tautology: proposition that is always trueMale V ~Male

    Contradiction: proposition that is always false.

    Healthy ~Healthy

  • 8/8/2019 AI Propsitional Logic

    46/88

    Suppose we want to prove (P Q) (P Q)

    An inference procedure for proposition logic

    Construct a truth table, if(P Q) (P Q) is true for allvalues of P and Q, then we have proved it.

    For any sentence, no matter how complex, we can always

    prove or disprove it this way. In other words, truth tableconstruction is complete.

  • 8/8/2019 AI Propsitional Logic

    47/88

    Equivalence rules

    P)(QQ)(PQPnimplicatiodoubleEliminate

    QP~QPnImplicatioEliminate

    Q~P~Q)(P~Q~P~Q)(P~MorganDe

    R)(PQ)(PR)(QPR)(PQ)(PR)(QPveDistributi

    PQQPPQQPPQQPComutative

    R)(QPRQ)(PR)(QPRQ)(PAsociative

    PPPPPPIdempotent

  • 8/8/2019 AI Propsitional Logic

    48/88

    Inference RulesSome patterns of reasoning are so common that instead of creating a truth tableeach time we see them, we can just establish their truth once, then reuse the

    pattern in any situation.

    IrishHot, Irish |- HotIf we know Irish implies hot is true and know

  • 8/8/2019 AI Propsitional Logic

    49/88

    If we know Irish implies hot is true, and knowIrish is true, we can infer Hot is true. Read as

    Irish implies Hot, Irish, Therefore Hot

    Irish Blue |- BlueIf we know Irish and Blue is true, we can inferthat Blue is true. Read as

    Irish and Blue Therefore Blue

    Irish, Red |- Irish RedIf we know Irish is true, and we know Red is true,

    we can infer that Irish and Red is true. Read asIrish , Red Therefore Irish and Red

  • 8/8/2019 AI Propsitional Logic

    50/88

    Irish |- Irish GreenIf we know Irish is true, then we know that Irishor Green is true. Read as

    Irish, Therefore Irish or Green

    Irish |- IrishIf we know not not Irish is true, we can infer thatIrish is true. Read as

    Not not Irish, Therefore Irish

    Irish Red, Red Fast |- Irish FastIf we know Irish or Red is true, and we know not Red or Fast is true, wecan infer that Irish or Fast must be true. Read as

    Irish or Red, not Red or Fast, Therefore Irish or Fast

    Suppose the knowledge base consists of the facts

  • 8/8/2019 AI Propsitional Logic

    51/88

    Suppose the knowledge base consists of the facts

    S T (P R)STR

    And we need to prove P is entailed. We can use the rules ofinference to do this..

    S T (P R) , S , T And-Introduction

    S T (P R) , S T Double Negation EliminationS T (P R) , (S T) Modus ponens(P R) And-EliminationP Double Negation Elimination

    P

    So the rules of inference allow us to (sometimes) bypass having to

    build truth tables.

  • 8/8/2019 AI Propsitional Logic

    52/88

    Logical Inference also referred to as deduction

    implements the entailment relation for sentences

    validity a sentence is valid if it is true under all possible interpretations in all possible

    world states

    independent of its intended or assigned meaning

    independent of the state of affairs in the world under consideration valid sentences are also called tautologies

    satisfiability

    a sentence is satisfiable if there is some interpretation in some world state (a

    model) such that the sentence is true a sentence is satisfiable iff its negation is not valid

    a sentence is valid iff its negation is not satisfiable

  • 8/8/2019 AI Propsitional Logic

    53/88

    Computational Inference computers cannot reason informally (common sense)

    they dont know the interpretation of the sentences they usually dont have access to the state of the real world to

    check the correspondence between sentences and facts

    computers can be used to check the validity of sentences if the sentences in a knowledge base are true, then the

    sentence under consideration must be true, regardless of itspossible interpretations

    can be applied to rather complex sentences

    Computational Approaches

  • 8/8/2019 AI Propsitional Logic

    54/88

    Computational Approaches

    to Inference model checking based on truth tables

    generate all possible models and check them for validity or satisfiability

    exponential complexity, NP-complete

    all combinations of truth values need to be considered

    search

    use inference rules as successor functions for a search algorithm

    also exponential, but only worst-case

    in practice, many problems have shorter proofs

    only relevant propositions need to be considered

  • 8/8/2019 AI Propsitional Logic

    55/88

    Validity and Inference truth tables can be used to test sentences for

    validityone row for each possible combination of truth

    values for the symbols in the sentence

    the final value must be True for every sentencea variation of the model checking approach

    not very practical for large sentences

    sometimes used with customized improvements inspecific domains, such as VLSI design

  • 8/8/2019 AI Propsitional Logic

    56/88

    Validity and Computers the computer has no access to the real world, and cant

    check the truth value of individual sentences (facts)

    humans often can do that, which greatly decreases thecomplexity of reasoning

    humans also have experience in considering only important

    aspects, neglecting others if a conclusion can be drawn from premises, independent of

    their truth values, then the sentence is valid

    usually too tedious for humans

    may exclude potentially interesting sentences

    some, but not all interpretations are true

  • 8/8/2019 AI Propsitional Logic

    57/88

    Propositional Logic: Proofs

    What formulas hold in all models ?

    i.e. can we check if a given proposition is true

    in all models without going through all

    possible models?

    Need proofs to answer this question.

    We use Natural Deduction proofs.

  • 8/8/2019 AI Propsitional Logic

    58/88

    Propositional Proofs: Examples Prove: ( A B ) (A B)

    Notice:The outermost connective is. Hence, the last step ofthe proof must be an implication introduction.

    That means, we must assume ( A B ) and prove(A B), and then discharge the assumption by using introduction rule.

    In order to prove (A B) from ( A B ), we must useintroduction, and hence must prove either A or Bfrom ( A B ).This plan forms a skeleton of a proof.

    P P f E l C i d

  • 8/8/2019 AI Propsitional Logic

    59/88

    Prop. Proof: Example Continued

    Prove: ( A B ) (A B)(A ^ B)

    A ^ elimination

    A v B v introduction

    ( A ^ B ) => (A v B) => introduction

    Proofs are analyzed backwards, i.e. start unraveling the

    logical structure of the conclusion and work backwards tothe assumptions.

  • 8/8/2019 AI Propsitional Logic

    60/88

    Derived Rules These are rules derived from other rules.

    Example:A ^ B

    B ^ A

    Here is the derivation:A ^ B B ^ A

    B A^

    elimination

    B ^ A ^ introduction

    Inference rules

  • 8/8/2019 AI Propsitional Logic

    61/88

    61

    Inference rules

    Logical inference is used to create new sentences that

    logically follow from a given set of predicate calculus

    sentences (KB).

    An inference rule is sound if every sentence X produced

    by an inference rule operating on a KB logically follows

    from the KB. (That is, the inference rule does not create

    any contradictions)

    An inference rule is complete if it is able to produce

    every expression that logically follows from (is entailed by)

    the KB. (Note the analogy to complete search algorithms.)

    Sound rules of inference

  • 8/8/2019 AI Propsitional Logic

    62/88

    62

    Sound rules of inference

    Here are some examples of sound rules of inference

    A rule is sound if its conclusion is true whenever the premise is true

    Each can be shown to be sound using a truth table

    RULE PREMISE CONCLUSION

    Modus Ponens A, A B B

    And Introduction A, B A B

    And Elimination A B A

    Double Negation A AUnit Resolution A B, B A

    Resolution A B, B C A C

    Soundness of modus ponens

  • 8/8/2019 AI Propsitional Logic

    63/88

    63

    Soundness of modus ponens

    A B A

    B OK?

    True True True True False False

    False True True False False True

    Soundness of the

  • 8/8/2019 AI Propsitional Logic

    64/88

    64

    resolution inference rule

  • 8/8/2019 AI Propsitional Logic

    65/88

    Proving things A proofis a sequence of sentences, where each sentence iseither a premise or a sentence derived from earlier sentencesin the proof by one of the rules of inference.

    The last sentence is the theorem (also called goal or query)that we want to prove.

    Example for the weather problem given above.

    1 Humid Premise It is humid

    2 HumidHot Premise If it is humid, it is hot

    3 Hot Modus Ponens(1,2) It is hot

    4 (HotHumid)Rain Premise If its hot & humid, its raining

    5 HotHumid And Introduction(1,2) It is hot and humid

    6 Rain Modus Ponens(4,5) It is raining

  • 8/8/2019 AI Propsitional Logic

    66/88

    Horn sentences A Horn sentence or Horn clause has the form:

    P1 P2 P3 ... Pn Qor alternatively

    P1 P2 P3 ... Pn Q

    where Ps and Q are non-negated atoms To get a proof for Horn sentences, apply Modus

    Ponens repeatedly until nothing can be done

    (PQ) = (PQ)

  • 8/8/2019 AI Propsitional Logic

    67/88

    67

    Entailment and derivation Entailment: KB |= Q

    Q is entailed by KB (a set of premises or assumptions)if and only if there is no logically possible world inwhich Q is false while all the premises in KB are true.

    Or, stated positively, Q is entailed by KB if and only if

    the conclusion is true in every logically possible worldin which all the premises in KB are true.

    Derivation: KB |- Q

    We can derive Q from KB if there is a proofconsisting of a sequence of valid inference stepsstarting from the premises in KB and resulting in Q

    Two important properties for inference

  • 8/8/2019 AI Propsitional Logic

    68/88

    68

    Two important properties for inference

    Soundness: If KB |- Q then KB |= Q

    If Q is derived from a set of sentences KB using a

    given set of rules of inference, then Q is entailed byKB.

    Hence, inference produces only real entailments, orany sentence that follows deductively from the

    premises is valid.Completeness: If KB |= Q then KB |- Q

    If Q is entailed by a set of sentences KB, then Q canbe derived from KB using the rules of inference.

    Hence, inference produces all entailments, or all validsentences can be proved from the premises.

    Soundness and Completeness

  • 8/8/2019 AI Propsitional Logic

    69/88

    Soundness and Completeness

    A rule A1 An is said to be sound if for every B

    model in which all ofA1 An are true, then so is B. i.e. if

    MM |=A1 , , MM |=An, then MM |=B. A collection of rules are sound if all rules in the collection is

    sound.

    A collection of rules is complete ifMM |=A for all models M,M,then A is provable. I.e. there is a proof of A using the given set ofrules. (Denoted |R-- A ) where Ris the set of rules.

  • 8/8/2019 AI Propsitional Logic

    70/88

    Complexity the truth-table method to inference is complete

    enumerate the 2n rows of a table involving n symbols

    computation time is exponential

    satisfiability for a set of sentences is NP-complete

    so most likely there is no polynomial-time algorithm

    in many practical cases, proofs can be found with moderateeffort

    there is a class of sentences with polynomial inferenceprocedures (Horn sentences or Horn clauses)

    P1 P2 ... Pn Q

    We can represent facts in Propositional Logic, and we have a

  • 8/8/2019 AI Propsitional Logic

    71/88

    sound and complete procedure for inference.But Propositional Logic has some weaknesses...

    The size of the truth tables grows exponentially. So we may

    run out of space and time before we can answer a question.

    Suppose we want to encode the fact that all men are mammals,we have no choice but to list that fact for each individual man in

    the knowledge baseP means Paul is a mammalQ means Quentin is a mammal

    R means Robert is a mammal

    S means Steve is a mammaletc etc

    What we really need is a compact way represent these kinds offacts.

  • 8/8/2019 AI Propsitional Logic

    72/88

    Validity != Provability Goldbachs conjecture: Every even number (>2) is

    the sum of 2 primes.

    This is either valid or not.

    It may not be provable.

    Godel: No axiomization of arithmetic will becomplete, i.e. always valid statements that are not

    provable.

    Limitation of Propositional logic

  • 8/8/2019 AI Propsitional Logic

    73/88

    Limitation of Propositional logic

    Theorem proving is decidable

    The propositional calculus has its limitations cannot deal properly with general statements of the

    form:-

    All men are mortal. You cannot derive from the conjunction of this and

    Devindra is a man that..

    Devindra is mortal. Cannot represent objects and quantification

  • 8/8/2019 AI Propsitional Logic

    74/88

    Limitations If all men are mortal =P

    Devindra is a man = Q

    Devindra is mortal =R

    Then (P & Q) R is not valid

    To do this, you need to analyze propositions intopredicates and arguments and delay explicitly with

    quantification.

    Limitations of Propositional Logic

  • 8/8/2019 AI Propsitional Logic

    75/88

    Limitations of Propositional Logic

    number of propositions

    since everything has to be spelled out explicitly, the number of rules is

    immense dealing with change (monotonicity)

    even in very simple worlds, there is change

    the agents position changes

    time-dependent propositions and rules can be used

    even more propositions and rules

    propositional logic has only one representational device, theproposition

    difficult to represent objects and relations, properties, functions,

    variables, ...

  • 8/8/2019 AI Propsitional Logic

    76/88

    Implies => If 2+2 = 5 then monkeys are cows. TRUE

    If 2+2 = 5 then cows are animals. TRUE

    Indicates a difference with natural reasoning. Singleincorrect or false belief will destroy reasoning. No

    weight of evidence.

  • 8/8/2019 AI Propsitional Logic

    77/88

    Inference Does s1,..sk entail s?

    Say variables (symbols) v1vn. Check all 2^n possible worlds.

    In each world, check if s1..sk is true, that s is true.

    Approximately O(2^n).

    Complete: possible worlds finite for propositionallogic, unlike for arithmetic.

  • 8/8/2019 AI Propsitional Logic

    78/88

    What cant we say? Quantification: every student has a father.

    Relations: If X is married to Y, then Y is married toX.

    Probability:There is an 80% chance of rain.

    Combine Evidence: This car is better than thatone because

    Uncertainty: Maybe John is playing golf.

    Propositional logic is a weak language

  • 8/8/2019 AI Propsitional Logic

    79/88

    79

    p g g g

    Hard to identify individuals (e.g., Mary, 3)

    Cant directly talk about properties of individuals or

    relations between individuals (e.g., Bill is tall) Generalizations, patterns, regularities cant easily be

    represented (e.g., all triangles have 3 sides)

    First-Order Logic (abbreviated FOL or FOPC) isexpressive enough to concisely represent this kind of

    information

    FOL adds relations, variables, and quantifiers, e.g.,Every elephant is gray: x (elephant(x) gray(x))

    There is a white alligator: x (alligator(X) ^ white(X))

    Example

  • 8/8/2019 AI Propsitional Logic

    80/88

    80

    p

    Consider the problem of representing the

    following information:Every person is mortal.

    Confucius is a person.

    Confucius is mortal.

    How can these sentences be represented so

    that we can infer the third sentence from the

    first two?

  • 8/8/2019 AI Propsitional Logic

    81/88

    81

    Example II In PL we have to create propositional symbols to stand for all or part

    of each sentence. For example, we might have:

    P = person; Q = mortal; R = Confucius

    so the above 3 sentences are represented as:

    P Q; R P; R Q

    Although the third sentence is entailed by the first two, we needed anexplicit symbol, R, to represent an individual, Confucius, who is amember of the classes person and mortal

    To represent other individuals we must introduce separate symbolsfor each one, with some way to represent the fact that all individualswho are people are also mortal

  • 8/8/2019 AI Propsitional Logic

    82/88

    Some Applications ofPropositional Logic

    SUDOKU

  • 8/8/2019 AI Propsitional Logic

    83/88

    1 2 3 4 5 6 7 8 9

    1

    2

    3

    4

    5

    6

    7

    8

    9

    Mathematical models

  • 8/8/2019 AI Propsitional Logic

    84/88

    Dutch Soccer League

  • 8/8/2019 AI Propsitional Logic

    85/88

    if Eindhoven and Amsterdam play on the same day the TV income is

    x

    If Eindhoven and Amsterdam play on two different days, the incomeis 2x

    if a team plays on Wednesday champions league it doesnt play on

    Friday

    there are at most 3 plays on Friday

    .. in sum several thousand constraints over LP and Boolean

    variables

    League is modelled by the Barcelogic tool

    Transition Systems

  • 8/8/2019 AI Propsitional Logic

    86/88

    Example an Editor that can

    hi hli h h i

  • 8/8/2019 AI Propsitional Logic

    87/88

    highlight the semantic error

    Summary

  • 8/8/2019 AI Propsitional Logic

    88/88

    88

    The process of deriving new sentences from old one is called inference.

    Sound inference processes derives true conclusions given true premises

    Complete inference processes derive all true conclusions from a set ofpremises

    A valid sentence is true in all worlds under all interpretations

    If an implication sentence can be shown to be valid, thengiven itspremiseits consequent can be derived

    Different logics make different commitments about what the world is

    made of and what kind of beliefs we can have regarding the facts Logics are useful for the commitments they do not make because lack of

    commitment gives the knowledge base engineer more freedom

    Propositional logic commits only to the existence of facts that may ormay not be the case in the world being represented

    It has a simple syntax and simple semantics. It suffices to illustrate the processof inference

    Propositional logic quickly becomes impractical, even for very small worlds