Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS6905 Advanced Technologies for e-Business May 1 – July

Similar presentations


Presentation on theme: "CS6905 Advanced Technologies for e-Business May 1 – July"— Presentation transcript:

1 CS6905 Advanced Technologies for e-Business May 1 – July 31 2003
Segment 1 Bruce Spencer May 1 – May

2 Reasoning Systems for e-Business
INTRO Course Overview NRC e-Business Application Groups e-Health (Saint John) e-Government (Fredericton) e-Learning (Moncton) Technology Groups Human Web (Fredericton) Internet Logic (Fredericton) reasoning systems for e-business (on the web) Reasoning Systems for e-Business 9/16/2018

3 Internet logic: meeting needs of e-business applications
INTRO Internet logic: meeting needs of e-business applications privacy, security, trust Does this transaction meet with user’s intentions, espressed as rules semantic processing of web data natural language, data bases, web logs market modelling maximizing utilities for buying and selling diagnosis fixing faults, comparing to models of what should happen qualitative reasoning models of what should happen are described abstractly collaborative filtering, data mining information from data Reasoning Systems for e-Business 9/16/2018

4 Specific Project: NBON
INTRO Specific Project: NBON online tendering for purchasing by gov’ts, schools, hospitials universities purchasing agent assigns GSIN codes to items to be purchased, from among 16K codes in hierarchy each vendor (private business) codes self according to what is for sale NBON system: if two items on the same branch of hierarchy, send an notification to vendor NB is only place this is done in Canada (world?) Problem: too much coding too high (not precise enough) inaccurate coding Reasoning Systems for e-Business 9/16/2018

5 Reasoning Systems for e-Business
9/16/2018

6 Reasoning Systems for e-Business
INTRO Reasoning Systems for e-Business 9/16/2018

7 Technologies that can help
INTRO Technologies that can help Natural Language Processing mapping NL descriptions of items to the codes is hard for most people to do; experts hired by NBON Bayes network of conditional probabilities P(code | word). For a given code, combine all of the prob’ties over words Report codes with highest prob’ties Uses years of previous codes assigned to tenders OLAP How many furniture purchases by municipalities in southeast NB municipalities cost in range $ in 2002? In constant time? Reasoning Systems for e-Business 9/16/2018

8 Reasoning Systems for e-Business
INTRO Diagnostics a machine that takes tender description and vendor description and generates a yes/no to the question should this tender be sent to this vendor? False positives too much , system becomes ineffective False negative missed tendering opportunity, company dies Fix the machine so that neither fault occurs Reasoning Systems for e-Business 9/16/2018

9 Logic, Policies and eBusiness
INTRO Logic, Policies and eBusiness Policies govern any eBusiness transaction privacy policies pricing policies eligibilities access control Logic and proofs logic for expressing policies exact correspondence with desired states of the world convincing proofs that policies were adopted Reasoning Systems for e-Business 9/16/2018

10 Reasoning Systems for e-Business
INTRO Policies and Rules An elite customer can get 5% discount on decent or better cars if his payment type is “silver”. discount(V0,V1,' 5%percent' ) eliteCustomer(V0), decentCarOrAbove(V1), paymentType(silver). “Silver” payment type is pay by 2 year installments with financial assistance of less than $10000. paymentType(silver)  payBy(2yearInstallment), financialAssistance(lessThan$10000). “Silver” payment type is pay by 3 year less than $7000. paymentType(silver)  payBy(3yearInstallment), financialAssistance(lessThan$7000). “Silver” payment type is pay by 5 year installments without financial assistance. paymentType(silver)  payBy(5yearInstallment), financialAssistance($0). Reasoning Systems for e-Business 9/16/2018

11 Interactive system for negotiating policy
INTRO Interactive system for negotiating policy Reasoning Systems for e-Business 9/16/2018

12 Reasoning Systems for e-Business
Overview Lectures for Segment 1 1 Intro to logic Syntax Semantics Web-ized Logic 2 More logic Logical Consequences Inference Rules Proofs Soundness and Completeness 3 Logic for the Web Well Founded Semantics Description Logic Efficiency vs. Expressiveness Reasoning Systems for e-Business 9/16/2018

13 Lectures for Segment 1 (cont`d)
Overview Lectures for Segment 1 (cont`d) 4 Ontologies and the Semantic Web 5 Rules for e-Commerce 6 Rules for Privacy 7 Discrimination Trees and Indexing 8 Inference Queue Reasoning Systems for e-Business 9/16/2018

14 Reasoning Systems for e-Business
Example Suppose Prof Phil teaches at the university and has two students, a boy Bob and girl Gail. Bob likes Gail but we are not sure whether Gail likes Bob. We know that each person has one best friend, and always likes that friend. Also if one person likes another, then it is always mutual. Reasoning Systems for e-Business 9/16/2018

15 Reasoning Systems for e-Business
Intro to Logic Intro to Logic: Syntax Given: V, CS, FS, PS, connectives, quantifiers Variables: x, y, z, u, v, w, x1, y1, … Constant Symbols: a, b, c, d, e, a1, b1, … Function Symbols: f, g, h, f1, g1, … Predicate Symbols: P, Q, R, P1, Q1, … , ,, ,  Function Symbols and Predicate Symbols have arities FSi is the set of functions symbols with arity i PSi is the set of functions symbols with arity i FS is the union of all FSi PS is the union of all PSi Reasoning Systems for e-Business 9/16/2018

16 Reasoning Systems for e-Business
Intro to Logic Exercise Think of reasonable constant symbols, function symbols and predicate symbols for the example. Reasoning Systems for e-Business 9/16/2018

17 Reasoning Systems for e-Business
Definitions: Terms The set T of terms is defined inductively: V  T (variables are terms) CS  T (constants are terms) If t1,…,tnT and f FSn then f(t1,…,tn) T. Terms from (3) are called functional terms, ti are called the arguments. A term s occurs in t if s=t, or s occurs in an argument of t. V(t) denotes the set of variables occurring in a term t. If V(t) =  then t is ground. FS(t) is the set of all function symbols occurring in t. FSn(t) is the set of all function symbols of arity n occurring in t. PS(t) and PSn(t) are similarly defined. Reasoning Systems for e-Business 9/16/2018

18 Reasoning Systems for e-Business
Exercise Think of reasonable constant symbols, function symbols and predicate symbols for the example. What are their arities? Write terms for the best friend of the Gail, for the best friend of the best friend of Phil. What other terms occur in your terms? Give some examples with non-empty sets of variables. Reasoning Systems for e-Business 9/16/2018

19 Definitions: Formulas
Intro to Logic Definitions: Formulas If t1,…,tnT and PPSn then P(t1,…,tn) is an atom formula or atom. P is called the leading symbol and the ti are called the arguments. If A is an atom formula, A and A are called literals. AT is the set of all atoms. LIT is the set of all literals. The set of all predicate logic formulas PL is defined inductively: LIT  PL (literals are in PL) If A,B  PL then (AB), (AB), (AB)  PL. If A PL and x  V and neither (x) nor (x) occurs in A then (x) A and ( x) A  PL. Reasoning Systems for e-Business 9/16/2018

20 Reasoning Systems for e-Business
Exercise Write some atoms, some literals and some formulas using the symbols from the previous exercise. Reasoning Systems for e-Business 9/16/2018

21 Reasoning Systems for e-Business
Intro to Logic Interpretations An interpretation of a formula F in PL is a pair  =(D,) with the following properties. D is a non-empty set called the domain.  is a mapping on PS(F)  FS(F)  CS(F) For c  CS(F)  (c) D For f  FSn(F)  (f) is a function of type Dn  D For P  FSn(F)  (P) is a function of type Dn  {T,F}. (That is, P is an n-ary predicate.) Reasoning Systems for e-Business 9/16/2018

22 Reasoning Systems for e-Business
Exercise Give an explicit interpretation for this example. Can there be more than three people in the domain of your interpretation? Reasoning Systems for e-Business 9/16/2018

23 Evaluation of a formula
Intro to Logic Evaluation of a formula Let  =(D,) be an interpretation of a formula F. We assume that F has no free variables. The evaluation function v is a function of type PL(F)  {T,F} defined inductively as follows: If A = P(t1,…,tn) then v(A) = (P)(v(t1),…,v(tn)) v(AB) = and(v(A),v(B)) v(AB) = or(v(A),v(B)) v(A  B) = imp(v(A),v(B)) v( A) = not(v(A)) v( (x) A ) = T iff v( A’ ) = T where A’ is A where the value chosen for x is d, for all values d  D v( (x) A ) = T iff v( A’ ) = T where A’ is A where the value chosen for x is d, for some value d  D where and, or, imp and not have the usual meanings. Reasoning Systems for e-Business 9/16/2018

