Title: Propositional Logic Intro, Syntax
1Propositional Logic Intro, Syntax Computer
Science cpsc322, Lecture 19 (Textbook Chpt
5.0-5.2) February, 25, 2008
2Lecture Overview
- Recap (detailed examples of planning as CSP)
- Logic Intro
- Propositional Definite Clause Logic Syntax
3Planning as a CSP
- An alternative approach to planning is to set up
a planning problem as a CSP! - We simply reformulate a STRIPS model as a set of
variables and constraints - Once this is done we can even express additional
aspects of our problem (as additional
constraints)
4Planning as a CSP Variables
- To do this, we need to unroll the plan for a
fixed number of steps - this is called the horizon
- To do this with a horizon of k
- construct a variable for each feature at each
time step from 0 to k - construct a boolean variable for each action at
each time step from 0 to k - 1.
5Delivery Robot ExampleActions
- The robots actions are
- move clockwise (mc ),
- move anti-clockwise (mac )
- PUC - Rob picks up coffee
- must be at the coffee shop, and must not have
coffee - DelC - Rob delivers coffee
- must be at the office, and must have coffee
- PUM - Rob picks up mail
- must be in the mail room, and mail must be
waiting - DelM - Rob delivers mail
- must be at the office and have mail
6Robot Example 1 one layer
(T,F)
(off, cs, mr, lab)
(off, cs, mr, lab)
mac0
(T,F)
(T,F)
(T,F)
(T,F)
7Robot Example 2 one layer
(T,F)
(off, cs, mr, lab)
(off, cs, mr, lab)
mac0
(T,F)
(T,F)
(T,F)
(T,F)
8Lecture Overview
- Recap (detailed examples planning as CSP)
- Logic Intro
- Propositional Definite Clause Logic Syntax
9Agents acting in an environment
Representation Reasoning
Representation Reasoning
10Big Picture what is coming next
Stochastic
Deterministic
Search
Single Action
Constraint Satisfaction (CSPs)
Decision
Logics
Search
Sequence of Actions
Constraint Satisfaction (CSPs)
Planning
11Logic A more general framework for
representation reasoning
- Let's now think about how to represent a world
about which we have only partial (but certain)
information - What do we need to represent?
12Why Logics?
- Natural to express knowledge about the world
- (more natural than a flat set of variables
constraints) - Every 322 student will pass the midterm
- It is easy to incrementally add knowledge
- It is easy to check and debug knowledge
- Provide language for asking complex queries
- Well understood formal properties
13Propositional Logic
- We will study the simplest form of Logic
Propositional - The primitive elements are propositions
Boolean variables that can be true, false - The goal is to illustrate the basic ideas
- This is a starting point for more complex logics
(e.g., first-order logic) - Boolean nature can be exploited for efficiency.
14Logics in practice
- Agent is told (perceives) some facts about the
world - Agent is told (already knows / learns) how the
world works - Agent can answer yes/no questions about whether
other facts must be true
15Using Logics in designing an Agent
- Begin with a task domain.
- Distinguish those things you want to talk about
(the ontology). - Choose symbols in the computer to denote
propositions - Tell the system knowledge about the domain.
- Ask the system whether new statements about the
domain are true or false.
16Electrical Environment
/down
/ up
17Propositional logic Complete Language
- The proposition symbols p1, p2 etc are
sentences - If S is a sentence, ?S is a sentence (negation)
- If S1 and S2 are sentences, S1 ? S2 is a sentence
(conjunction) - If S1 and S2 are sentences, S1 ? S2 is a sentence
(disjunction) - If S1 and S2 are sentences, S1 ? S2 is a sentence
(implication) - If S1 and S2 are sentences, S1 ? S2 is a sentence
(biconditional)
18Propositional Definite Clauses
- Propositional Definite Clauses our first logical
representation and reasoning system. - (very simple!)
- Only two kinds of statements
- that a proposition is true
- that a proposition is true if one or more other
propositions are true - Why still useful?
- Adequate in many domains (with some adjustments)
- Reasoning steps easy to follow by humans
- Inference linear in size of your set of
statements - Similar formalisms used in cognitive architectures
19Representation and Reasoning System
- Definition (RSS)
- A Representation and Reasoning System (RRS) is
made up of - syntax specifies the symbols used, and how they
can be combined to form legal sentences - semantics specifies the meaning of the symbols
- reasoning theory or proof procedure a
specification of how an answer can be produced.
20Lecture Overview
- Recap (detailed examples planning as CSP)
- Logic Intro
- Propositional Definite Clause Logic Syntax
21Propositional Definite Clauses Syntax
Definition (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 is a rule of the form h ? b where h
is an atom and b is a body. (Read this as h
if b.'')
Definition (atom) A knowledge base is a set of
definite clauses
22PDC Syntax Example
- The following are syntactically correct
statements in our language - ai_is_fun
- ai_is_fun ? get_good_grade
- ai_is_fun ? get_good_grade ? not_too_much_work
- ai_is_fun ? get_good_grade ? not_too_much_work ?
prof_can_operate_laptop - The following statements are syntactically
incorrect - ai_is_fun ? ai_is_boring
- ai_is_fun ? relaxing_term ? get_good_grade ?
not_too_much_work
Do any of these statements mean anything?
Syntax doesn't answer this question.
23Next class
- Definite clauses Semantics and Proofs (textbook
5.3)