Presentation is loading. Please wait.

Presentation is loading. Please wait.

Propositional Logic.

Similar presentations


Presentation on theme: "Propositional Logic."— Presentation transcript:

1 Propositional Logic

2 Recall: Wumpus World Environment: Actuators: 4x4 grid of rooms
Agent starts in [1,1] Gold in a random room Wumpus in a different random room Bottomless pits in some rooms Wumpus can eat agent if in same room Agent can shoot Wumpus with arrow Actuators: Move left Move right Move up Move down Grab gold Shoot

3 Wumpus World Continued
Sensors: Stench (adjacent square contains Wumpus) Breeze (adjacent square contains pit) Glitter (this square contains gold) Scream (Wumpus killed) Performance measures: Gold: +1000 Death: (falling into pit or eaten by Wumpus) -1 per step -10 for using the arrow

4 Propositional logic Syntax: Defines what makes a valid statement:
Statements are constructed from propositions A proposition can be either true or false Proposition made up of symbols and connectives Semantics: Rules for determining the truth of a statement <Later>

5 Propositional Logic - Syntax
Variables: represent a proposition that can be true or false ex. Breeze in [2, 1]  Breeze2,1 Pit in [2, 2]  Pit2,2 ex. n is Odd  n_odd Connectives: proposition operators Negation: not, , ~ Conjunction: and,  Disjunction: or,  Implication: implies, => Biconditional: iff, <=>

6 Propositional Logic - Syntax
Sentence: statement composed of variables and operators ex. Pit2,2  Pit1,3 Formally: Sentence: True | False | Symbol | Sentence| Sentence  Sentence | Sentence  Sentence | Sentence => Sentence | Sentence <=> Sentence

7 Propositional logic Syntax: Defines what makes a valid statement:
Statements are constructed from propositions A proposition can be either true or false Proposition made up of symbols and connectives Semantics: Rules for determining the truth of a statement Truth table Rules of logic

8 Propositional Logic Semantics
Some Rules of Logic: Modus Ponens: P => Q, P: can derive Q deMorgan’s: (AB): can derive A  B Contrapositive: : (P => Q) => (Q => P )

9 Inference with propositional logic
View it as a search problem: starting state: Initial Knowledge Base (KB) actions: all ways of deriving new propositions from the current KB result: add the new proposition to the KB goal: end up with the proposition we want to prove

10 Inference with propositional logic
View it as a search problem: starting state: Initial Knowledge Base (KB) actions: All the ways of deriving new propositions from the current KB result: Add the new proposition to the KB goal: End up with the proposition we want to prove

11 More Logical Equivalences

12 Propositional Logic for Wumpus World
Goal: Infer (prove) no Pit in [2, 1] (On board)

13 Inference as Search Initial Knowledge Base Rule 4 Rule 1 Rule 2 Rule 3
Expanded Knowledge Base GOAL

14 Drawback of Propositional Logic
Need variable for each condition/rule, for each square Breeze1,1 = false, Breeze1,2 = true, … Breeze1,1 <=> Pit1,2 V Pit2,1, … Breeze2,1 <=> Pit2,2 V Pit3,1, … Need these rules for each square!

15 First order logic (FOL aka predicate calculus)
Syntax: Objects – represent entities (~nouns) Constants: e.g. Wumpus, Square1,2 Variables: x, y Functions – describe relationships between objects e.g. Adjacent(Square1,2, Square1,3), AgentAt(x, t): (x is location, t is time) Predicates – boolean function – describes a single object(~adjective) e.g. Breezy(Square1,2), Pit(Square1,2)

16 First order logic (aka predicate calculus)
Quantifiers: describe “scope” of variables “for all”: “there exists”: Connectives: operators (as with Propositional Logic) Negation: not, , ~ Conjunction: and,  Disjunction: or,  Implication: implies, => Biconditional: iff, <=>