24 Definitions: Verifies, Falsifies, Model
An interpretation  of a formula A verifies A if v(A) = T. Then we say that  is a model of A.  falsifies A if v(A) = F. A formula A is satisfiable if it has a model. A is valid if every interpretation is a model. Two formulas are logically equivalent of they have the same models. They are satisfiably equivalent if one is satisfiable iff the other is. Reasoning Systems for e-Business 9/16/2018

25 Reasoning Systems for e-Business
Exercises Give a formula that characterizes the situation described. Give a model of those formulas. Describe a situation that would be a non model for the formula you gave. Give a formula that is a conjunction of subformulas, for which the described situation is a model. Select each of these conjuncts in turn and give an interpretation that falsifies the selected conjunct but not any of the others. Give an example of a valid formula. Remember, the formula describes the situation, but the situation models (is a model of) the formula. Reasoning Systems for e-Business 9/16/2018

26 Reasoning Systems for e-Business
Intro to Logic Hint Male(bob)  Male(phil)  Female(gail)  Teaches(phil, bob)  Teaches(phil, gail)  Likes(bob, gail)  (z) (Likes(z, bestFriendOf(z))  (x) (y) (¬Likes(x,y)  Likes(y,x)) Reasoning Systems for e-Business 9/16/2018

27 Reasoning Systems for e-Business
Intro to Logic “Web-ized” logic Consider a variant of PL in which all constant symbols are Uniform Resource Indexes, consisting of a host and domain name and path from the root of the web directory of the host. Thus it defines the current world-wide-web. Could function and relation symbols also be URI’s? Could constant, function and relation symbols also refer to files, i.e. could they be URL’s? What would they reasonably point to? Reasoning Systems for e-Business 9/16/2018

28 Reasoning Systems for e-Business
Intro to Logic Clausal formulas Definition: A clause is defined inductively:  is a clause. Literals are clauses. If C and D are clauses then C D are clauses. In clause notation, there are no quantifiers. We assume that all variables are quantified with . We remove the restriction that variables must be unique. There is a mechanical means of computing a set of clauses that is satisfiably equivalent to a given formula. A clause with at most one positive literal is called a Horn clause. Reasoning Systems for e-Business 9/16/2018

29 Reasoning Systems for e-Business
Intro to Logic Exercise How important are Horn clauses? Are all of your formulas for the previous exercises convertible to Horn clauses? Describe a situation modeling a non-Horn clause. Reasoning Systems for e-Business 9/16/2018

30 Reasoning Systems for e-Business
Intro to Logic IF – THEN Clauses A definite clause is a non-negative Horn clause. Thus it has exactly one positive literal. Given a definite clause, let COND refer to the collection of atoms from the negative literals, if any, and CONCL refer to the positive literal. COND  CONCL is a logically equivalent formula, said to be in rule form. Example: ¬Likes(x,y)  ¬Likes(y,z)  Likes(x,z) COND = {Likes(x,y), Likes(y,z) } Rule form: Likes(x,y)  Likes(y,z) Likes(x,z) Reasoning Systems for e-Business 9/16/2018

31 Reasoning Systems for e-Business
Intro to Logic Exercise Show that a definite clause is logically equivalent to its rule form. Reasoning Systems for e-Business 9/16/2018

32 RuleML: Web-ized, rules and XML
Intro to Logic RuleML: Web-ized, rules and XML ''The discount for a customer buying a product is 5.0 percent if the customer is premium and the product is regular <imp> <_head> <atom> <_opr><rel>discount</rel></_opr> <var>customer</var> <var>product</var> <ind>5.0 percent</ind> </atom> </_head> <_body> <and> <_opr><rel>premium</rel></_opr> <_opr><rel>regular</rel></_opr> </and> </_body> </imp> Reasoning Systems for e-Business 9/16/2018

33 The Module Hierarchy of RuleML DTDs
Intro to Logic The Module Hierarchy of RuleML DTDs ruleml ur-equalog Rooted DAG will be extended with branches for further sublanguages equalog ur-hornlog hornlog ur-datalog ur-datalog = join(ur,datalog) datalog ur urc-datalog bin-datalog URL/URI-like ‘ur’-objects urc-bin-datalog urc-bin-data-ground-log urc-bin-data-ground-fact RDF-like triples Reasoning Systems for e-Business 9/16/2018

34 Reasoning Systems for e-Business
More Logic Logical Consequences We sometimes want to know what is true in all models. 1 2 1.999… =  2 Likes(bob, gail) Likes(gail, bob) Likes(x,y) Likes(y,x)  n Reasoning Systems for e-Business 9/16/2018

35 Definition of Logical Consequence
Given formulas F and G, such that for every model  of F,  verifies G. Then G is a logical consequence of F. We write F  G and we say that F entails G. models of G models of F Reasoning Systems for e-Business 9/16/2018

36 Reasoning Systems for e-Business
Rules of Inference A rule of inference constructs a new formula G from a given (set of) formulas F. We write F  G Example: from A and AB infer B Properties Soundness: Rule does not lie. F  G implies F = G Completeness: Rule tells whole truth. F  = G implies F  G Completeness when G is an atom may be all you want. Reasoning Systems for e-Business 9/16/2018

37 Rule of Inference for Definite Clauses
Rule of inference for definite clauses (one positive literal) From C1,…,Cm  Ai and A1,…, AnB infer A1,…, Ai-1,C1,…,Cm, Ai+1,…,An B Sound? Yes. Consider an arbitrary model  of both C1,…,Cm  Ai and A1,…, AnB. Ai is either true or false in . If Ai true in , then A1,…, Ai-1, Ai+1,…,An B is also true in  and hence so is A1,…, Ai-1,C1,…,Cm, Ai+1,…,An B. If Ai false in  then one of C1,…,Cm is also false in  so A1,…, Ai-1,C1,…,Cm, Ai+1,…,An B is true in . Complete? No. Can never infer AB from A. Is it complete for inferring definite clauses? for inferring atoms? Reasoning Systems for e-Business 9/16/2018

38 Reasoning Systems for e-Business
With variables Want to infer Likes(bob, gail) from Likes(x,y) Likes(y,x) Likes(gail, bob). Consider that in any model of Likes(x,y) Likes(y,x), any value in the domain could be chosen as the value for x and y. Thus Likes(gail, bob) Likes(bob, gail) is true. Robinson’s Unification (1965) “minimal instantiation”: Likes(z, raymond). Likes(x,y)  Likes(y,x). Unification: compute substitutions  = {x := z, y := raymond} Likes(x,y)  Likes(y,x)  = Likes(z, raymond)  Likes(raymond,z). Infer Likes(raymond, z). Reasoning Systems for e-Business 9/16/2018

39 Proofs – Definite Clause trees
Rule of inference for definite clauses (one positive literal) From C1,…,Cm  Ai and A1,…, AnB infer A1,…,Ai-1, C1,…,Cm, Ai+1,…,An B e.g. From A and AB infer B A Proof is a data structure representing a sequence of applications of rules of inference. B + B Ai A1 Ai An + + + give with C1 Cj Cm A1 Ai An C1 Cj Cm Reasoning Systems for e-Business 9/16/2018

40 Complete for atomic consequences
Theorem Let F be a non-empty set of definite clauses and G an atom. If F |= G then there exists a proof from F with top atom G. (This is true in general, but here we assume F and G are ground. Note that there must be a model of any set of definite clauses.) Proof Base of induction on size of F. Suppose F has one clause C. If G does not occur positively in C then the model  of F may be changed to map G to false and still be a model of F. Contradiction. So G occurs as a positive literal in C. If G does not occur alone in C then  may be changed to map G to false and the other literal to true and still be a model of F. Contradiction. So G occurs alone C, so C forms the proof. Reasoning Systems for e-Business 9/16/2018

41 Reasoning Systems for e-Business
Induction step Suppose F has k clauses. Construct the minimal subset F’ of F such that F’ |= G. Note that no subset of F’ has this property. Suppose F’ contains no clause C = A1,…,An  G such that F’ |=Ai for all i=1,…,n. Then a model of F’ can be converted so that it maps G to false. Contradiction. Thus C  F’ and F’|=Ai for all i=1,…,n. Suppose F’-{C} does not entail Ai for some i. Then some model  of F’-{C} is not a model of Ai. So  verifies C. Thus  is a model of F’. So F’ does not entail Ai. Contradiction. Thus F’-{C} |=Ai for all i=1,…,n. By induction there is a proof of each Ai from F’-{C}. Combine these with the clause C and this forms a proof of G. QED Reasoning Systems for e-Business 9/16/2018

42 Reasoning Systems for e-Business
Exercises Build a clause tree proof that shows seven is less than nine, using the clauses Next(x,y)Less(x,y) and Less(x,y), Next(y,z)Less(x,z) and Next(seven,eight) and Next(eight,nine) Note that we have to change variables names in some instances to prevent them from having unintentionally colliding names. Install Java according to . Copy the file cs6905ateb.zip to your computer and unzip it to a directory. Start Emacs. In Emacs open the file ForwardReasoner.java in that directory, using C-x C-f ForwardReasoner.java Then enter Alt-x shell and at the command prompt enter the lines javac -classpath "./jdom.jar;./xerxes.jar;." ForwardReasoner.java java ForwardReasoner Note the syntax used in the definite clauses file a.dc. We’ll use this syntax in the next section. Reasoning Systems for e-Business 9/16/2018

43 Reasoning Systems for e-Business
Resolution Given two clauses, to form the resolvent: find two literals, one from each clause, that can be made to match (with assignments to the variables) differ in sign construct the disjunction of all literals except these two apply the substitution Resolve b(X)  c(X, 3) against c(2, Y)  d(Y, Z) unify with  = {X:=2, Y:=3} b(X)  d(Y, Z)  = b(2)  d(3, Z) Reasoning Systems for e-Business 9/16/2018

44 Reasoning Systems for e-Business
Bottom Up Reasoning Single literal definite clauses are called facts passes(‘Fang’, cs6999) Resolving a fact against a condition in a rule is called forward reasoning attends(Student, Course)  passes(Student, Course) Resolvent: attends(‘Fang’, cs6999) Usually a derivation tree is viewed with given facts at the bottom and derived facts at the top so forward reasoning also called bottom up reasoning Prolog does top-down, backward reasoning starting from a negative clause, called a query Reasoning Systems for e-Business 9/16/2018

45 Theorem Prover’s Search Procedure
main loop select new fact for each matching rule resolve process new result add to old facts Priority queue new facts Discrimination trees: used facts rules, indexed on first goal process new result(C) if C is rule for each old fact matching first goal resolve process new result add C to rules else add C to new facts Reasoning Systems for e-Business 9/16/2018

46 Completeness of the Search Procedure
We know that if F |= G then a proof of G exists, but do we know that the bottom-up system will find it? Theorem: Let F be a set of definite clauses and G an atom so that F |= G. With the prover started so that set of new facts is initialized to the single literal clauses in F and the set of rules to F’s other clauses, G will occur eventually among the used facts. Proof sketch. Simplify by assuming all atoms are ground and that the priority queue is just a queue. Since F |= G, there is a clause tree proof of G from the clauses of F. Proceed by induction on the length of a longest path in the proof. Let A1,…,An  G be the top clause of the clause tree proof. Then F |= Ai for each i. By induction each Ai is placed in the old facts. Let Ak be the final of these. By the time Ak is selected Ak,…,An  G has already been placed in the rules. As part of the procedure, Ak+1,…, An  G is produced and since all Ak+1,…, An are in the used facts, G is also produced. Reasoning Systems for e-Business 9/16/2018

47 Preventing Infinite Loops
To prevent infinite loops in the search procedure, use subsumption (next slides) and either 1a) use ground facts and rules only, or 1b) use no function symbols Sometimes it helps if the positive literal has no new variables (that do not already occur in the body) Reasoning Systems for e-Business 9/16/2018

48 Reasoning Systems for e-Business
Subsumption A clause C subsumes a clause D if there is a substitution  such that C  D C is more general than D Given C you do not need D We use subsumption between facts (atoms) Atom C subsumes atom D if there exists  such that C = D Subsumption is checked by first grounding all variables in D to new constants then trying to unify C with grounded D Why new constants? Reasoning Systems for e-Business 9/16/2018

49 Why does “ground D with new constants and unify” work?
Exercise Does C = p(a) subsume D = p(X)? No. What if “subsume” were decided simply with “unify D with C”? This would allow us to say that this D which is more general than this C, is subsumed by it, which is not correct. What if “subsume” were decided with “ground D and unify with C”? This would allow D to be ground to p(a), which would unify with C, allowing us to conclude incorrectly that C subsumes D. Does C=p(X) subsume D = p(Y)? yes Does C=p(X) subsume D = p(a)? yes Reasoning Systems for e-Business 9/16/2018

50 Reasoning Systems for e-Business
Forward subsumption New result is checked against old results to see if it is more general We can prevent some infinite loops by checking subsumption of new fact against old facts Should this be done when the new fact is derived or when it is selected? experience shows that subsumption on selection is better What about subsumption of rules? Are there still infinite loops? Reasoning Systems for e-Business 9/16/2018

51 Theorem Prover’s Search Procedure
main loop select new fact if it is not forward subsumed for each matching rule resolve process new result add to old facts Priority queue new facts Discrimination trees: used facts rules, indexed on first goal process new result(C) if C is rule for each old fact matching first goal resolve process new result add C to rules else add C to new facts Reasoning Systems for e-Business 9/16/2018

52 Reasoning Systems for e-Business
Reasoning Top Down We could also build definite clause trees to match a given atom to be proved Top-down reasoning from the goal Pro: more specific search for a proof of that atom Con: may lead to inifinite loop (different ones) Exercises: Does the clause p(f(X)) :- p(X) lead to an infinite loop top down? Bottom up? What about p(X) :- p(f(X))? What about p :- q and q:- p? Which strategy is worse for infinite loops? Propose a strategy for eliminating more of the loops in top down. Reasoning Systems for e-Business 9/16/2018

53 Top Down Propositional Prover: 1
initially proofTree has an open Goal loop if(proofTree.hasNoOpenGoal()) halt('success'); else Goal g = proofTree.selectOpenGoal(); g.createMatchingClauseList(); if(g.hasMoreMatchingClauses()) g.attachNextMatchingClause(); choicePoints.push(g); chronologicalBacktrack(); Reasoning Systems for e-Business 9/16/2018

