CS 371: Introduction to
Artificial Intelligence
Review/Introduction
|
|
|
Review: goal-based agent, simple
problem-solving agent |
|
How would we design a
Minesweeper-playing agent? |
|
Capacity for simple logical reasoning
useful for some problem solving. |
Knowledge-based agent
Examples of KB Agents
|
|
|
Toy example: Minesweeper Agent |
|
Real-world example: Reaction Control
System (RCS) |
Propositional Logic
Syntax
|
|
|
|
propositions - T/F atomic sentences
about the world |
|
propositional symbols (a.k.a.
variables) P, Q, R, …, and constants True and False |
|
e.g. P: “There is a mine at (1,2).”; Q:
“There is a mine at (2,2).” |
|
not (Ø) - negates
meaning of a sentence |
|
P, ØP, Q, ØQ, … are called literals |
|
e.g. ØQ: “There is not
a mine at (2,2) |
Propositional Logic
Syntax (cont.)
|
|
|
|
connectives (Ù,Ú,Þ,Û) - logically combine sentences |
|
PÙQ, PÚQ, PÞQ, PÛQ are complex
sentences |
|
e.g. PÞØQ: “If there is
a mine at (1,2), then there is not a mine at (2,2).” |
|
parentheses - disambiguates grammar |
|
e.g. PÞØQ ÙQ |
|
PÞ(ØQ ÙQ) vs. (PÞØQ) ÙQ |
Propositional Logic
Semantics
|
|
|
|
commitments to the meanings of
propositions |
|
(“P” without an interpretation is
meaningless.) |
|
propositional symbol interpretations |
|
commitments to the meanings of
connectives, etc. |
|
(“Þ” without an interpretation is meaningless.) |
|
truth tables |
Truth Tables
|
|
|
truth table - table of truth
assignments to propositions and resulting truth values for complex sentences |
|
truth tables for defining connectives |
Truth Tables (cont.)
|
|
|
|
tables can easily become large! |
|
Exponential growth with increase in
propositional symbols |
Validity, Satisfiability,
Models
|
|
|
A sentence is valid if it is true for
all possible truth assignments (a.k.a. a tautology) e.g. (P ÚØP) |
|
A sentence is satisfiable if there
exists a “satisfying” truth assignment (i.e. a truth assignment for which the
sentence is true). |
|
A truth assignment which satisfies a
sentence is a model of that sentence. |
Entailment
|
|
|
|
entailment - whether a sentences
follows from other sentences |
|
KB Ö f means knowledge base KB entails formula f |
|
If a truth assignment that
satisfies all sentences in KB also satisfies formula
f,
f
is entailed by KB |
Inference
|
|
|
|
inference rules - deduce new sentences
from old sentences |
|
KB | f means knowledge base KB infers or proves formula f |
|
If there are a set of
inference actions which derive the truth of formula f from the sentence in KB, f is inferred
by KB |
Semantics: Relating the
Representation to the World
Relationships Between
Entailment and Inference
|
|
|
soundness - all inferences correct? |
|
completeness - all conclusions
reachable? |
Knowledge Representation
and Reasoning
|
|
|
|
|
A logic consists of |
|
a formal language consisting of |
|
syntax |
|
semantics |
|
a proof theory |
|
terms: sentences, KB, valid,
satisfiable, model, entail, inference rule, sound, complete |
Knowledge Representation
and Reasoning (cont.)
|
|
|
All KR&R languages have syntax,
semantics, and ontological and epistemological commitments. |
Knowledge-Based Agent
Review
Advantages
|
|
|
KB-agents can achieve competence
quickly, by learning or being told facts |
|
KB-agents can adapt. Changes in the world cause updates to KB |
|
Flexible; no reprogramming! |
Difficulties
|
|
|
expressivity - limits of what knowledge
a logic can express |
|
tractability - limits of what can be
reasoned within computational constraints |
|
fundamental tradeoff between
expressivity and tractability |
|
knowledge acquisition - the difficulty
of expressing and codifying human knowledge |
Example: SSA Circuit
Fault Testing
|
|
|
|
Problem Overview |
|
Combinational circuits |
|
Single-Stuck-At (SSA) faults |
|
Automatic Test Pattern Generation |
|
Notation translation for Larrabee paper |
|
Normal circuit example |
|
Conversion to Conjunctive Normal Form
(CNF) |
Problem Overview
|
|
|
|
|
Suppose: |
|
You’re working in circuit testing |
|
You test a great many combinational
circuit designs (many quite complex). |
|
You wish to find a way to automate
testing of circuits for Single Stuck-At (SSA) faults: |
|
A single circuit wire “stuck at” a
constant value (e.g. 0 = false=grounded) |
|
For any given fault, it would be nice
to have a circuit input which would give a different result if fault / no
fault. |
Combinational Circuits
Larrabee Notation
|
|
|
In the Larrabee paper, a different
logical notation is used: |
Conversion to CNF
|
|
|
Eliminate Þ and Û |
|
Move negations in (form
literals) using deMorgan’s Law |
|
Distribute Ù and Ú to form
conjunction of disjunctions |
|
Worked example: X Û (Y Ù ØZ) |
Eliminate Þ and Û
|
|
|
Replace XÛY with (XÞY) Ù (YÞX) |
|
Replace XÞY with ØXÚY |
|
Worked example: |
|
X Û (YÙØZ) = |
|
(X Þ (YÙØZ)) Ù ((YÙØZ) Þ X) = |
|
(ØX Ú (YÙØZ)) Ù (Ø(YÙØZ) Ú X) |
Move Negations In
|
|
|
|
deMorgan’s Law: |
|
Replace Ø(XÚY) with (ØX ÙØY) |
|
Replace Ø(XÙY) with (ØX Ú ØY) |
|
Worked example: |
|
(ØX Ú (YÙØZ)) Ù (Ø(YÙØZ) Ú X) = |
|
(ØX Ú (YÙØZ)) Ù ((ØY Ú ØØZ) Ú X) = |
|
(ØX Ú (YÙØZ)) Ù ((ØY Ú Z) Ú X) = |
|
(ØX Ú (YÙØZ)) Ù (ØY Ú Z Ú X) |
|
At this point, you should only have
complex sentences made up of Ù, Ú, and literals |
Form Conjunction of
Disjunctions (CNF) with Distribution
|
|
|
|
Replace (f0 Ú (f 1 Ù … Ù f n)) |
|
with ((f0 Ú f1) Ù … Ù (f0 Ú fn)) where fi is
a formula |
|
Continue until you have one conjunction
(and) of disjunctions (or’s). |
|
(ØX Ú (YÙØZ)) Ù (ØY Ú Z Ú X) = |
|
((ØXÚY) Ù (ØXÚØZ)) Ù (ØY Ú Z Ú X) = |
|
(ØXÚY) Ù (ØXÚØZ) Ù (ØY Ú Z Ú X) |
Conjunctive Normal Form
|
|
|
|
This is called Conjunctive Normal Form
(CNF). |
|
Any CNF form can be converted to 3CNF
or k-CNF by introducing variables and splitting disjunctions: |
|
(PÚQÚRÚSÚT) is equivalent to (PÚQÚU) Ù (ØUÚRÚV) Ù (ØVÚSÚT) |
SSA Circuit Fault Testing
Example
|
|
|
Suppose we wish to test the following
circuit for a SSA fault at D with D stuck at true: |
Fault Model
|
|
|
We model the fault by introducing D’,
which is stuck at true and affects the value of X which we rename X’: |
Test Pattern Generation
|
|
|
We want to find a test pattern (inputs
resulting in different outputs for correct/faulty cases) |
|
This is accomplished by first creating
a circuit with both our correct and fault models, which evaluates to true
when the correct and fault circuits have different outputs. |
Test Pattern Generation
(cont.)
|
|
|
Then we fix the output of this combined
circuit to true, and treat this as a boolean satisfiability problem, seeking
a satisfying truth assignment to the inputs. |
|
Such an assignment will be a test
pattern suitable for testing for the given fault. |
SSA Test Pattern
Generation Summary
|
|
|
Given: combinational circuit, possible
fault |
|
Build fault model |
|
Build “test circuit” combining normal
and fault model, evaluating true iff outputs of each are different |
|
Fix output of test circuit to true |
|
Convert circuit logic to CNF form |
|
Use GSAT to find a satisfying truth
assignment to inputs. |
Theorem Proving
|
|
|
|
Proof by Contradiction: |
|
Given KB, want to show KB Ö f (KB entails f) |
|
Let KB’ = KB È {Øf} |
|
If we can prove that KB’ Ö false (inconsistent, contradiction), then we’ve proven that
KB Ö f |
|
If KB’ | false and our inference rules are sound then, KB’ Ö false |
Propositional Logic
Inference
|
|
|
|
Can use propositional logic inference
rules of Figure 6.13, or… |
|
Can convert to CNF and do resolution
theorem proving |
|
Example: |
|
KB = {P, PÞQ, QÞR} |
|
Does this infer R? |
Resolution Theorem
Proving Example
|
|
|
KB’ = {P, PÞQ, QÞR, ØR} = |
|
= (P Ù (ØP Ú Q) Ù (ØQ Ú R) Ù ØR) |
|
{P} (KB) |
|
{ØP Q} (KB) |
|
{ØQ R} (KB) |
|
{ØR} (negated goal) |
|
{Q} (1,2) |
|
{R} (3,5) |
|
{} (4,6) à Contradiction! Q.E.D. |
Summary
|
|
|
KB-agent: “Knowledge is power” à “Ability
to derive new knowledge is ability to increase power.” |
|
Overview of Propositional Logic as a
language for a KB-agent |
|
Tradeoff: expressivity vs. tractability |
|
Practical Example: circuit test pattern
generation |
|
Automatic theorem proving approaches |
|
|