lecture 15 logic intro and pdcl - cs.ubc.caconati/322/322-2017w1/slides... · technique. variable....
TRANSCRIPT
![Page 1: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/1.jpg)
Computer Science CPSC 322
Lecture 15
Logic Intro and PDCL
1
![Page 2: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/2.jpg)
Announcements
• Marked midterms will be available on Thursday (with solutions)
• Assignment 3 will be posted on Th.• Due Wed. Nov 15• 2 late days allowed
• Marks for assignment 3 will likely be available on Th
![Page 3: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/3.jpg)
Lecture Overview
• Intro to Logic
• Propositional Definite Clauses: • Syntax
• Semantics
• Proof procedures (time permitting)
![Page 4: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/4.jpg)
Where Are We?Environment
Problem Type
Query
Planning
Deterministic Stochastic
Constraint Satisfaction Search
Arc Consistency
Search
Search
Logics
STRIPS
Vars + Constraints
Value Iteration
VariableElimination
Belief Nets
Decision Nets
Markov Processes
Static
Sequential
RepresentationReasoningTechnique
VariableElimination
First Part of the Course 4
![Page 5: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/5.jpg)
Where Are We?Environment
Problem Type
Query
Planning
Deterministic Stochastic
Constraint Satisfaction Search
Arc Consistency
Search
Search
Logics
STRIPS
Vars + Constraints
Value Iteration
VariableElimination
Belief Nets
Decision Nets
Markov Processes
Static
Sequential
RepresentationReasoningTechnique
VariableElimination
Back to static problems, but with
richer representation 5
![Page 6: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/6.jpg)
Logics in AI: Similar slide to the one for planning
Propositional Logics
First-Order Logics
Propositional Definite Clause Logics
Semantics and Proof Theory
Satisfiability Testing (SAT)
Description Logics
Cognitive Architectures
Video Games
Ontologies
Semantic Web
Information Extraction
Summarization
Production Systems
Tutoring Systems
Hardware Verification
Product Configuration
Software Verification
Applications
6
![Page 7: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/7.jpg)
Logics in AI: Similar slide to the one for planning
Propositional Logics
First-Order Logics
Propositional Definite Clause Logics
Semantics and Proof Theory
Description Logics
Cognitive Architectures
Video Games
Hardware Verification
Product ConfigurationOntologies
Semantic Web
Information Extraction
Summarization
Production Systems
Tutoring Systems
Software Verification
You will know
You will know a little
Applications
Satisfiability Testing (SAT)
7
![Page 8: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/8.jpg)
What you already know about logic...• From programming: Some logical operators
• If ((amount > 0) && (amount < 1000)) || !(age < 30) • ...
Logic is the language of Mathematics. To define formal structures (e.g., sets, graphs) and to prove statements about those
You know what they mean in a “procedural” way
We use logic as a Representation and Reasoning Systemthat can be used to formalize a domain and to reason about it
8
![Page 9: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/9.jpg)
Logic: a framework for representation & reasoning
• When we represent a domain about which we have only partial (but certain) information, we need to represent….
9
![Page 10: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/10.jpg)
Logic: a framework for representation & reasoning
• When we represent a domain about which we have only partial (but certain) information, we need to represent….• Objects, properties, sets, groups, actions, events, time, space, …
• All these can be represented as • Objects• Relationships between objects
• Logic is the language to express knowledge about the world this way• http://en.wikipedia.org/wiki/John_McCarthy (1927 - 2011)
Logic and AI “The Advice Taker”Coined “Artificial Intelligence”. Dartmouth W’shop (1956)
10
![Page 11: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/11.jpg)
Why Logics?
• “Natural” way to express knowledge about the world
e.g. “Every 101 student will pass the course”Course (c1)Name-of (c1, 101)
• It is easy to incrementally add knowledge • It is easy to check and debug knowledge• Provides language for asking complex queries• Well understood formal properties
)1,(_)1,(&)()( czpasswillczregisteredzstudentz →∀
11
![Page 12: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/12.jpg)
Logic: A general framework for reasoning
General problem: Query answering• tell the computer how the world works• tell the computer some facts about the world• ask a yes/no question about whether other facts must be true
Solving it with Logic1. Begin with a task domain.2. Distinguish those things you want to talk about (the ontology)3. Choose symbols in the computer to denote elements of your ontology4. Tell the system knowledge about the domain
12
![Page 13: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/13.jpg)
Example: Electrical Circuit
/ up
/down
13
![Page 14: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/14.jpg)
/ up
/down
14
![Page 15: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/15.jpg)
Logic: A general framework for reasoning
General problem: Query answering• tell the computer how the world works• tell the computer some facts about the world• ask a yes/no question about whether other facts must be true
Solving it with Logic1. Begin with a task domain.2. Distinguish those things you want to talk about (the ontology)3. Choose symbols in the computer to denote elements of your ontology4. Tell the system knowledge about the domain5. Ask the system whether new statements about the domain are true or
false
15
![Page 16: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/16.jpg)
/ up
/down
16
live_w4? lit_l2?
![Page 17: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/17.jpg)
To Define a Logic We Need
• Syntax: specifies the symbols used, and how they can be combined to form legal sentences • Knowledge base is a set of sentences in the
language
• Semantics: specifies the meaning of symbols and sentences
• Reasoning theory or proof procedure: a specification of how an answer can be produced.• Sound: only generates correct answers with
respect to the semantics• Complete: Guaranteed to find an answer if it exists 17
![Page 18: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/18.jpg)
Propositional Definite ClausesWe will start with a simple logic
• Primitive elements are propositions: Boolean variables that can be {true, false}
Two kinds of statements:• that a proposition is true• that a proposition is true if one or more other propositions are true
Why only propositions?• We can exploit the Boolean nature for efficient reasoning• Starting point for more complex logics
We need to specify: syntax, semantics, proof procedure
18
![Page 19: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/19.jpg)
Lecture Overview
• Intro to Logic
• Propositional Definite Clauses: • Syntax
• Semantics
• Proof Procedures
![Page 20: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/20.jpg)
To Define a Logic We Need
• Syntax: specifies the symbols used, and how they can be combined to form legal sentences • Knowledge base is a set of sentences in the
language
• Semantics: specifies the meaning of symbols and sentences
• Reasoning theory or proof procedure: a specification of how an answer can be produced.• Sound: only generates correct answers with
respect to the semantics• Complete: Guaranteed to find an answer if it exists 20
![Page 21: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/21.jpg)
Propositional Definite Clauses: SyntaxDefinition (atom)An atom is a symbol starting with a lower case letter
Definition (body)A body is an atom or is of the form b1 ∧ b2 where b1 and b2 are bodies.
Definition (definite clause)A definite clause is - an atom or - a rule of the form h ← b where h is an atom (“head”) and b is a body. (Read this as “h if b”.)
Definition (KB)A knowledge base (KB) is a set of definite clauses
Examples: p1;live_l1
Examples: p1 ∧ p2; ok_w1 ∧ live_w0
Examples: p1 ← p2;live_w0 ← live_w1 ∧ up_s2
21
![Page 22: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/22.jpg)
atoms
rules
definiteclauses, KB
22
![Page 23: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/23.jpg)
PDCL Syntax: more examples
a) Sunny_today
b) sunny_today ∨ cloudy_today
c) vdjhsaekwrq
d) high_pressure_system ← sunny-today
e) sunny_today ← high_pressure_system ∧ summer
f) sunny_today ← high_pressure-system ∧ ¬ winter
g) ai_is_fun ← f(time_spent, material_learned)
h) summer ← sunny_today ∧ high_pressure_system
How many of the clauses below are legal PDCL clauses?
Definition (definite clause)A definite clause is - an atom or - a rule of the form h ← b where h is an atom (‘head’) and b is a body.
(Read this as ‘h if b.’)
23
![Page 24: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/24.jpg)
PDCL Syntax: more examples
a) Sunny_today
b) sunny_today ∨ cloudy_today
c) vdjhsaekwrq
d) high_pressure_system ← sunny-today
e) sunny_today ← high_pressure_system ∧ summer
f) sunny_today ← high_pressure-system ∧ ¬ winter
g) ai_is_fun ← f(time_spent, material_learned)
h) summer ← sunny_today ∧ high_pressure_system
How many of the clauses below are legal PDCL clauses?
Definition (definite clause)A definite clause is - an atom or - a rule of the form h ← b where h is an atom (‘head’) and b is a body.
(Read this as ‘h if b.’)
24
A. 3
B. 4
C. 5
D. 6
![Page 25: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/25.jpg)
PDC Syntax: more examples
a) Sunny_today
b) sunny_today ∨ cloudy_today
c) vdjhsaekwrq
d) high_pressure_system ← sunny-today
e) sunny_today ← high_pressure_system ∧ summer
f) sunny_today ← high_pressure-system ∧ ¬ winter
g) ai_is_fun ← f(time_spent, material_learned)
h) summer ← sunny_today ∧ high_pressure_system
Do any of these statements mean anything? Syntax doesn't answer this question!
Legal PDC clause Not a legal PDC clause
25
B. 4
![Page 26: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/26.jpg)
To Define a Logic We Need
• Syntax: specifies the symbols used, and how they can be combined to form legal sentences • Knowledge base is a set of sentences in the
language
• Semantics: specifies the meaning of symbols and sentences
• Reasoning theory or proof procedure: a specification of how an answer can be produced.• Sound: only generates correct answers with
respect to the semantics• Complete: Guaranteed to find an answer if it exists 26
![Page 27: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/27.jpg)
Lecture Overview
• Intro to Logic
• Propositional Definite Clauses: • Syntax
• Semantics
• Proof Procedures
![Page 28: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/28.jpg)
Propositional Definite Clauses: Semantics
• Semantics allows one to relate the symbols in the logic to the domain to be modeled.
• If our domain has 8 atoms, how many interpretations are there?
Definition (interpretation)An interpretation I assigns a truth value to each atom.
B. 8*2 C. 82A. 8+2 D. 28
28
![Page 29: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/29.jpg)
Propositional Definite Clauses: Semantics
• Semantics allows one to relate the symbols in the logic to the domain to be modeled.
• If our domain has 8 atoms, how many interpretations are there?• 2 values for each atom, so 28 combinations• Similar to possible worlds in CSPs
Definition (interpretation)An interpretation I assigns a truth value to each atom.
29
![Page 30: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/30.jpg)
Propositional Definite Clauses: Semantics
• Semantics allows one to relate the symbols in the logic to the domain to be modeled.
We can use the interpretation to determine the truth value of clauses
Definition (interpretation)An interpretation I assigns a truth value to each atom.
Definition (truth values of statements)• A body b1 ∧ b2 is true in I if and only if b1 is true in I
and b2 is true in I.• A rule h ← b is false in I if and only if b is true in I
and h is false in I.
30
![Page 31: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/31.jpg)
h b h ← bI1 F F TI2 F T FI3 T F TI4 T T T
PDC Semantics: Example
a1 a2 a1 ∧ a2
I1 F F FI2 F T FI3 T F FI4 T T T
Truth values under different interpretationsF=false, T=true
31
![Page 32: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/32.jpg)
h b h ← bI1 F F TI2 F T FI3 T F TI4 T T T
PDC Semantics: ExampleTruth values under different interpretations
F=false, T=true
h ← b is false only whenb is true and h is false
h a1 a2 h ← a1 ∧ a2
I1 F F FI2 F F TI3 F T FI4 F T TI5 T F FI6 T F TI7 T T FI8 T T T
33
![Page 33: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/33.jpg)
h b h ← bI1 F F TI2 F T FI3 T F TI4 T T T
PDC Semantics: Example for truth values
Truth values under different interpretationsF=false, T=true
h ← a1 ∧ a2
Body of the clause is a1 ∧ a2
Body is true only if both a1 and a2 are true in I
h a1 a2 h ← a1 ∧ a2
I1 F F F TI2 F F T TI3 F T F TI4 F T T FI5 T F F TI6 T F T TI7 T T F TI8 T T T T
34
![Page 34: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/34.jpg)
Propositional Definite Clauses: Semantics
Semantics allows you to relate the symbols in the logic to the domain you're trying to model.
We can use the interpretation to determine the truth value of clauses
Definition (interpretation)An interpretation I assigns a truth value to each atom.
Definition (truth values of statements)• A body b1 ∧ b2 is true in I if and only if b1 is true in
I and b2 is true in I.• A rule h ← b is false in I if and only if b is true in I
and h is false in I.
• A knowledge base KB is true in I if and only if every clause in KB is true in I. 35
![Page 35: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/35.jpg)
Propositional Definite Clauses: Semantics
Definition (model)A model of a knowledge base KB is an interpretation in which KB is true.
Similar to CSPs: a model of a set of clauses is an interpretation that makes all of the clauses true
Definition (interpretation)An interpretation I assigns a truth value to each atom.
Definition (truth values of statements)• A body b1 ∧ b2 is true in I if and only if b1 is true in
I and b2 is true in I.• A rule h ← b is false in I if and only if b is true in I
and h is false in I.• A knowledge base KB is true in I if and only if
every clause in KB is true in I.
36
![Page 36: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/36.jpg)
PDC Semantics: Knowledge Base (KB)
p q r s
I1 false true true false
prs ← q ∧ p
rs ← pq ← p ∧ s
rqs ← q
A. KB1 C. KB2B. KB3
Which of the three KB above is True in I1
• A knowledge base KB is true in I if and only if every clause in KB is true in I.
37
![Page 37: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/37.jpg)
PDC Semantics: Knowledge Base (KB)
p q r s
I1 false true true false
rs ← pq ← p ∧ s
C. KB2
Which of the three KB above is True in I1
• A knowledge base KB is true in I if and only if every clause in KB is true in I.
38
![Page 38: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/38.jpg)
PDC Semantics: Example for models
p ← qKB = s
s ← r
Definition (model)A model of a knowledge base KB is an interpretation in which every clause in KB is true.
p q r s
I1 T T T T
I2 F F F T
I3 T T F F
I4 T T T F
I5 T T F T
Which of the interpretations below are models of KB?
B. I1 , I2
C. I1, I2, I5
D. All of them
A. I1
39
![Page 39: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/39.jpg)
PDC Semantics: Example for models
p q r s p ← q s s ← r KB
I1 T T T T
I2 F F F T
I3 T T F F
I4 T T T F
I5 T T F T
Definition (model)A model of a knowledge base KB is an interpretation in which every clause in KB is true.
p ← qKB = s
s ← r
Which of the interpretations below are models of KB?All interpretations where KB is true
40
![Page 40: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/40.jpg)
PDC Semantics: Example for models
Definition (model)A model of a knowledge base KB is an interpretation in which every clause in KB is true.
p ← qKB = s
s ← r
Which of the interpretations below are models of KB?All interpretations where KB is true: I1, I2, and I5
41
p q r s p ← q s s ← r KB
I1 T T T T T T T T
I2 F F F T T T T T
I3 T T F F T F T F
I4 T T T F T F T F
I5 T T F T T T T T
C. I1, I2, I5
![Page 41: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/41.jpg)
OK but….…. Who cares? Where are we going with this?
Remember what we want to do with Logic
1) Tell the system knowledge about a task domain.• This is your KB• which expresses true statements about the world
2) Ask the system whether new statements about the domain are true or false.• We want the system responses to be
– Sound: only generates correct answers with respect to the semantics
– Complete: Guaranteed to find an answer if it exists
42
![Page 42: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/42.jpg)
For Instance…
1) Tell the system knowledge about a task domain.
2) Ask the system whether new statements about the domain are true or false
p? r? s?
←
←=
..
.
srq
qpKB
43
![Page 43: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/43.jpg)
Or, More Interestingly
1) Tell the system knowledge about a task domain.
2) Ask the system whether new statements about the domain are true or false
• live_w4? lit_l2? 44
![Page 44: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/44.jpg)
To Obtain This We Need One More Definition
45
![Page 45: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/45.jpg)
To Obtain This We Need One More Definition
Definition (logical consequence)If KB is a set of clauses and G is a conjunction of atoms,
G is a logical consequence of KB, written KB ⊧ G, if G is true in every model of KB.
• we also say that G logically follows from KB, or that KBentails G.
• In other words, KB ⊧ G if there is no interpretation in which KB is true and G is false.• when KB is TRUE, then G must be TRUE
• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base
46
![Page 46: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/46.jpg)
∧←
=.
.q
rqpKB
Example of Logic Entailment
How many models are there?
A. 1 B. 2 C. 3 D. 4
E. 5
47
![Page 47: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/47.jpg)
∧←
=.
.q
rqpKB
Interpretationsr q pT T TT T FT F TT F FF T TF T FF F TF F F
Example of Logic Entailment
How many models are there?
A. 1 B. 2 C. 3 D. 4
E. 5
48
![Page 48: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/48.jpg)
∧←
=.
.q
rqpKB
Interpretationsr q pT T TT T FT F TT F FF T TF T FF F TF F F
Models
Which atoms are logically entailed?
Example of Logic Entailment
• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base 49
C. 3
![Page 49: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/49.jpg)
∧←
=.
.q
rqpKB
Interpretationsr q pT T TT T FT F TT F FF T TF T FF F TF F F
Models
Which atoms are logically entailed?q
Example of Logic Entailment
• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base 50
C. 3
![Page 50: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/50.jpg)
Example: Logical Consequences
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true falseI3 true true false falseI4 true true false trueI5 false true true trueI6 false true true falseI7 false true false falseI8 false true false trueI9 true false true trueI10 true false true falseI11 true false false falseI12 true false false false….. …… ….. …… …….
Which of the following is true?
A. KB ⊧ q and KB ⊧ r
B. KB ⊧ q, and KB ⊧ s
C. KB ⊧ q, and KB ⊧ p
D. KB ⊧ r, KB ⊧ s,
E. None of the above51
![Page 51: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/51.jpg)
Example: Logical Consequences
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true falseI3 true true false falseI4 true true false trueI5 false true true trueI6 false true true falseI7 false true false falseI8 false true false trueI9 true false true trueI10 true false true falseI11 true false false falseI12 true false false false….. …… ….. …… …….
Which of the following is true?
•KB ⊧ q,
•KB ⊧ p,
•KB ⊧ s,
•KB ⊧ r52
![Page 52: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/52.jpg)
Example: Logical Consequences
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true falseI3 true true false falseI4 true true false trueI5 false true true trueI6 false true true falseI7 false true false falseI8 false true false trueI9 true false true trueI10 true false true falseI11 true false false falseI12 true false false false….. …… ….. …… …….
Which of the following is true?
•KB ⊧ q,
•KB ⊧ p,
•KB ⊧ s,
•KB ⊧ r53
models
![Page 53: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/53.jpg)
Example: Logical Consequences
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true falseI3 true true false falseI4 true true false trueI5 false true true trueI6 false true true falseI7 false true false falseI8 false true false trueI9 true false true trueI10 true false true falseI11 true false false falseI12 true false false false….. …… ….. …… …….
Which of the following is true?
•KB ⊧ q,
•KB ⊧ p,
•KB ⊧ s,
•KB ⊧ r
T
T
F
F
54
models
C. KB ⊧ q, and KB ⊧ p
![Page 54: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/54.jpg)
User’s View of Semantics
• Choose a task domain: intended interpretation.
• For each proposition you want to represent, associate a proposition symbol in the language.
• Tell the system clauses that are true in the intended interpretation: axiomatize the domain.
• Ask questions about the intended interpretation.
• If KB |= g , then g must be true in the intended interpretation.
55
![Page 55: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/55.jpg)
Computer’s View of Semantics
• The computer doesn’t have access to the intended interpretation.
• All it knows is the knowledge base.
• The computer can determine if a formula is a logical consequence of KB.
• If KB |= g then g must be true in the intended interpretation.
• Otherwise, there is a model of KB in which g is false. This could be the intended interpretation.
The computer wouldn't know! 56
![Page 56: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/56.jpg)
Computer’s View of Semantics
• Otherwise, there is a model of KB in which g is false. This could be the intended interpretation.The computer wouldn't know
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true false
57
![Page 57: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/57.jpg)
Computer’s View of Semantics
• Otherwise, there is a model of KB in which g is false. This could be the intended interpretation.The computer wouldn't know
←
←=
..
.
srq
qpKB
p q r sI1 true true true trueI2 true true true false
58
I1 and I2above are both models for KB, each could be the intended interpretation. The computer cannot know, thus it cannot say anything about the truth value of s
![Page 58: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/58.jpg)
Learning Goals for Logic Up To Here
• PDCL syntax & semantics- Verify whether a logical statement belongs to the
language of propositional definite clauses- Verify whether an interpretation is a model of a PDCL KB.
‾ Verify when a conjunction of atoms is a logical consequence of a knowledge base
Next: Proof Procedures (5.2.2)
59
![Page 59: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/59.jpg)
Lecture Overview
• Intro to Logic
• Propositional Definite Clauses: • Syntax
• Semantics
• Proof Procedures
![Page 60: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/60.jpg)
To Define a Logic We Need
• Syntax: specifies the symbols used, and how they can be combined to form legal sentences • Knowledge base is a set of sentences in the
language
• Semantics: specifies the meaning of symbols and sentences
• Reasoning theory or proof procedure: a specification of how an answer can be produced (sound and complete)• Bottom-up and Top-Down Proof Procedure for Finding
Logical Consequence
Slide 61
![Page 61: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/61.jpg)
Proof Procedures• A proof procedure is a mechanically derivable
demonstration that a formula logically follows from a knowledge base.
• Given a proof procedure P, KB ⊦ P g means g can be derived from knowledge base KB with the proof procedure.
• If I tell you I have a proof procedure for PDCL• What do I need to show you in order for you to trust my
procedure?
That is sound and complete
Slide 62
![Page 62: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/62.jpg)
Soundness and Completeness
• Completeness of proof procedure P: need to prove that
If g is true in all models of KB (KB ⊧ g)then g is derived by the procedure (KB ⊦P g)
Definition (completeness)A proof procedure P is complete if KB ⊧ g implies KB ⊦P g.
complete: every atom that logically follows from KB is derived by P
• Soundness of proof procedure P: need to prove that
Definition (soundness)A proof procedure P is sound if KB ⊦P g implies KB ⊧ g.
If g can be derived by the procedure (KB ⊦P g)then g is true in all models of KB (KB ⊧ g)
sound: every atom derived by P follows logically from KB (i.e. is true in every model)
Slide 63
![Page 63: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/63.jpg)
Simple Proof Procedure
problem with this approach?
Simple proof procedure S• Enumerate all interpretations• For each interpretation I, check whether it is a model of KB
i.e., check whether all clauses in KB are true in I
• KB ⊦S g if g holds in all such models
64
![Page 64: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/64.jpg)
Simple Proof Procedure
problem with this approach?
• If there are n propositions in the KB, must check all the interpretations!
Simple proof procedure S• Enumerate all interpretations• For each interpretation I, check whether it is a model of KB
i.e., check whether all clauses in KB are true in I
• KB ⊦S g if g holds in all such models
65
![Page 65: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/65.jpg)
Simple Proof Procedure
problem with this approach?
• If there are n propositions in the KB, must check all the 2n interpretations!
Goal of proof theory • find sound and complete proof procedures that allow
us to prove that a logical formula follows from a KB avoiding to do the above
Simple proof procedure S• Enumerate all interpretations• For each interpretation I, check whether it is a model of KB
i.e., check whether all clauses in KB are true in I
• KB ⊦S g if g holds in all such models
66
![Page 66: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/66.jpg)
Bottom-up proof procedure
• One rule of derivation, a generalized form of modus ponens:
• If “h← b1 ∧ … ∧ bm" is a clause in the knowledge base, andeach bi has been derived,
then h can be derived.
• This rule also covers the case when m = 0.
67
![Page 67: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/67.jpg)
Bottom-up (BU) proof procedureC :={};repeat
select clause “h ← b1 ∧ … ∧ bm” in KB such that bi ∈ C for all i, and h ∉ C;
C := C ∪ { h }until no more clauses can be selected.
KB ⊦BU G if G ⊆ C at the end of this procedure
The C at the end of BU procedure is a fixed point:• Further applications of the rule of derivation will not
change C!68
![Page 68: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/68.jpg)
C := {};repeat
select clause h ← b1 ∧… ∧ bm in KB such that bi ∈ C for all i, and h ∉ C;
C := C ∪ {h}until no more clauses can be selected.
Bottom-up proof procedure: example
a ← b ∧ ca ← e ∧ fb ← f ∧ kc ← ed ← ke.f ← j ∧ ef ← cj ← c
{}
69
![Page 69: Lecture 15 Logic Intro and PDCL - cs.ubc.caconati/322/322-2017W1/slides... · Technique. Variable. Elimination. First Part of the Course. 4. Where Are We? Environment Problem Type](https://reader033.vdocument.in/reader033/viewer/2022042012/5e72b15aa72e9312535e2558/html5/thumbnails/69.jpg)
C := {};repeat
select clause h ← b1 ∧… ∧ bm in KB such that bi ∈ C for all i, and h ∉ C;
C := C ∪ {h}until no more clauses can be selected.
Bottom-up proof procedure: example
a ← b ∧ ca ← e ∧ fb ← f ∧ kc ← ed ← ke.f ← j ∧ ef ← cj ← c
{}{e}{c,e}{c,e,f}{c,e,f,j}{a,c,e,f,j}
Done.70