54 Propositional Prover: 2
chronologicalBacktrack while(not choicePoints.empty()) Goal g = choicePoints.pop(); g.removeAttachedClause(); if(g.hasMoreMatchingClauses()) return halt('failure'); Reasoning Systems for e-Business 9/16/2018

55 Reasoning Systems for e-Business
Propositional Prover chronologicalBacktrack while(choicePoints.nonEmpty()) Goal g = choicePoints.pop(); g.removeAttachedClause(); if(g.hasMoreClauses()) return; halt('failure') initially proofTree has an open Goal loop if(proofTree.hasNoOpenGoal()) halt('success'); else Goal g = proofTree.selectOpenGoal(); g.createMatchingClauseList(); if(g.hasMoreMatchingClauses()) DefiniteClause c = g.nextClause(); g.attachClause(c); choicePoints.push(g); chronologicalBacktrack(); Remove bindings Java Iterator Create bindings Reasoning Systems for e-Business

56 Tree with initial goal p(Z)
p(X) :- q(X), r(X). q(g(X)). q(k). r(g(h)) ?:-p(Z) a ChoicePoints p(Y1) :- q(Y1), r(Y1) q(g(Y2)) r(g(h)) b c Y1/g(Y2) Y2/h q(k) Y1/k b’ b a Z/Y1 Reasoning Systems for e-Business 9/16/2018

57 Reasoning Systems for e-Business
Exercises Download the file jDrewGUI.zip, which contains a top-down reasoning system. Extract it to a directory, say C:\myfiles\cs6905ateb Edit two lines in the file run.bat set jDrewGUIHome=C:\myfiles\cs6905ateb set JAVA_HOME=c:\myfiles\java\jdk Run run.bat Make changes to the file default.dc Reasoning Systems for e-Business 9/16/2018

58 Moving to First Order Logic
Students struggle with variables Unification Composition of substitutions Unbinding on backtracking Can we hide the hard stuff? Powerful abstraction Reasoning Systems for e-Business 9/16/2018

59 Reasoning Systems for e-Business
Hiding the hard stuff proof tree goal When attaching a clause to a Goal Matching clause must be an instance of input clause Semi-unification creates the instance Bindings to variables in goal may be propagated through tree now or later When removing the clause relax any propagated variable bindings p(a, Y) input clause p(X, b) :- … clause instance p(a, b) :- … propagated binding Yb Reasoning Systems for e-Business 9/16/2018

60 Shallow or deep variables?
variable binding is a list of replacements traverse list for each lookup undoing: remove most recent replacements {X  f(Y)}  {Y  a} Shallow an array of (all) variables and their current values [X  f(a) Y  a …] undoing: pop stack of previous values (trail) Reasoning Systems for e-Business 9/16/2018

61 Choosing between shallow and deep
pay for each lookup (deep search) unbinding is cheap Shallow lookup is cheap (shallow search) may need many large arrays of possible variables jDREW uses local shallow each clause has own array of just local variables, named –1, -2, … scope is clause-wide so propagation necessary Reasoning Systems for e-Business 9/16/2018

62 Goal Tree and flatterms
p Each node has head and body atoms Body atoms form goals attach children resolved p1 from d  p1, …, pm against q from q  q1, …, qn resolved pm against r . p1 pm D C q r q1 qn Reasoning Systems for e-Business 9/16/2018

63 Flatterms to represent atoms
jDREW TD uses flatterms Array of pairs: symbol table ref length of subterm Not structure sharing Flatterms save theorem provers time and space (de Nivelle, 1999) Data transfer between deduction engine and rest of application Reasoning Systems for e-Business 9/16/2018

64 Variables are clause-specific
Variables use negative indexes Bindings are references to flatterm & position Unifier X  g2 Y  f(g2) W  h(g2) Z  f(g2) Reasoning Systems for e-Business 9/16/2018

65 Composing and undoing Bindings
Local shallow bindings currently do not allow composition bindings must be done to a flatterm new binding on a new flatterm Backtracking is integrated with unbinding for quick unbinding, we use a stack of flatterms for each goal. Reasoning Systems for e-Business 9/16/2018

66 Evaluation of local shallow bindings
Disadvantage for backtracking must propagate bindings to other nodes Advantage fast interaction with rest of system simple, no environments to pass around compact, no large arrays Appropriate for forward chaining no backtracking, no propagation Probably appropriate when backward chaining function-free logic Design decision to revisit Reasoning Systems for e-Business 9/16/2018

67 Reasoning Systems for e-Business
Discrimination trees Given a goal we want to access matching clauses quickly Every-argument addressing unlike Prolog’s first argument addressing Useful for RDF triples a pattern may have variable in first argument rdf(X, ownedby, ‘Ora Lassila’) Reasoning Systems for e-Business 9/16/2018

68 Reasoning Systems for e-Business
Discrimination trees Given a goal, want to access input clauses with matching heads quickly Index into clauses via a structure built from heads Replace vars by * imperfect discrimination merge prefixes as much as possible a tree arises * p q r f g1 h g2 We added p(f(g1 ),h(g2 ),g1 ) p(f(h( X )),h(Y ),f(Z, Z)) Reasoning Systems for e-Business 9/16/2018

69 Finding heads for goal p(X,h(g2),Y)
q r f g1 h * g2 replace vars in goal by * p(*,h(g2),*) Find instances of goal * in goal, skip subtree Find generalizations of goal * in tree, skip term in goal Find unifiable combination of both p(f(g1 ),h(g2 ),g1 ) p(f(h( X )),h(Y ),f(Z, Z)) Reasoning Systems for e-Business 9/16/2018

70 Iterator for matching clauses
We use Java idioms where possible Java’s iterators give access to sequence next() hasNext() Used for access to sequence of matching clauses used in discrimination tree for access to roots leaves of skipped tree (McCune’s term: jump-list) Reasoning Systems for e-Business 9/16/2018

