Upload
others
View
15
Download
0
Embed Size (px)
Citation preview
CS 730/830: Intro AI
■ COVID
What is KR?
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 1 / 21
asst 5 is posted
COVID
■ COVID
What is KR?
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 2 / 21
■ check your Wildcat Pass before coming to campus■ send me email if you need to isolate/quarantine
Introduction toKnowledge Representation
and Reasoning
■ COVID
What is KR?
■ What is KR?
■ History of Logic
■ Advice Taker
■ The PSSH
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 4 / 21
What is Knowledge Representation?
■ COVID
What is KR?
■ What is KR?
■ History of Logic
■ Advice Taker
■ The PSSH
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 5 / 21
■ Representing facts■ Reasoning with facts
Can computers be meaningful?
History of Logic
■ COVID
What is KR?
■ What is KR?
■ History of Logic
■ Advice Taker
■ The PSSH
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 6 / 21
Philo of Megara (5C BC): truth tablesAristotle (322BC): tautologies of proper argumentsGottfried Leibniz (1646-1716): inference as math-like (bogus)logicGeorge Boole (1854): The Laws of Thought (almostpropositional logic)Gottlob Frege (1879): Conceptual Notation (propositional andfirst-order logic)Dartmouth Conference (1956): ‘AI’ coinedAdvice Taker (1959): manifesto for declarative knowledgeCYCorp (1984- , www.cyc.com): slightly more complicated thanfirst-order logic
The Advice Taker (1959)
■ COVID
What is KR?
■ What is KR?
■ History of Logic
■ Advice Taker
■ The PSSH
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 7 / 21
John McCarthy: “AI”, Lisp, time-sharing
Empirical Philosophy = Science
■ COVID
What is KR?
■ What is KR?
■ History of Logic
■ Advice Taker
■ The PSSH
Prop. Logic
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 8 / 21
The Physical Symbol System Hypothesis: A physicalsymbol system has the necessary and sufficient means for generalintelligent action. (Newell and Simon)
where a
Symbol is a designating pattern that can be combined withothers to form another designating pattern
and
Designation means standing in for something in the world
Propositional Logic
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 9 / 21
Propositional Logic
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 10 / 21
itisraining
iamwet
itisraining → iamwet
x y x ∧ y
T T TT F FF T FF F F
x y x→ y
T T TT F FF T TF F T
x x→ y modusy ponens
∧,∨,¬,→ (⊃,⇒),↔
Logic
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 11 / 21
A logic is a formal system:
■ syntax: defines sentences■ semantics: relation to world■ inference rules: reaching new conclusions
three layers: proof, models, reality
flexible, general, principled
Encode in Propositional Logic
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 12 / 21
If the unicorn is mythical, then it is immortal, but if it is notmythical, then it is a mortal mammal. If the unicorn is eitherimmortal or a mammal, then it is horned. The unicorn is magicalif it is horned.
Semantics
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 13 / 21
Interpretation: possible world = state of affairs = truth value foreach propositionMeaning: values across all interpretationsModel of P : an interpretation in which P is trueSatisfiable: ∃ a modelEntailment: if α is true in every model of KB, then KB |= α
Valid: true in any interpretation
x y (x ∧ ¬y) z (x ∧ ¬y)→ z
T T F T TT T F F TT F T T TT F T F FF T F T TF T F F TF F F T TF F F F T
Break
■ COVID
What is KR?
Prop. Logic
■ Prop. Logic
■ Logic
■ An Example
■ Semantics
■ Break
Reasoning
Wheeler Ruml (UNH) Lecture 10, CS 730 – 14 / 21
■ asst 4■ asst 5
Reasoning
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 15 / 21
Propositional Reasoning
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 16 / 21
Entailment: if β is true in every model of α, then α |= β
computing entailmentsoundness, completeness
α |= β iff α→ β is valid
α |= β iff α ∧ ¬β is unsatisfiable
determining satisfiability is NP-completeeg, easy to test proof of yes!
Boolean Satisfiability
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 17 / 21
Given a formula of boolean logic, is there any assignment of T/Fto its variables that makes the entire formula true?
(a ∨ b ∨ c) ∧ (¬a ∨ b ∨ ¬c) ∧ (¬a ∨ ¬b ∨ c) ∧ (¬a ∨ ¬b ∨ ¬c)
The Davis-Logemann-Loveland Algorithm (1962)
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 18 / 21
DLL(φ):UnitPropagate(φ)[ PureLiterals(φ) ]if φ is empty, return SATif φ contains empty clause, return UNSATv ← choose a variableif DLL(SetVariable(φ with v =true))=SAT, return SATelse, return DLL(SetVariable(φ with v =false))
UnitPropagate(φ):as long as there is a unit clause
SetVariable according to the literal
SetVariable(φ with v = value):remove clauses where v appears as valueremove v from clauses where it appears as ¬value
WalkSAT/SKC (1994)
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 19 / 21
for 1 to maxTries
assign all variables randomlyfrom 1 to maxFlips
randomly choose an unsatisfied clause c
if one or more of c’s variables can be flipped whilebreaking nothing,randomly choose among those
elsewith probability p
randomly choose one of c’s variableselse
randomly choose among those of c’s variables thatminimize breaks
flip the variableif formula satisfied, terminate
p ≈ 0.5?
Local Search for SAT
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 20 / 21
DPLL: 50 vars = 1.4 secs, 100 vars = 2.8 min, 140 vars = 4.7hrs
Local Search for SAT
■ COVID
What is KR?
Prop. Logic
Reasoning
■ Reasoning
■ SAT
■ DLL
■ WalkSAT
■ GSAT
■ EOLQs
Wheeler Ruml (UNH) Lecture 10, CS 730 – 20 / 21
DPLL: 50 vars = 1.4 secs, 100 vars = 2.8 min, 140 vars = 4.7hrs
GSAT: 100 vars = 6 secs, 140 vars = 14 secs, 500 vars = 1.6 hrs