17 From text to FOL Given Predicates:
Purple(x), Mushroom(x), Poisonous(x) “All purple mushrooms are poisonous” “No purple mushroom is poisonous” Given: CSStudent(x), ProgLang(x), Knows(x,y) “Every CS student knows a programming language” “There is some programming language that all CS students know” 1) For all x purple(x) n mushroom(x) => poisonous(x) 2) For all x purple(x) n mushroom(x) => not poisonous(x) OR not There exists x purple(x) n mushroom(x) n poisonous(x) 3) For all x there exists y CSS(x) => PL(y) n knows(x,y) 4) There exists x PL(x) n [for all y CSS(y) n knows(x,y)]

18 From FOL to text “Every rose has its thorn” “Everybody loves somebody”
“Everybody loves somebody, sometime”

19 FOL for Wumpus World adjacentTo(), Pit(), Square(), Breezy() “All squares adjacent to Pits are Breezy” Smelly(), Contains() Wumpus “There is a smelly room adjacent to the room containing the Wumpus”

20 FOL for Wumpus World adjacentTo(x, y), Pit(x), Square(x), Breezy(x) “All squares adjacent to Pits are Breezy” Smelly(), Contains() Wumpus “There is a smelly room adjacent to the room containing the Wumpus”

21 FOL for Wumpus World adjacentTo(x, y), Pit(x), Square(x), Breezy(x) “All squares adjacent to Pits are Breezy” Smelly(), Contains() Wumpus “There is a smelly room adjacent to the room containing the Wumpus”

22 FOL for Wumpus World adjacentTo(), Pit(), Square(), Breezy() “All squares adjacent to Pits are Breezy” Smelly(), Contains() Wumpus “There is a smelly room adjacent to the room containing the Wumpus”

23 FOL in Planning/Robotics

24 Wumpus World via Planning
Use Inference to formulate a Plan (for example): Locate Smelly squares Locate Breezy squares Determine Wumpus location Determine Pit locations Locate Gold

25 Wumpus World via Planning
Use Inference to formulate a Plan (for example): Locate Smelly squares Locate Breezy squares Determine Wumpus location Determine Pit locations Locate Gold Planning – process of determining sequence of steps to solve a problem

26 Terminology State: conjunction (∧’s) of Predicates
ex. AgentAt(Square1,2) ∧ Breezy(Square1,2) ∧Smelly(Square1,2) Action: function applied to a state that results in a new state ex. MoveRight(Agent, Square1,2) -> AgentAt(Square2,2)

27 Terminology Precondition: state required prior to applying action
Postcondition/effect: state yielded after applying function

28 Example: Blocks World 3 blocks on a table
At most 1 block can fit on top of another Robot can pick up one block and move it to table or on top of another block

29 Planning as Search START Action 4 Action 1 Action 2 Action 3 STATE …
GOAL

30 Shakey the Robot Stanford Research Institute (1966)
First general purpose mobile robot

31

32

33

34 Robotics’ Shakey Start
Living Room (L) Kitchen (K) Climable object obj tv Sh swi Light switch Bedroom (B)

35 Shakey collected video and sensor information and computer processed this information

36 Robotics's Shakey start
Go(from, to) Preconditions: At(Sh, from) Postconditions: At(Sh, to) Push(obj, fr, to) Preconditions: At(Sh, fr)  At(obj, fr) Postconditions: At(Sh, to)  At(obj, to) ACTIONS At(Sh,L)  At(obj,K)  At(swi,B)  At(tv,L) Go(L,B) Push(tv,L,B) Go(L,K) Push(tv,L,K) At(Sh,K)  At(tv,K) STRIPS planning explicit representation of high-level environmental states… -- low-level engineering of actuation and control had to be improved - -algorithms for reasoning about the robot's environment had to be improved VIDEO! At(Sh,L)  At(tv,K)  At(obj,L) GOAL

37 Shakey video


Download ppt "Propositional Logic."

Similar presentations


Ads by Google