Download presentation

Presentation is loading. Please wait.

Published bySadie Pingrey Modified over 2 years ago

1
1 FOL CS 331/531 Dr M M Awais Composition Find Overall Substitutions Given two or more sets of substitutions

2
2 FOL CS 331/531 Dr M M Awais Composition Domain: Variables in the substitution together form the domain (denominators) S1={a/X1, b/X2, …z/Xn} Then Dom(S1)={X1, X2, …Xn} St={a/B} B is the domain or Dom(S1) Replacements: Terms are the replacements (numerators) Rep(S1)={a,b,…z} St={a/B}a is the replacement or Rep(St)

3
3 FOL CS 331/531 Dr M M Awais Composition Rule Two subtitutions S1 and S2 can compose in two ways: S1 composed with S2S12 or S1.S2 S2 composed with S1S21 or S2.S1 S12 is obtained by applying S2 to S1 Adding S2 to the set obtained in step 1 Removing substitutions from S2 that have Dom(S2)=Dom(S1)

4
4 FOL CS 331/531 Dr M M Awais Step 1: Applying S2 to S1 Finding Dom(S2) Finding Rep(S1) If elements of Dom(S2) = elements of Rep(S1) S2 applies to S1 otherwise does not. Example: S1={W/A,e/D}, S2={s/W,g/K} Dom(S2)={W, K}, Rep(S1)={W,e}, W matches hence W/A & s/W generate s/A Hence the new set obtained after applying S2 to S1 is: S12={s/A,e/D}

5
5 FOL CS 331/531 Dr M M Awais Step 2&3: Add+Drop Add S2 to S12={s/A,e/D} S12={s/A,e/D, s/W,g/K} Drop any where Dom(S2)=Dom(S12) from substitutions of S2 Nothing gets dropped Final Answer: S12={s/A,e/D, s/W,g/K}

6
6 FOL CS 331/531 Dr M M Awais Composition S1={A/D} S2={D/X} D is in the domain in S1, and replacement in S2 A is the replacement in S1 X is the domain in S2 S1 can be applied to S2, as the domain of S1(D) is the replacement in S2. Hence S2 modifies as {A/X} S2 cannot be applied to S1, as the domain of S2 is not a replacement in S1, S1 remains{A/D}

7
7 FOL CS 331/531 Dr M M Awais Composition S1={A/K} replacements=A, domain=K S2={a/A} replacements=a, domain=A Apply S1 to S2 Cannot be applied as K is not a replacement in S2.{a/A} Non Composable Apply S2 t S1 Can be applied, as A is a replacement in S1, {a/K} Composable

8
8 FOL CS 331/531 Dr M M Awais Composition S1={A/K,f/M} replacements=A,f domain=K,M S2={a/A,j/R} replacements=a,j domain=A,R Apply S1 to S2 A/K Cannot be applied as K is not a replacement in S2. F/M Cannot be applied as M is not a replacement in S2 {a/A,j/R} Non Composable Apply S2 t S1 a/A can be applied, as A is a replacement in S1, {a/K} J/R cannot be applied as R is not a replacement in S1 {a/K, f/M} Composable

9
9 FOL CS 331/531 Dr M M Awais Example S1={A/K} S2={a/A, H/J} S12={a/K, a/A,H/J} Algorithm 1. Apply S2 to S1 (find overall substitution) and generate a modified S1 2. Add to the answer in Step 1 all the substitutions of S2 (combined +uncombined) 3. Drop all substitutions in S2 which have common denominators with S12

10
10 FOL CS 331/531 Dr M M Awais Example: S12 S1={A/K} S2={a/A, H/J} Algorithm for S12: Apply S2 to S1 See if A and J are present among the replacements of S1 if Yes replace A with a and J with H This would generate {a/K} Add S2 to S1 (Modified S1 in step 1+ all of S2) Modified S1={a/K} + {a/A,H/J} Drop all substitutions in S2 which have common denominators with S1 nothing gets dropped, hence the answer is S12={a/K,a/A,H/J}

11
11 FOL CS 331/531 Dr M M Awais Example: S21 S1={A/K} S2={a/A, H/J} Algorithm for S21: Apply S1 to S2 See if K is present among the replacements of S2 if Yes replace K with A (no change in S2) This would generate {a/A, H/J} Add S1 to S2 (Modified S2 in step 1+ all of S1) Modified S1={a/A,H/J}+{A/K} Drop all substitutions in S1 which have common denominators with S2 nothing gets dropped, hence the answer is S12={a/A,H/J,A/K}