71 Reasoning Systems for e-Business
Description Logic Classification of concepts and individuals … of concepts determines subconcept/superconcept relationships (subsumption) between the given concepts allows one to structure into a subsumption hierarchy. provides useful information on the connection between different concepts it can be used to speed-up other inference services. … of individuals (or objects) determines whether a given individual is always an instance of a certain concept i.e., whether this instance relationship is implied by the description of the individual and the definition of the concept. provides useful information on the properties of an individual Reasoning Systems for e-Business 9/16/2018

72 Reasoning Systems for e-Business
Examples Bachelor, Unmarried are concepts, Bob is an individual Bachelor = And(Unmarried, Adult, Male) OneOf(bob, Unmarried) Can be expressed as a fragment of First Order Logic (x) Bachelor(x)  Unmarried(x)  Adult(x)  Male(x) Unmarried(bob) Can ask if one set subsumes another, or if one individual is a member of a set Cannot state one set is a subset of another that should be derivable from descriptions Reasoning Systems for e-Business 9/16/2018

73 Grammar for descriptions
For the description logic CLASSIC (Borgita et al.) bold elements are key words Concept  Thing | ConceptName | And(Concept,….) | All(RoleName, Concept) | AtLeast(Integer, RoleName) | AtMost(Integer, RoleName) | SameAs(Path, Path) | OneOf(IndividualName, …) | Fills(RoleName, IndividualName, …) Path  [RoleName, …] *Borgita, A., Brachman, R.J., McGuinness, D.L., and Alpern Resnick, L., (1989) CLASSIC: A structural data model for objects. SIGMOD Record, 18(2):58-67. Reasoning Systems for e-Business 9/16/2018

74 Reasoning Systems for e-Business
A lot easier than FOL The set of men with at least three sons who are all unemployed and married to doctors, and at most two daughters who are all professors of physics or chemistry And(Man, AtLeast(3, Son), AtMost(2, Daughter), All(Son, And(Unemployed, Married, All(Spouse, Doctor)), All(Daughter, And(Professor, Fills(Department, Physics, Chemistry)))) Reasoning Systems for e-Business 9/16/2018

75 Reasoning Systems for e-Business
The same concept in FOL (x) (s1) (s2) (s3) (dil1) (dil2) (dil3) (d1) (d2) Man(x)  SonOf(x, s1)  SonOf(x, s2)  SonOf(x, s3)  s1s2  s1s3  s2s3  s2s3  Unemployed(s1)  Married(s1, dil1)  Doctor(dil1)  …  DaughterOf(x, d1)  DaughterOf(x, d2)  d1d2  Reasoning Systems for e-Business 9/16/2018

76 Reasoning Systems for e-Business
Reasoning Problems Positive and negative queries want answers in non-infinite time, low time complexity maybe even in web-surfer-patience-time Some DL’s have no disjunctives, except over certain fixed lists have only And but not Or (sometimes Not) e.g. Fills(Department, Physics, Chemistry) means this concept fills the department role either with Chemistry or Physics, so just doubles the amount of work Often have only And but not Or or Not Disjunction causes first order logic systems to enumerate large sets of possibly true clauses We have stayed with definite clause logic and sometimes have avoided such enumeration, but still have possibly infinite search Reasoning Systems for e-Business 9/16/2018

77 Applications of Description Logic
Database interfaces concepts in the database may be described in DL Software information systems categorize software concepts can be created by parsing the program Semantic Web Aim: express machine-understandable meaning from the large amount of information in only human-readable form. Requires an ontology of important concepts Web pages use words that are linked to concepts in the ontology Then can be processed by machines Description Logic is suggested as a language for the ontologies. OWL – Ontology Web Language based on DL (find URL for this probably Reasoning Systems for e-Business 9/16/2018

78 Privacy and e-Business
P3P Platform for Privacy Preferences for a business agent to express its practice of dealing with the private information transmitted in the course of an exchange e.g. a website’s policy for transmitting your address to third parties APPEL A Privacy Preference Exchange Language a rule language for expressing the preferences of the owner of that private information P3P statements can be translated to facts in logic describing the items to be collected APPEL statements can be translated to rules concluding whether or not to accept the practice. Reasoning Systems for e-Business 9/16/2018

79 Reasoning Systems for e-Business
Examples Reasoning Systems for e-Business 9/16/2018


Download ppt "CS6905 Advanced Technologies for e-Business May 1 – July"

Similar presentations


Ads by Google