Upload
melinda-wheeler
View
223
Download
0
Embed Size (px)
Citation preview
החלטה ודרכי מידע ייצוג
• Logics are formal languages for representing information such that conclusions can be drawn
• Syntax defines the sentences in the language• Semantics define the “meaning” of sentences;
– i.e., define truth of a sentence in a world• E.g., the language of arithmetic
– x+2 ≥ y is a sentence; x2+y > is not a sentence
2
Logic in general
• Propositional logic is the simplest logic – illustrates basic ideas
• 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)
• Implication also is Not S1 S2 • If S1 and S2 are sentences, S1 S2 is a sentence
(biconditional)–
3
Propositional logic: Syntax
Rules for evaluating truth with respect to a model m:S is true iff S is false S1 S2 is true iff S1 is true and S2 is trueS1 S2 is true iff S1is true or S2 is trueS1 S2 is true iff S1 is false or S2 is true i.e., is false iff S1 is true and S2 is falseS1 S2 is true iff S1S2 is true and S2S1 is true
Simple recursive process evaluates an arbitrary sentence, e.g.,P1,2 (P2,2 P3,1) = true (false true) = true true = true
4
Propositional logic: Semantics
5
Truth tables for connectives
More examples
• Show that A B ≡ (A → B) Λ (B → A)• Show that: [(t → w) Λ ~ w] → ~ t• Show that: [(p → q) Λ (q → r) ] → (p → r)
Law of Modus Tollens
Given: t → w t → w w ~ w
Prove: t ~ t
or [(t → w) Λ ~ w] → ~ t
Set up a truth table to prove!
Prove [(t → w) Λ ~ w] → ~ t]
t w ~t ~w t → w (t → w) Λ ~ w [(t → w) Λ ~ w ]→ ~ t
Prove [(t → w) Λ ~ w] → ~ t
t w ~t ~w t → w (t → w) Λ ~ w (t → w) Λ ~ w → ~ t
T T F F T F T
T F F T F F T
F T T F T F T
F F T T T T T
[(t → w) Λ ~ w] → ~ t is a Tautology therefore a valid argument!
[(p → q) Λ (q → r) ] → (p → r)
Chain Rule (Law of Syllogism)
p q r p → q q → r (p → q) Λ (q → r) p → r See above
[(p → q) Λ (q → r) ] → (p → r)
Chain Rule (Law of Syllogism)
p q r p → q q → r (p → q) Λ (q → r) p → r See above
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
[(p → q) Λ (q → r) ] → (p → r)
Chain Rule (Law of Syllogism)
p q r p → q q → r (p → q) Λ (q → r) p → r See above
T T T T T T T T
T T F T F F F T
T F T F T F T T
T F F F T F F T
F T T T T T T T
F T F T F F T T
F F T T T T T T
F F F T T T T T
Chain RuleExample
p : You study
q r
q : You pass
r : You get a surprise
p qP1: P2:
If you study, then you will pass.
If you pass, then you will get a surprise.
Two sentences are logically equivalent iff true in same models: α ≡ β iff α ╞ β and β α╞
•
14
Logical equivalence
• A sentence is satisfiable if it is true in some modele.g., A B, C
• A sentence is unsatisfiable if it is true in no modelse.g., A A
• Disjunction normal form (DNF) : Only “Or” between Logic statements– (A1 B1) (A2 B2) (A3 B3)
• Conjunction normal form (CNF) : Only “And” between Logic statements– (A1 B1) (A2 B2) (A3 B3)
–
15
Satisfiability
• Consider random 3-CNF sentences (randomly selected 3 distinct symbols, each negated with 50% probability), e.g.,(D B C) (B A C) (C B E) (E D B) (B E C)m = number of clauses n = number of symbols (overall, in the KB)– Hard problems seem to cluster near m/n = 4.3 (critical point)– Lower ratio is less constrained, higher ratio is more
constrained
16
Hard satisfiability problems
17
Hard satisfiability problems
Graph showing probability that a random 3-CNF sentence with n=50 symbols is satisfiable, as a function of the clause/symbol ratio m/n
18
Other Logics…
• Constants KingJohn, 2, HU, ... • Predicates Brother, >, ...• Functions Sqrt, LeftLegOf, ...• Variables x, y, a, b, ...• Connectives , , , , • Equality = • Quantifiers ,
19
First Order Logic
• <variables> <sentence>
Everyone at HU is smart:x At(x, HU) Smart(x)
• x P is true in a model m iff P is true with x being each possible object in the model
• Roughly speaking, equivalent to the conjunction of instantiations of P
At(KingJohn, HU) Smart(KingJohn) At(Richard, HU) Smart(Richard) At(HU, HU) Smart(HU) ...
20
Universal quantification
• <variables> <sentence>• Someone at TAU is smart:• x At(x, TAU) Smart(x)• x P is true in a model m iff P is true with x being
some possible object in the model• Roughly speaking, equivalent to the disjunction of
instantiations of PAt(KingJohn, TAU) Smart(KingJohn)
At(Richard, TAU) Smart(Richard) At(TAU, TAU) Smart(TAU) ...
21
Existential quantification
• Brothers are siblingsx y Brother(x, y) Sibling(x, y)
• “Sibling” is symmetricx y Sibling(x, y) Sibling(y, x)
• One’s mother is one’s female parentx y Mother(x, y) (Female(x) Parent(x, y))
• A first cousin is a child of a parent’s siblingx y FirstCousin(x, y) p ps Parent(p, x) Sibling(ps, p) Parent(ps, y)
22
Fun with sentences
The set domain: • s Set(s) (s = {} ) (x,s2 Set(s2) s = {x|s2})• x,s {x|s} = {}• x,s x s s = {x|s}• x,s x s [ y,s2} (s = {y|s2} (x = y x s2))]• s1,s2 s1 s2 (x x s1 x s2)• s1,s2 (s1 = s2) (s1 s2 s2 s1)• x,s1,s2 x (s1 s2) (x s1 x s2)• x,s1,s2 x (s1 s2) (x s1 x s2)
23
Using FOL
Examples
• http://people.umass.edu/partee/NZ_2006/More%20Answers%20for%20Practice%20in%20Logic%20and%20HW%201.pdf
The set domain: • s Set(s) (s = {} ) (x,s2 Set(s2) s = {x|s2})• x,s {x|s} = {}• x,s x s s = {x|s}• x,s x s [ y,s2} (s = {y|s2} (x = y x s2))]• s1,s2 s1 s2 (x x s1 x s2)• s1,s2 (s1 = s2) (s1 s2 s2 s1)• x,s1,s2 x (s1 s2) (x s1 x s2)• x,s1,s2 x (s1 s2) (x s1 x s2)
25
Using FOL
בפועל להחליט דרכים
• Fuzzy Logic• MDP• Game Theory
Copyright © 2002, 2004, Andrew W. Moore
Applications of MDPs
This extends the search algorithms of your first lectures to the case of probabilistic next states.Many important problems are MDPs….
… Robot path planning… Travel route planning… Elevator scheduling… Bank customer retention… Autonomous aircraft navigation… Manufacturing processes… Network switching & routing
The “Standard” Approach – MDPMDP model is a 4-tuple where:• S is the set of all possible environment states.• N is a group of agents.• Ai is the set of all possible joint actions applicable in the
environment by agent i.• Pr models dynamics
– S x A x S [0, 1] with Pr(si, a, sj) denotes the probability that action a executed in state si, will transition to state sj .
• R is the reward function for agents’ possible actions.
Copyright © 2002, 2004, Andrew W. Moore
Markov Decision ProcessesAn MDP has…• A set of states {s1 ··· sN}
• A set of actions {a1 ··· aM}
• A set of rewards {r1 ··· rN} (one for each state)• A transition probability function
kijP
kijkij action use I and ThisNextProbP
At each step:0. Call current state Si
1. Receive reward ri
2. Choose action {a1 ··· aM}
3. If you choose action ak you’ll move to state Sj with probability
4. All future rewards are discounted by g
John Nash, the person portrayed in “A Beautiful Mind”
Game theory: Payoff matrix
• A payoff matrix shows the payout to each player, given the decision of each player
Action C Action D
Action A
10, 2 8, 3
Action B
12, 4 10, 1
Person 1
Person 2
How do we find Nash equilibrium (NE)?
• Step 1: Pretend you are one of the players• Step 2: Assume that your “opponent” picks a particular action• Step 3: Determine your best strategy (strategies), given your
opponent’s action– Underline any best choice in the payoff matrix
• Step 4: Repeat Steps 2 & 3 for any other opponent strategies• Step 5: Repeat Steps 1 through 4 for the other player• Step 6: Any entry with all numbers underlined is NE
Decision tree in a sequential game: Person 1 chooses first
A
B
C
Person 1 chooses yes
Person 1 chooses no
Person 2 chooses yes
Person 2 chooses yes
Person 2 chooses no
Person 2 chooses no
20, 20
5, 10
10, 5
10, 10
Slide 34
2 player zero-sum finite NONdeterministic games of perfect information
The search tree now includes states where neither player makes a choice, but instead a random decision is made according to a known set of outcome probabilities.
Game theory value of a state is the expected final value if both players are optimal.
Let’s compute a matrix form of this!
( )-a
( )-chance
( )-b ( )-b
-20 +4
( )-b
( )-chance
+3
( )-a
+10
( )-a
-5
( )-a
p=0.8 p=0.2
p=0.5 p=0.5
Slide 35
Minimax with Matrix FormsA can decide from this matrix which strategy is “best”. For each strategy, A considers the worst-case counter strategy by B. A chooses the row with the maximum minimum value. For A, the value of the game is this value.In this example A chooses A-II, and says game has value 3.
When B decides which strategy is best, B searches for which column has the minimum maximum value.In this example, B chooses B-II, and says game has value 3.
B-I B-II B-III
A-I 7 3 -1
A-II 7 3 4
A-III 2 2 2
A-IV 2 2 2
Fundamental game theory result (proved by von Neumann):In a 2-player, zero-sum game of perfect information, Maximin==Minimax. And there always exists an optimal pure strategy for each player.
Fuzzy Logic What is Fuzzy Logic?
Problem-solving control system methodology Linguistic or "fuzzy" variables Example:
IF (process is too hot)
AND (process is heating rapidly)
THEN (cool the process quickly)
Approach
The Rule Matrix Error (Columns) Error-dot (Rows) Input conditions (Error
and Error-dot) Output Response
Conclusion (Intersection of Row and Column)
-ve Error
Zero Error
+ve Error
-ve Error-
dot
Zero Error-
dot
No change
+ve Error-
dot