Advertisement
SageTheWizard

cmpsc441 - exam 2 notes

Nov 11th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.37 KB | None | 0 0
  1. GAME: Well DEFINED game... nigga the fuck is chang talking about
  2. Like chess
  3. - 2 person game, well defined rules
  4. - Chess players
  5. - 1950's: Shanon -> Father of Information Theory *very important nigga.. probably not a nigga tho*
  6. - Came up with Game Theory: Principles w/ Modern game playing
  7. - 1953: Turing:
  8. - 1996 IBM DEEP BLUE: Deep Blue vs. Kastrov .. Deep Blue lost (Philly)
  9. - 1997 2nd Match (NY) ... Deep Blue won
  10. - 1998 3rd Match (Kastrov was pissed) .. IBM didn't wanna have a rematch
  11. Kastrov was pissed still
  12. - IBM WATSON - Literally won jeapordy
  13. - Game playing
  14. - application of search
  15. - state - board configuration
  16. - action - legal moves
  17. - goal - winning configuration
  18. - heuristic - scoring function (produces % chance of winning)
  19. - c*#Queens + c*#Kings .. etc.
  20. - Path is not important
  21. - Search Tree: Tic Tac Toe
  22. [ ][ ][ ]
  23. [ ][ ][ ] Init-state
  24. [ ][ ][ ]
  25. |
  26. | Next level is all possible "my" moves
  27. []
  28. / \
  29. This level is possible opponent moves
  30. The Goal is to: Search this path to pick the best move that will make it most likely to win
  31.  
  32. MIN MAX ALGORITHM (Shanon 1949):
  33. - Look ahead in the game tree to depth of N (N-Ply)
  34. - Evaluate score (heuristic) of each leaf node
  35. ex. 2 ply
  36. [] <-- current state (my turn)
  37. / | \
  38. []-5 []1 []7 <-- Possible my Turns (pick one to maximize your score)
  39. / \ / \ / \
  40. [] [] [] [] [] [] <-- Adversary's move (minmizing your score)
  41. Heur: -3 -5 2 1 7 8
  42. Oppenent will try to minimize your score so you have to choose a path that
  43. will minimize the damage he can do .. by minimizing
  44.  
  45. The silly thing is ... it gets inefficient the more legal moves you can make
  46. If the branching factor is like.. 20.. at depth of 10 .. you have 20^10 leaves
  47. and then you just kill yourself
  48. ... soo you speed that shit up by making the tree smaller.. but ya can't do that now can ya
  49. so need.. Algorithm Alpha Beta Prunning
  50.  
  51. ALPHA BETA PRUNNING -> Optimization of min-max by reducing # of leaves to evaluate
  52. ex ..
  53. []2
  54. / \
  55. []2 1[]
  56. / \ / \
  57. [] [] [] []
  58. 2 7 1 7
  59. So you're guarenteed at least 2 after evaluating the first branch there..
  60. so you evaluate that the next leaf would be 1 .. you just don't evalute the sibling node to it
  61. so you just don't go there since you can get at least 2
  62. Actual Algorithm
  63. [] alpha = -infinity---> update to 2, beta= infinity ---> 2, infinity
  64. /
  65. [] -infinity, infinity<-- update to 2---> -infinity, 2
  66. /
  67. []2
  68.  
  69. basically, if you find a beta value smaller than your alpha value, you stop that branch
  70. - you have to evalute at LEAST the first branch
  71.  
  72. Minmax normal = O(b^d) #leaves ... minmax prunning = O(b^(d/2))
  73.  
  74. _____________________________LOGIC_______________________________________________
  75.  
  76. LOGIC IN AI
  77. Neural Network is taking of again now because we now have the computational power for it
  78. - it originally was shit because of the lack of computational power
  79. Logic is a FORMAL LANGUAGE FOR KNOWLEDGE REPRESENTATION
  80. - Because it is a language it has a syntax and semantics
  81. - Syntax = Grammar - what are Legal expressions
  82. - Sematnics = Meanings - what syntatically legal statement is trying to convey
  83. - Proof System = Way to manipulate synatically correct expression to extract another
  84. ex. Robot w/ Sensors (Roomba)
  85. - Sensed umbrella and dirt dropping ---> conclusion: raining
  86.  
  87. TYPES OF LOGIC
  88. Propositional Logic:
  89. First-Order Logic:
  90.  
  91. Prolog: Logic Language
  92. remember append from scheme? (look up sorce code for it... 2 lazy 2 type)
  93. Prolog for append:
  94. append([],Y,Y). <-- ((null? ls1) ls2)
  95. append([A|X],Y,[A|Z]) :-append(X,Y,Z)
  96. * **************
  97. *(cons (car ls1)* (append cdr ls1) ls2)
  98.  
  99.  
  100. PROPOSITONAL LOGIC
  101. * Syntax and Semantics
  102. ex. a = (3 + 4) * 5;
  103. _ ____________
  104. left val right val
  105.  
  106. ex2. Chomsky "Colorless green ideas sleep furiously"
  107. Synatically correct (grammar)... symanticly.. it just doesn't work
  108. Term:
  109. sentence: Syntactically correct expressions
  110. (Well formed Formula) - WFF
  111. Syntax:
  112. Sentence --> Atomic | Complex
  113. Atomic --> "true" | "false" | symbol
  114. This is called "Backus Naur Form"
  115. Symbol --> P | Q | R | ...
  116. Complex --> ~Sentence | (Sentence) | (Sentence /\ sentense) |
  117. (Sentence \/ Sentence)| (Sentense -> sentence) |
  118. (Sentence <-> Sentence)
  119. What does this actually mean tho?
  120. 1. true / false are sentences
  121. 2. Prop. variable is sentence
  122. 3. If phi && Sci are sentenses, then so are (~phi), (phi /\ sci), (phi \/ sci)... and so on
  123. if we want to get rid of () we have to get fancy and define precidence
  124. Precidence:
  125. ~ /\ \/ -> <->
  126. High <----- Low
  127. ex. (A \/ (B /\ C)) == A \/ B /\ C
  128. ((A/\B) -> (C\/D)) : A/\B --> C\/D
  129. ex. A /\ B /\ C <-- Doesn't matter where () go (works with \/ too)
  130. Semantics:
  131. What the Given sentence means in the real world
  132.  
  133. Meaning of a sentence is either True or False
  134. read as t / f .... "TRUE" is literal, t just represents it
  135.  
  136. Interpretation:
  137. ex. A /\ B /\ C : t or f?
  138. - depends on what A B C means *INTERPREATION*
  139. assigning t / f to each variable
  140. Interpretation is how to figure out the assignment of each variables
  141. ex. cont.
  142. A = T
  143. B = T this is one possible assignment
  144. C = F where A /\ B /\ C = F
  145. Semenatics of a sentence depend on the interpretation
  146. The question comes...
  147. Is the sentence true (hold) given the interpretation?
  148. T = "HOLD" F = "FAILS"
  149. LOGICIAN NOTATION
  150. holds(phi,i): phi is true if the interpretation i
  151. fails(phi,i): phi is false in interpretation i
  152. - Semenatic rules
  153. 1. holds(true, i) for all i
  154. fails(false, i) for all i
  155. 2. holds(~phi, i) iff fails(phi, i) : NEGATION
  156. 3. holds(phi\/sci, i) iff holds(phi, i) or holds(sci, i) : DISJUNCTION
  157. 4. holds(phi/\sci, i) iff holds(phi, i) and holds(sci, i): CONJECTION
  158. 5. holds(phi->sci, i) iff fails(phi, i) or holds(sci, i): IMPL.
  159. 6. phi <-> sci =- (phi -> sci) /\ (sci -> phi)
  160. (~phi \/ sci) /\ (~sci \/ phi)
  161. 7. holds(P, i) iff i(p) = t
  162. fails(P, i) iff i(p) = f
  163. AND THUS BIRTHS TRUTHTABLES
  164. TERMS:
  165. 1. VALID: phi is valid iff for all interpretations holds(phi, i)
  166. ex. ~p \/ p,
  167. 2. SATISFIABLE: Phi is satisfiable iff there Exsists an interpretation where holds(phi, i)
  168. 3. UNSATISFIABLE: Phi is unsatisfiable iff for all interpretations fails(phi, i)
  169. ex. ~p /\ p
  170. GIVEN PHI, to find iout if PHI is VALID, SATISFIABLE or UNSATISFIABLE use a Truth Table
  171.  
  172. Boolean satisfiability prob.
  173. ex. if it rains, tom because sad
  174. if tom is sad, mary will buy me dinner
  175. john is sad
  176. today is rainy
  177. Will I get free dinner?
  178. yes
  179. p->q
  180. q->r
  181. s
  182. p
  183. ..... p = T, P->Q = T, Q = T, Q->R = T, R=T
  184. R = Goal
  185. Instead of truth tables we use inference (above)
  186.  
  187. TERM: Entailment
  188. - Given a knowledge base (everything in the KB is true) and a sentence S
  189. - if every interpretation that satisfy KB also satisfies S
  190. - then KB entails S
  191. or S is entailed from KB
  192. or S follow KB
  193.  
  194. UNDER WORLD LOGIC:
  195. We have to convert every sentence in the World to an interpretation (KB)
  196. - The knowledge base will entail a new fact
  197. - The new fact goes back to real world sentences
  198. - The undworld is where we work doing logic
  199. Instead of using a truth table to do gay shit we use proof
  200. PROOF
  201. ex. ax^2 + bx + c = 0 is x = (-b +/- sqrt(b^2 - 4ac))/2
  202. .. you can use algebra to show that
  203. PROOF SYSTEM:
  204. - Sound: Inference algorith is sound if it derives only entailed sentence
  205. - Complete - inference algorithm is complete if it can derive any entailed sentence
  206. INFERENCE RULE:
  207. - Natural Deduction
  208. 1) a -> b
  209. a
  210. :. b (MODUS PONENS)
  211. 2) a -> b
  212. !b
  213. :. !a (MODUS TOLENS)
  214. 3) a /\ b
  215. :. a (AND ELIMINATION)
  216. 4) a
  217. b
  218. :. a /\ b (AND INTRODUCTION)
  219. - You can prove if individual things are true (so it's sound
  220.  
  221. - RESOLUTION
  222. a \/ b
  223. !a \/ c
  224. .: b \/ c
  225.  
  226. - CONTRAINT of RESOLUTION -> All sentences in (CNF)
  227. cnf = conjunctive normal form (conjunctions of disjunctions)
  228. - CNF EX.
  229. (!A \/ B \/ C) /\ (A \/ !B) /\ (A \/ D) ----> T
  230. clause clause clause
  231. since it returns true, we know each clause is true
  232. ~~~~CONVERT TO CNF~~~
  233. 1. Eliminate <-> :: a <-> b ~~ (a->b)/\(b->a)
  234. 2. Eliminate -> :: a->b ~~ !a\/b
  235. 3. Move NOTs inward :: !(!a) ~ a || demorgans
  236. ~~~~~~AT THIS POINT WE ONLY HAVE \/ /\ !(to symbols)~~~~~~~
  237. 4. Distribute /\ over \/ :: a\/(b/\c) ~~ (a\/b)/\(a\/c)
  238. ~~~~~ DONE ~~~~~~~~ DONE ~~~~~~~~~~ DONE ~~~~~~~~~~ DONE ~~~~~~~~
  239. ex.
  240. (A \/ B) -> (C -> D)
  241.  
  242. !(A \/ B) \/ (!C \/ D)
  243.  
  244. (!A /\ !B) \/ (!C \/ D)
  245.  
  246. (!A \/ (!C \/ D)) /\ (!B \/ (!C \/ D))
  247.  
  248. (!A \/ !C \/ D) /\ (!B \/ !C \/ D)
  249. PROVING KB Entails a (RESOLUTION)
  250. KB /\ !a
  251.  
  252. ex.
  253. KB
  254. A -> B :: ~A\/B \---> B
  255. A :: A / |
  256. PROVE ~B --------CONTRADICTION
  257. B Therefore B is true
  258.  
  259. ex. GIVEN-> P\/Q , P->R. Q->R PROVE-> R
  260. 1. P\/Q
  261. 2. !P \/ Q
  262. 3. !Q \/ R
  263. 4. !R ~~~ !Q
  264. 5. Q\/R ~~~~ 1 and 2
  265. 6. P\/R ~~~~1 and 3
  266. 7. R ~~~~ 3 and 5
  267. 8. FALSE 4 7
  268. THEREFORE: R is true
  269.  
  270. ex. 1. I like one or more of 3: Paul, George, John
  271. 2. If I like Paul and not George then I also like John
  272. 3. I either like George and John or I like Neither
  273. 4. If I like George, I also like Paul
  274. Q. Do I like all 3?
  275. CONVERT IT ALL!!!!
  276. 1. (P \/ G \/ J)
  277. 2. (P/\!G) -> J
  278. 3. (G /\ J) \/ (!G /\ !J)
  279. 4. G -> P
  280. Q. (P /\ G /\ J)?
  281. CONVERT TO CNF
  282. 1. P \/ G \/ J
  283. 2. ~P \/ G \/ J
  284. 3. (J\/!G) /\ (G\/!J) *note, both must be true
  285. 4. ~G \/ P
  286. !Q. ~P\/~G\/~J
  287. ~~AND IT BEGINS~~~
  288. 5. J \/ !G 3
  289. 6. !J \/ G 3
  290. 7. G \/ J 5 6
  291. 8. !J \/ P 4 5
  292. 9. G 4 7
  293. 10. J 5 9
  294. 11. P 8 9
  295. 12. !J \/ !P !Q 9
  296. 13. ~P CONTRADICTION
  297. Q is TRUE!
  298.  
  299. RESOLUTION!!!!! when you're doing it.. try to use terms for what you're trying to contradict
  300. (ie.. Look at ex #2 above.. just start doing shit with R)
  301. FIRST ORDER LOGIC
  302. - Proposition logic limited expressiveness ..
  303. ex. I <3 John
  304. I <3 Ringo
  305. I <3 Paul
  306. I <3 George
  307. .. you have to literally list everything
  308. very unfortunate when you're using a lot of variables
  309.  
  310. ex. If an animal has feathers, then it is a bird...
  311. F -> B
  312. is a hummingbird a bird?
  313. feathers(animals) -> birds(animals)
  314. or
  315. feathers(x) -> birds(x), [For-All]x[in]ANIMALS
  316.  
  317. [There-Exists]x[in]PEOPLE [ Sibling(John,x) -> Mother(mother-of(John), x) ]
  318. analizing each thing
  319. [There-Exists] <- Quantifiers
  320. x <- var
  321. [in]PEOPLE <- universe
  322. Sibling <- Predicate (relation)
  323. John <- Literal
  324. Mother <- Predicate
  325. mother-of <- Function
  326.  
  327. - First oder logic basically just adds a predicate
  328. - Syntax:
  329. Terms and Constants (Literals): Name of a particular Object
  330. ex. John, Paul, Chair, Chair.2 etc...
  331. (usually upercalse)
  332. Variable: A placeholder that can be bound to a literal
  333. ex. a, x , y , z, etc.
  334. Function: Another way to name an object
  335. ex. left-Leg(John) ... John's left leg
  336. left-leg(mother-of(x)) .. someone's mother's left hand
  337. Sentence:
  338. Atomic Sentence: Predicates and Equality
  339. ex. Bird(x)
  340. NatNum(10)
  341. Above(x,b)
  342. (Predicates)
  343. ex. mother-of(John) = mother-of(sister-of(John)
  344. (EQuality)
  345. Complex Sentence: Quantifier and Operators
  346. Quantifiers: [For All], [There Exists] w/ Sentence
  347. Operators: phi \/ psy
  348. ph /\ psy .. you see wher this is going... phi and psy are sentences
  349.  
  350. EX:
  351. John is a smart student
  352. Student(John) /\ Smart(John)
  353. EX:
  354. Cats are animals
  355. [For-All)x[in]UNIVERSE, Cat(x) -> Animal(x)
  356. EX:
  357. One's mother is one's female parent
  358. [For-All]x,m[in]PEOPLE, mother-of(x)=m <-> parent(m,x) /\ female(m)
  359. EX:
  360. Sibling is another child of one's parent
  361. [For-All]x,y[in]PEOPLE, Sibling(x,y) <-> x !=y /\ [There exists]p(Parent(P,x) /\ Parent(P,y))
  362. EX:
  363. Everyone loves somebody
  364. [For-All]x[There-Exists]y Loves(x,y)
  365. Ex.
  366. Nobody Loves John
  367. [ForAll]x(!(Loves(x,John)))
  368. or
  369. ![There-Exists]x(Loves(x,John))
  370. EX.
  371. Whoever has a father has a mother
  372. [For-All]z[There-Exists]x,y Father(x,z) /\ Mother(y,z)
  373. - Interpretation:
  374. ex. "All Cars are not created equal" <-- is this true?
  375. [For-All]c !(sameQual(c)) <-- no, some cars are exactly the same.. ergo, created equal
  376. "Not all cars are created equal" <- this is true
  377. !([For-All]c sameQual(c))
  378. For good interpreations.. we need......
  379. 1. UNIVERSE: Set of objects
  380. 2. CONSTANT: Literal, represents an object in the Universe, (ie. giving a name to an object)
  381. 3. VARIABLE: represents nothing on its own in universe.. but it can be bound to anything in universe
  382. 4. PREDICATE: Relation, a truth value
  383. 5. EQUALITY: self explanitory
  384. 6. QUANTIFIERS: Binds a variable to object in Universe ([There-Exists],[For-All])
  385. PROOF BY RESOLUTION FEFUTATION
  386. * In 1st order logic: Clausal Form
  387. also called prenex normal for, conjuctions of dijunctions no quantifiers
  388.  
  389. CONVERTING propositional into CNF
  390. 1. Eliminate <->
  391. 2. Eliminate ->
  392. 3. Move ~ inwards
  393. note: Careful about quantifiers with the ~
  394. ~[For All] --> [ThereExisists] ~
  395. 4. Rename variables to avoid using same variables for different qualifiers
  396. ex. [ForAll x] P(x) \/ [ThereExists x] Q(x)
  397. ---> [ForAll x] P(x) \/ [ThereExists y] Q(y)
  398. 5. Skolemization (remove [ThereExists])
  399. ex. [ThereExists y] Loves(John, y)
  400. ---> Loves(John, Mary)
  401. ex. [ForAll x][ThereExists y] Loves(x, y)
  402. ---> [ForAll x] Loves(x, Raymond) ... Wait this changes the meaning...
  403. SO INSTEAD
  404. ---> [ForAll x] Loves(x, F(x)) where F=Loved
  405. janky.. but same meaning :)
  406. If [ThereExists] stands alone, you can just slap in a literal.. if not..
  407. (inside [forAll]) you need a function
  408. 6. At this point, All variables are quantified by [forAll] and vars are all different
  409. ex. ([ForAll x] P(x)) \/ ([ForAll y] Q(y)) \/ ([ForAll z] R(z))
  410. ---> [ForAll x][ForAll y][ForAll z](P(x) \/ Q(y) \/ R(z))
  411. ---> [ForAll x,y,z](P(x) \/ Q(y) \/ R(z))
  412. DROP UNIVERSAL QUANTIFIERS!!! pretty much implied here
  413. 7. Distribute \/ over /\
  414. ex. Everyone who loves all animals is loved by someone
  415. [step 0] [ForAll x] (([ForAll y] Animals(y) -> Loves(x,y)) -> ([ThereExists y] Loves(y,x)))
  416. [step 1/2] [ForAll x] (([ForAll y] ~Animals(y) \/ Loves(x,y)) -> ([ThereExists y] Loves(y,x)))
  417. [step 3] [ForAll x] (~([ForAll y] ~Animals(y) \/ Loves(x,y)) \/ ([ThereExists y] Loves(y,x)))
  418. [step 3] [ForAll x] (([ThereExists y] Animals(y) /\ ~Loves(x,y)) \/ ([ThereExists y] Loves(y,x)))
  419. [step 4] [ForAll x] (([ThereExists y] Animals(y) /\ ~Loves(x,y)) \/ ([ThereExists z] Loves(z, x)))
  420. [step 5] [ForAll x] ((Animals(F(x)) /\ ~Loves(x, F(x))) \/ Loves(G(x), x))
  421. [step 6] (Animals(F(x)) /\ ~Loves(x,F(x))) \/ Loves(G(x), x)
  422. [step 7] (Animals(F(x) \/ Loves(G(x), x) /\ (~Loves(x,F(x)) \/ Loves(G(x),x))
  423. Synatically corrected after dropped quantifiers.. since you're assuming it exists.. not needed to represent
  424.  
  425. Then.. we can slap it in a proof
  426. PROOF BY RESOLUTION REFUTATION
  427. - KB => Everything to PNF
  428. - Q => ~Q
  429. - Apply Resolution until contradiction
  430.  
  431. EXAMPLE:
  432. 1. Everyone Who Loves All Animals is Loved by Someone
  433. 2. Anyone who kills an animal is loved by no one
  434. 3. Jack Loves all animals
  435. 4. Either Jack or Vuriosity Killed the Cat, Whos name is tuna
  436. 5. All Cats are Animals
  437. Q. Curiosity killed cat
  438.  
  439. 1. [ForAll x] (([ForAll y] Animal(y) -> Loves(x,y)) -> ([ThereExists y] Loves (y,x)))
  440. 2. [ForAll x] (([ThereExists y]Animal(y) /\ kill(x,y)) -> ([ForAll y] ~Loves(y,x)))
  441. 3. [ForAll x] (Animal(x) -> Loves(Jack, x))
  442. 4. Kills(Jack,Tuna) \/ Kills(Curiosity, Tuna) where Cat(tuna)
  443. 5. [ForAll x] Cat(x) -> animal(x)
  444. Q. Kills(Curiosity, Tuna)
  445.  
  446. [note: 1 and 2 are the same statement. it's just joined by an /\ so it can be separated]
  447. 1. ((Animals(F(x)) \/ Loves(G(x), x))
  448. 2. (~Loves(x, F(x)) \/ Loves(G(x),x)))
  449. 3. ~Animal(y) \/ ~Kills(x,y) \/ ~Loves(z,x)
  450. 4. ~Animal(x) \/ Loves(Jack, x)
  451. 5. Kills(Jack, Tuna) \/ Kills(Curiosity, Tuna)
  452. 6. Cat(tuna)
  453. 7. ~Cat(x) \/ Animal(x)
  454. Q. Kills(Curiosity, Tuna)
  455. 8. ~Kills(Curiosity, Tuna)
  456. 9. kills(Jack, Tuna) *5 and 8*
  457. 10. Animal(Tuna) *6 and 7*
  458. 11. Loves(Jack, Tuna) *4 and 10*
  459. 12. Loves(G(Jack), Jack) *2 and 11... 2: x = Jack, F(x) = Tuna)
  460. 13. ~Animal(y) \/ ~Kills(Tuna, y) *3 and 11 ... z = jack, x = tuna*
  461. 14. ~Animal(Tuna) \/ ~Loves(z, Jack) *3 and 9 .. x=Jack, y = Tuna*
  462. 15. ~Loves(z,Jack) *10 and 14*
  463. 16 FALSE *12 15* .. Therefore curosity killed the cat
  464.  
  465.  
  466.  
  467. SKOLEMIZATION
  468. - ues to remove [There Exists]
  469. - Substitute a new name of each existentially quantiied variable
  470. ex. [ThereExists] P(x) --> P(Fred)
  471. - Basically giving an X a name
  472. ex. [ThereExists x][ThereExists y] P(x,y)
  473. ---> P(Fred, Mary) .. can't do P(Fred, Fred)
  474. *Because x and y are different
  475. ex.
  476. [ThereExists x] P(x) /\ Q(x) => P(Fred) /\ Q(Fred)
  477. ex.
  478. [ThereExists y][ForAll x]Loves(x,y) => [ForAll x]Loves(x, Raymond)
  479. this is ot the same if Forall and ThereExists are flipped...
  480. but
  481. [ForAll x][ThereExists y] Loves(x,y) --> [ForAll x]Loves(x. lovedby(x))
  482.  
  483. EXAMPLE:
  484.  
  485. [ForAll x] ( [thereExists] R(x,y) /\ [ForAll y] -> ([ThereExists y] R(x,y) /\ P))
  486. 1. <-> *done*
  487. 2. -> === [ForAll x] (~([ThereExists y]R(x,y) /\ [ForAll y] ~S(x,y)) \/ ~([ThereExistsx y] R(x,y) /\ p))
  488. 3. ~ === [ForAll x](([ForAll y] ~R(x,y) \/ [ThereExists y] S(x,y)) \/ ([ForAll y] ~R(x,y) \/ ~P))
  489. 4. rename vars - [ForAll x](([ForAll y] ~R(x,y) \/ [ThereExists w] S(x,w)) \/ ([ForAll z] ~R(x,z) \/ ~P)
  490. 5. remove [ThereExists]
  491. [ForAll x] ( [ForAll y] ~R(x,y) \/ S(x, Q(x)) \/ [ForAll z] ~R(x,y) \/ ~P)
  492. 6. move for all to front and remove
  493. ~R(x,y) \/ S(s,Q(x)) \/ ~R(x,z) \/ ~P
  494. DONE!
  495.  
  496. UNIFICATION
  497. : Process to compute the substitution that makes two sentense to resolve
  498. * UNIFIERS: list of substiutions
  499. ex. Knows(John, x)
  500. Knows(John, Mary)
  501. if x represents Mary.. these sentences are the same.. process of finding it is unification
  502.  
  503. ex.
  504. Knows(John, x)
  505. Knows(y, Bill)
  506. UNIFIERS: x = bill , y = John
  507. therefore, same sentence
  508.  
  509. ex.
  510. Knows(John, x)
  511. Knows(x, Bill) .... can this be unified?
  512. no.. you can't do that
  513. ex. ~Knows(John, x) \/ Hates(John, x)
  514. Knows(John, Jim)
  515. x = Jim .. : Hates(John, Jim)
  516.  
  517. ex. Knows (John, x)
  518. knows(y, z)
  519. y = john, x = z <---------- while all are valid.. this is best choice "Most General Unifier"
  520. or
  521. y = john, x = john, z = john
  522. or
  523. y = john, x = mary, z = mary
  524. *abunch are possible here*
  525.  
  526. EX. Resolution shit
  527. 1 ~P(w) \/ Q(w)
  528. 2 ~Q(y) \/ S(y)
  529. 3 P(x) \/ R(x)
  530. 4 ~R(z) \/ S(z)
  531. 5 Q: ~S(A) <----------------------- Actually S(A) .. bu you know.. resolution
  532. 6 unify: z = A .. ~R(A) (4 and 5)
  533. 7.unify y = A .. ~Q(A) (2 and 5)
  534. 8.unify w = A .. ~P(A) (1 and 7)
  535. 9.unify x = A .. R(A) (3 and 8)
  536. 10. FAIL: 6 and 9 .. unified w = a
  537. 11. Therefore, S(A) = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement