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

Slides:



Advertisements
Similar presentations
Simplify Warm-up. Compare and Contrast Notes - Adding and Subtracting with LIKE Denominators When you are adding or subtracting rational expressions….
Advertisements

FUNCTIONS – Composite Functions RULES :. FUNCTIONS – Composite Functions RULES : Read as f at g of x.
Combining Like Terms.
COMPOSITION OF FUNCTIONS “SUBSTITUTING ONE FUNCTION INTO ANOTHER”
Inference Rules Universal Instantiation Existential Generalization
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
Standard Logical Equivalences
Resolution.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Closure Properties of CFL's
Operations on Functions
SECTION 21.5 Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
Fall 2004COMP 3351 Simplifications of Context-Free Grammars.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Chapter 6 Section 3 Adding and Subtracting of Rational Expressions with a Common Denominator 1.
Copyright © Cengage Learning. All rights reserved.
Adding and Subtracting Fractions
Adding and Subtracting Fractions with Like Denominators.
SECTIONS 21.4 – 21.5 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
1 FOL CS 331/531 Dr M M Awais Composition Find Overall Substitutions Given two or more sets of substitutions.
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2011 Hawkes Learning Systems. All rights reserved. Hawkes Learning Systems: College Algebra.
Chapter 1 Equations, Inequalities, and Mathematical Models 1.4 Complex Numbers.
Composite Functions Example 1:Given functions f(x) = x 2 – 3x and g(x) = 2x + 1, find f  g. The notation "f  g" means f (g(x)). In other words, replace.
Solving Systems of Linear Equations
MATRICES AND DETERMINANTS
Lecture 21: Languages and Grammars. Natural Language vs. Formal Language.
Fractions.
EXPONENTS. EXPONENTIAL NOTATION X IS THE BASE 2 IS THE EXPONENT OR POWER.
Fractions, Decimals and Percents
Rational Expressions.
RATIONAL EXPRESSIONS. Definition of a Rational Expression A rational number is defined as the ratio of two integers, where q ≠ 0 Examples of rational.
Addition of Polynomials Two terms are considered like terms if they: 1) are both constants, or 2) have the same variables with the same exponents on corresponding.
& dding ubtracting ractions.
Algebraic Fractions  Know your rules  Anything raised to the 0 power = 1  Negative exponents can be moved to the opposite and made positive (that is,
Multiplying and Dividing Radicals The product and quotient properties of square roots can be used to multiply and divide radicals, because: and. Example.
Elimination Method: Solve the linear system. -8x + 3y=12 8x - 9y=12.
Composition in Modeling Macromolecular Regulatory Networks Ranjit Randhawa September 9th 2007.
 Recall that when you wanted to solve a system of equations, you used to use two different methods.  Substitution Method  Addition Method.
October 31 st copyright2009merrydavidson. Simplifying Rational Expressions What is the difference between a factor and a term? TERMS are separated by.
ELIMINATION on a 3x3 1. Line up equations. 2. Perform “elimination” TWICE on the SAME variable using two DIFFERENT pairs of equations. 3. With the 2 equations.
Finding the LCM Rule 6 ‑ 1: To find the lowest common multiple of numbers containing literal numbers: 1. factor each term; 2. determine the maximum number.
Functions and relations
1-2B Order of Operations Algebra 1 Glencoe McGraw-Hill Linda Stamper.
Rational Expressions and Functions: Adding and Subtracting
1.7 Combinations of Functions; Composite Functions
Simplifications of Context-Free Grammars
Functions and relations
Section 9.7 Complex Numbers.
Adding and Subtracting Fractions
Add Subtract Positive Negative integers
Simultaneous Equations
Fractions 1/8 55/60 11/12 1 2/10 1 ½ 1/12.
TE2: Combining Like Terms
Algebra
Functions and Their Graphs
Heuristic Minimization of Two Level Circuits
L-1 6.NS.3.
Operations on Functions
Fractions VI Adding Like Denominators
Operations on Functions
Linear Word problems.
Fractions: Adding Like Denominators
Operations on Functions
Fractions VII Adding Like Denominators
7.6 Function Operations.
Operations on Functions
Integration Techniques
Add and Subtract Positive & Negative Integers
Presentation transcript:

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

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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.