12
12 FOL CS 331/531 Dr M M Awais Example S1={D/A} S2={a/D} S12 Step 1: Combining (S2 to S1)S12={a/A} Step 2:Addition (Add S2)S12={a/A}+{a/D} Step 3: DropS12={a/A,a/D} S1={D/A,S/G,n/N} S2={x/X, f/D, q/S,w/A} S12 Step 1:CombiningS12={f/A,q/G,n/N} Step 2:Addition S12={f/A,q/G,n/N}+{x/X, f/D, q/S,w/A} Step 3: DropS12={f/A,q/G,n/N,x/X,f/D,q/S}

13
13 FOL CS 331/531 Dr M M Awais Is S12 same as S21 S1={D/A} S2={a/D} S21 Step 1: Combine (S1 to S2)S2={a/D} Combination cannot possible because no A is present in S2, so cannot replace with D, output is same as S2 Step 2: AddS21={a/D}+{D/A} Step 3: DropS21={a/D,D/A} S1={D/A,S/G,n/N} S2={x/X, f/D, q/S,w/A} S21 Step 1: CombineS2={ x/X, f/D, q/S,w/A } Step 2: AddS2={ x/X, f/D, q/S,w/A }+{D/A,S/G,n/N} Step 3: DropS21={ x/X, f/D, q/S,w/A, S/G,n/N}

14
14 FOL CS 331/531 Dr M M Awais Is S12 same as S21 S1={D/A} S2={X/A} S12={D/A} Combine:S12={D/A} Add:S12={D/A}+{X/A} Drop:S12={D/A} X/A gets dropped S21={X/A} Combine:S21={X/A} Add:S21={X/A}+{D/A} Drop:S21={X/A} D/A gets dropped

15
15 FOL CS 331/531 Dr M M Awais Example S1={D/A, d/F,S/E} S2={g/D} S12={g/A, d/F, S/E, g/D} S12={g/A, d/F, S/E, g/D} (nothing gets dropped) S21={g/D, D/A, d/F, S/E} S21={g/D, D/A,d/F,S/E} (nothing gets dropped)

16
16 FOL CS 331/531 Dr M M Awais Example S1={a/A,b/B,c/C} S2={A/X,B/Y,S/Q} S12={a/A,b/B,c/C} + {A/X,B/Y,S/Q} S12={a/A, b/B, c/C, A/X, B/Y, S/Q} S21= {a/X, b/Y, S/Q} + {a/A,b/B,c/C} S21={a/X, b/Y, S/Q, a/A, b/B, c/C}

17
17 FOL CS 331/531 Dr M M Awais Substitution: Discussion Domain: Variables in the substitution together form the domain (denominators) Replacements: Terms are the replacements (numerators) Pure Vs Impure Substitutions: A pure substitution is if all replacements are free of the variables in the domain of the substitution. Otherwise impure {s/X, t/I, j/G} (pure) The composition of pure substitutions may be impure and vice versa Composability: A substitution S1 and S2 are composable if and only if the variables in the domain of S1 do not appear among the replacements of S2, otherwise they are noncomposable. S1={U/X} S2={d/U}composable S1={U/X} S2={X/G}noncomposable

18
18 FOL CS 331/531 Dr M M Awais Application Example Knowledge base: knows(ali,sana) knows(X,shahid)knows(X,Y) We also know knows(ali,X) hates(ali,X) Unify the conditions to find ali hates whom unify(knows(ali,X), knows(ali,sana)) = {sana/X} Using the binding and the rule: ali hates sana unify(knows(ali,X), knows(X,shahid)) = {ali/X,shahid/X} This would fail as X cannot have two values at the same time As the composition of {ali/X} with {shahid/X} or vice versa will result in only one valid substitution unify(knows(ali,X), knows(X,Y)) = {ali/X,X/Y} This would mean that ali knows everyone including himself, therefore hates everyone.

Similar presentations

Presentation is loading. Please wait....

OK

Fractions.

Fractions.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on regional transport office kerala Ppt on metals used in construction Ppt on domain name server Ppt on various types of web browsers and their comparative features Ppt online viewer for pdf Ppt on tsunami in india Ppt on column chromatography applications Ppt on rc phase shift oscillator Ppt on food chains and webs Ppt on mechanical engineering drawing