proposition al logic

28
Propositional Logic or how to reason correctly Chapter 8 (new edition) Chapter 7 (old edition)

Upload: akshaybhatia

Post on 08-Nov-2015

224 views

Category:

Documents


0 download

DESCRIPTION

pl

TRANSCRIPT

  • Propositional Logic or how to reason correctlyChapter 8 (new edition)Chapter 7 (old edition)

  • GoalsFeigenbaum: In the knowledge lies the power. Success with expert systems. 70s.What can we represent?Logic(s): PrologMathematical knowledge: mathematicaCommon Sense Knowledge: Lenats Cyc has a million statement in various knowledgeProbabilistic Knowledge: Bayesian networks Reasoning: via search

  • History300 BC Aristotle: SyllogismsLate 1600s Leibnitzs goal: mechanization of inference1847 Boole: Mathematical Analysis of Logic1879: Complete Propositional Logic: Frege1965: Resolution Complete (Robinson)1971: Cook: satisfiability NP-complete1992: GSAT Selman min-conflicts

  • SyllogismsProposition = Statement that may be either true or false. John is in the classroom. Mary is enrolled in 270A.If A is true, and A implies B, then B is true.If some A are B, and some B are C, then some A are C.If some women are students, and some students are men, then .

  • ConcernsWhat does it mean to say a statement is true?What are sound rules for reasoningWhat can we represent in propositional logic?What is the efficiency?Can we guarantee to infer all true statements?

  • SemanticsModel = possible worldx+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 where S1Sn are true, S is true.Careful: No mention of proof just checking all the worlds.Some cognitive scientists argue that this is the way people reason.

  • Reasoning or Inference SystemsProof 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. Cant change your mind.

  • Proposition Logic: SyntaxSee text for complete rulesAtomic Sentence: true, false, variableComplex Sentence: connective applied to atomic or complex sentence.Connectives: not, and, or, implies, equivalence, etc.Defined by tables.

  • Propositional Logic: SemanticsTruth tables: p =>q |= ~p or q

  • Implies =>If 2+2 = 5 then monkeys are cows. TRUEIf 2+2 = 5 then cows are animals. TRUEIndicates a difference with natural reasoning. Single incorrect or false belief will destroy reasoning. No weight of evidence.

  • InferenceDoes 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 propositional logic, unlike for arithmetic.

  • Translation into Propositional LogicIf it rains, then the game will be cancelled.If the game is cancelled, then we clean house.Can we conclude?If it rains, then we clean house.p = it rains, q = game cancelled r = we clean house.If p then q. not p or qIf q then r. not q or rif p then r. not p or r (resolution)

  • ConceptsEquivalence: two sentences are equivalent if they are true in same models.Validity: a sentence is valid if it true in all models. (tautology) e.g. P or not P.Sign: Members or not Members only.Berra: Its not over till its over.Satisfiability: a sentence is satisfied if it true in some model.

  • Validity != ProvabilityGoldbachs 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 be complete, i.e. always valid statements that are not provable.

  • Natural Inference RulesModus Ponens: p, p=>q |-- q.SoundResolution example (sound)p or q, not p or r |-- q or rAbduction (unsound, but common)q, p=>q |-- pground wet, rained => ground wet |-- rainedmedical diagnosis

  • Natural Inference SystemsTypically have dozen of rules.Difficult for people to use.Expensive for computation.e.g. a |-- a or ba and b |-- aAll known systems take exponential time in worse case. (co-np complete)

  • Full Propositional Resolutionclause 1: x1 +x2+..xn+y (+ = or)clause 2: -y + z1 + z2 + zmclauses contain complementary literals.x1 +.. xn +z1 + zmy and not y are complementary literals.Theorem: If s1,sn |= s then s1,sn |-- s by resolution. Refutation Completeness.Factoring: (simplifying: x or x goes to x)

  • Conjunctive Normal FormTo apply resolution we need to write what we know as a conjunct of disjuncts.Pg 215 contains the rules for doing this transformation. Basically you remove all and => and move nots inwards. Then you may need to apply distributive laws.

  • Proposition -> CNFGoal: Proving RP(P&Q) =>R(S or T) => QTDistributive laws:(-s&-t) or q (-s or q)&(-t or q).P-P or Q or R-S or Q-T or QTRemember:implicit adding.

  • Resolution ProofP (1)-P or Q or R (2)-S or Q (3)-T or Q (4)T (5)~R (6)

    -P or Q : 7 by 2 & 6-Q : 8 by 7 & 1.-T : 9 by 8 & 4empty: by 9 and 5.Done: order only effects efficiency.

  • Resolution Algorithm To prove s1, s2..sn |-- s Put s1,s2,..sn & not s into cnf.Resolve any 2 clauses that have complementary literalsIf you get empty, doneContinue until set of clauses doesnt grow.Search can be expensive (exponential).

  • Forward and Backward ReasoningHorn clause has at most 1 positive literal.Prolog only allows Horn clauses.if a, b, c then d => not a or not b or not c or dProlog writes this:d :- a, b, c. Prolog thinks: to prove d, set up subgoals a, b,c and prove/verify each subgoal.

  • Forward ReasoningFrom facts to conclusionsGiven s1: p, s2: q, s3: p&q=>r Rewrite in clausal form: s3 = (-p+-q+r)s1 resolve with s3 = -q+r (s4)s2 resolve with s4 = rGenerally used for processing sensory information.

  • Backwards Reasoning: what prolog doesFrom Negative of Goal to dataGiven s1: p, s2: q, s3: p&q=>r Goal: s4 = rRewrite in clausal form: s3 = (-p+-q+r)Resolve s4 with s3 = -p +-q (s5)Resolve s5 with s2 = -p (s6)Resolve s6 with s1 = empty. Eureka r is true.

  • Davis-Putnam AlgorithmEffective, complete propositional algorithmBasically: recursive backtracking with tricks.early termination: short circuit evaluationpure symbol: variable is always + or (eliminate the containing clauses)one literal clauses: one undefined variable, really special cases of MRVPropositional satisfication is a special case of Constraint satisfication.

  • WalkSatHeuristic algorithm, like min-conflictsRandomly assign values (t/f)For a while dorandomly select a clausewith probability p, flip a random variable in clauseelse flip a variable which maximizes number of satisfied clauses.Of course, variations exists.

  • Hard Satisfiability ProblemsCritical point: ratio of clauses/variables = 4.24 (empirical).If above, problems usually unsatsifiable.If below, problems usually satisfiable.Theorem: Critical range is bounded by [3.0003, 4.598].

  • What cant we say?Quantification: every student has a father.Relations: If X is married to Y, then Y is married to X.Probability: There is an 80% chance of rain.Combine Evidence: This car is better than that one becauseUncertainty: Maybe John is playing golf.