ייצוג מידע ודרכי החלטה
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 P 1, P 2, etc. are sentences – If S is a sentence, S is a sentence (negation) – If S 1 and S 2 are sentences, S 1 S 2 is a sentence (conjunction) – If S 1 and S 2 are sentences, S 1 S 2 is a sentence (disjunction) – If S 1 and S 2 are sentences, S 1 S 2 is a sentence (implication) Implication also is Not S 1 S 2 – If S 1 and S 2 are sentences, S 1 S 2 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 S 1 S 2 is true iff S 1 is true and S 2 is true S 1 S 2 is true iff S 1 is true or S 2 is true S 1 S 2 is true iffS 1 is false or S 2 is true i.e., is false iffS 1 is true and S 2 is false S 1 S 2 is true iffS 1 S 2 is true and S 2 S 1 is true Simple recursive process evaluates an arbitrary sentence, e.g., P 1,2 (P 2,2 P 3,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) t → w) Λ ~ w] → ~ t Show that: [(t → w) Λ ~ w] → ~ t p → q) Λ q → r)] → p → r) Show that: [(p → q) Λ (q → r) ] → (p → r)
Law of Modus Tollens Given: t → w t → w w ~ w Prove: t ~ t t → w) Λ ~ w] → ~ t or [(t → w) Λ ~ w] → ~ t Set up a truth table to prove!
t → w) Λ ~ w] → ~ t] Prove [(t → w) Λ ~ w] → ~ t] tw~t~w t → w t → w) Λ ~ w (t → w) Λ ~ w t → w) Λ ~ w ] → ~ t [(t → w) Λ ~ w ] → ~ t
t → w) Λ ~ w] → ~ t Prove [(t → w) Λ ~ w] → ~ t tw~t~w t → w t → w) Λ ~ w (t → w) Λ ~ w t → w) Λ ~ w → ~ t (t → w) Λ ~ w → ~ t TTFFTFT TFFTFFT FTTFTFT FFTTTTT t → w) Λ ~ w] → ~ t is a Tautology therefore a valid argument! [(t → w) Λ ~ w] → ~ t is a Tautology therefore a valid argument!
p → q) Λ q → r)] → p → r) [(p → q) Λ (q → r) ] → (p → r) Chain Rule (Law of Syllogism) pqr p → q q → r p → q) Λ q → r) (p → q) Λ (q → r) p → r See above
p → q) Λ q → r)] → p → r) [(p → q) Λ (q → r) ] → (p → r) Chain Rule ( Law of Syllogism) pqr p → q q → r p → q) Λ q → r) (p → q) Λ (q → r) p → r See above TTT TTF TFT TFF FTT FTF FFT FFF
p → q) Λ q → r)] → p → r) [(p → q) Λ (q → r) ] → (p → r) Chain Rule (Law of Syllogism) pqr p → q q → r p → q) Λ q → r) (p → q) Λ (q → r) p → r See above TTTTTTTT TTFTFFFT TFTFTFTT TFFFTFFT FTTTTTTT FTFTFFTT FFTTTTTT FFFTTTTT
Chain Rule Example p : You study q r q : You pass r : You get a surprise p q P 1: P 2: 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 model e.g., A B, C A sentence is unsatisfiable if it is true in no models e.g., A A Disjunction normal form (DNF) : Only “Or” between Logic statements – ( A 1 B 1 ) (A 2 B 2 ) (A 3 B 3 ) Conjunction normal form (CNF) : Only “And” between Logic statements – ( A 1 B 1 ) (A 2 B 2 ) (A 3 B 3 ) 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…
ConstantsKingJohn, 2, HU,... PredicatesBrother, >,... FunctionsSqrt, LeftLegOf,... Variablesx, y, a, b,... Connectives , , , , Equality= Quantifiers , 19 First Order Logic
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) Universal quantification
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 P At(KingJohn, TAU) Smart(KingJohn) At(Richard, TAU) Smart(Richard) At(TAU, TAU) Smart(TAU) Existential quantification
Brothers are siblings x y Brother(x, y) Sibling(x, y) “Sibling” is symmetric x y Sibling(x, y) Sibling(y, x) One’s mother is one’s female parent x y Mother(x, y) (Female(x) Parent(x, y)) A first cousin is a child of a parent’s sibling x 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,s 2 Set(s 2 ) s = {x|s 2 }) x,s {x|s} = {} x,s x s s = {x|s} x,s x s [ y,s 2 } (s = {y|s 2 } (x = y x s 2 ))] s 1,s 2 s 1 s 2 ( x x s 1 x s 2 ) s 1,s 2 (s 1 = s 2 ) (s 1 s 2 s 2 s 1 ) x,s 1,s 2 x (s 1 s 2 ) (x s 1 x s 2 ) x,s 1,s 2 x (s 1 s 2 ) (x s 1 x s 2 ) 23 Using FOL
Examples ore%20Answers%20for%20Practice%20in%20 Logic%20and%20HW%201.pdf ore%20Answers%20for%20Practice%20in%20 Logic%20and%20HW%201.pdf
The set domain: s Set(s) (s = {} ) ( x,s 2 Set(s 2 ) s = {x|s 2 }) x,s {x|s} = {} x,s x s s = {x|s} x,s x s [ y,s 2 } (s = {y|s 2 } (x = y x s 2 ))] s 1,s 2 s 1 s 2 ( x x s 1 x s 2 ) s 1,s 2 (s 1 = s 2 ) (s 1 s 2 s 2 s 1 ) x,s 1,s 2 x (s 1 s 2 ) (x s 1 x s 2 ) x,s 1,s 2 x (s 1 s 2 ) (x s 1 x s 2 ) 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 – MDP MDP model is a 4-tuple where: S is the set of all possible environment states. N is a group of agents. A i 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(s i, a, s j ) denotes the probability that action a executed in state s i, will transition to state s j. R is the reward function for agents’ possible actions.
Copyright © 2002, 2004, Andrew W. Moore Markov Decision Processes An MDP has… A set of states {s 1 ··· s N } A set of actions {a 1 ··· a M } A set of rewards {r 1 ··· r N } (one for each state) A transition probability function At each step: 0. Call current state S i 1. Receive reward r i 2. Choose action {a 1 ··· a M } 3. If you choose action a k you’ll move to state S j with probability 4. All future rewards are discounted by
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 CAction D Action A10, 28, 3 Action B12, 410, 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 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 ( )-chance +3 ( )-a +10 ( )-a -5 ( )-a p=0.8p=0.2 p=0.5
Slide 35 Minimax with Matrix Forms A 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-IB-IIB-III A-I73 A-II734 A-III222 A-IV222 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