Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi.

Similar presentations


Presentation on theme: "Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi."— Presentation transcript:

1 Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi

2 2 BDDs for FOL First order predicate logic Binary Decision Diagrams Simple operations on BDDs Advanced operations on BDDs Algorithm Example

3 3 First Order Predicate Logic V : variables, F : functions, Pr : predicate symbols Terms:  x  V is a term  If f  F is a function symbol of arity r and t 1,…, t r are terms, then f(t 1,…, t r ) is a term Set of all terms over F and V is denoted by T(F,V) Set of all predicates of the form P(t 1,…,t r ) is denoted by P(Pr, F, V)

4 4 Substitution Substitution is a mapping  :V  T(F,V)  [x 1 :=t]: maps each variable x to  (x), except x 1 to t Composition:  o  (t) =  (  (t)) We assume that  is extended : term to term, predicates to predicates

5 5 Formulas Formulas are defined by:  t, f  P(t 1, …, t r )  P(Pr, F, V)   is a formula   is a formula   and  are formulas     is a formula   is a formula, and x  V is a variable   x.  and  x.  are formulas Set of all formulas: F (Pr, F, V)

6 6 Structure and Interpretation A Structure is a,multi-tuple  = where  A is a non empty set  R 1, R 2,… are relations on A  F 1, F 2,… are functions on A Herbrand structures have the form  H = Let  be a structure and  : V  A be a valuation. The interpretation : T(F, V)  A of a term t is defined:  if x  V 

7 7 Interpretation of a formula F (Pr, F, V)  {0,1}

8 8 FOL ,  ╞  iff  ╞  iff  ,  ╞   unsatisifiable iff for each  there is a valuation , ,  ╞ 

9 9 equivalency    strongly (logically) equivalent  ( ,  ╞  iff ,  ╞  )    logically equivalent  (  ╞  iff  ╞  )    weakly (logically) equivalent   ,  ╞  iff  ,  ╞  No free variables: strong logical equivalence and logical equivalence coincide

10 10 Binary Decision Diagrams A BDD, is an acyclic, node labeled graph where  Q : finite set of nodes  l : Q  {0, 1}  P(Pr, F, V)  {0, 1} is a node labeling, that l(q)  0, 1 for all q  Q   is the false continuation of a node  is the true continuation of a node  s  Q  {0, 1} is a start node  0 is a symbol representing false, and 1 representing truth Each sequence q 0 q 1 … is bounded

11 11 Interpretation of a BDD Let B be a BDD,  be a structure and  be a valuation. A ,  -path of a node q 0  Q is the sequence where q n  {0,1} and for each i,  i = f if ,  ╞ l(q i ) and  i = t if ,  ╞ l(q i ) If q 0 ends in 1 we say that q 0 holds, ,  ╞ q 0 So, A BDD yields a truth value.

12 12 0 Bt=Bt= 1 B f = P(t 1,…,t r ) B P(t1, …, tr) = 01 0110 01 01 01 01 If B  = then B  = and B  =then B  =

13 13 Example P(x) 0 0 1 Q(y) 1 R(z) 0

14 14 BDD Let  be a (quantifier free) formula and B  its corresponding BDD. For each structure  and each valuation  we find that ,  ╞  iff ,  ╞ B  Proof: Straightforward on the structure of 

15 15 BDDs for FOL First order predicate logic Binary Decision Diagrams Simple operations on BDDs Advanced operations on BDDs Algorithm Example

16 16 Neglect Operator Let be a BDD. Neglect operator is defined for some q, p q, p q by:

17 17 p,q-join Operator If then

18 18 f-merge and f-sort operators f-merge and f-sort operators, sort the BDD such that labels occur in ascending order. Sorting a BDD is NP-hard Avoid sorting a BDD

19 19 f-merge Operator If then

20 20 f-sort Operator If then

21 21

22 22 Simple Operations on BDDs Lemma: (Soundness) Let B be a BDD. In case O is applicable to B, O(B)  B (O is one of ) Proof: check that for all structures and valuations ,  ╞ O(B) iff ,  ╞ B Definition: B is reduced iff non of the operators is applicable

23 23 Simple Operations on BDDs Lemma: Let B, C be BDDs p  Q B and q  Q C.Let  be a structure and  a valuation such that ,  ╞ p and ,  ╞ q. P(t 1,…,t n ) : label not occurring in subdags p and q. Then  Exists a structure  and a valuation  ,  ╞ p, ,  ╞ q and ,  ╞ P(t 1,…,t n )  Exists a structure  and a valuation  ,  ╞ p, ,  ╞ q and ,  ╞ P(t 1,…,t n )

24 24 Simple Operations on BDDs Lemma: Let B and C be reduced BDDs. p  Q B and q  Q C such that p  q. Then,  l(p) = l(q)  p  f  q  f  p  t  q  t  If B,C are the same, then p=q back

25 25 Isomorphism Let B and C be BDDs. f: Q B  {0 B,1 B }  Q C  {0 C,1 C } is called homomorphism iff l C (f(p))=l B (p), f(p  f ) = f(p)  f and f(p  t ) = f(p)  t. In case f is bijective, f is called isomorphism. B = C (isomorphic) if there exists an isomorphism f.

26 26 Example P(x) 0 0 Q(x) 1 P(x) Q(x) B C f

27 27 Theorem B and C are reduced BDDs, B  C. Then B = C (isomorphic). Proof back

28 28 Theorem Operators can be applied a finite number of times to B. Proof back

29 29 R(B) Let B be a BDD, C be a reduced BDD, B  C. According to theorem C is unique up to an isomorphism and It can be efficiently obtained (Thrm)  R(B) for CtheoremThrm R(B  ) = B t (  tautology) R(B  ) = B f (  contradiction) Basis for Propositional Logic

30 30 Advanced Operations on BDDs Copying Operator C(B): puts B in conjunction with a copy of itself (different variables) Unification Operator U  (B): instantiate B according to  (  is a relevant unifier)

31 31 Copy Operator Let B be a BDD in which variables occur. not occurring in B

32 32 Unifier A substitution  is called a unifier of P(t 1, …, t n ) and Q(u 1, …, u m ) iff  (P(t 1,…, t n ))=  (Q(u 1,…,u m )) A unifier is most general (MGU) iff for each unifier  ’ of P(t 1,…, t n ) and Q(u 1,…,u m ) there is a substitution  such that  o  =  ’ Idempotent MGU:  (  (x)) = x Linear time

33 33 Relevant Unifier A node p of B is redundant iff p  t  p  f A path is allowed iff there are no i, j such that l(p i )=l(p j ) and  i   j A node is truth-truth capable iff there is an allowed path

34 34 Relevant Unifier A valuation  is a relevant unifier iff p i is not redundant, if  i = f, p i is not truth-truth capable, and for some i, j,  i = f,  j = t and  is an idempotent MGU of l(p i ) and l(p j ).

35 35 Lemma Let B be a reduced BDD.  No redundant nodes  Every path allowed  If p i is not truth-truth capable p i  t = 0   is a relevant unifier iff for some i, j,  i =f,  j =t and  is the MGU of l(p i ) and l(p j ) on the rightmost path of B

36 36 MGU y = a

37 37 Unification Operator If  is a relevant unifier of B Lemma: (Soundness)  B  C(B)  B  B  U  (B) Proof: easy logical consequence back

38 38 BDDs for FOL First order predicate logic Binary Decision Diagrams Simple operations on BDDs Advanced operations on BDDs Algorithm Example

39 39 Algorithm Avoid expensive sorting operator All pairs of p i, p j in the rightmost path, with p i  t =0 and p j  t  0  Linearly in size of terms

40 40 Algorithm Avoid sorting by grouping predicates with the same predicate symbol The depth of recursive calls is limited by the number of free variables

41 41 Algorithm

42 42 Algorithm The program is browsing through larger and larger BDDs of the form We stop:  B f Lemma Lemma  B t

43 43 Russel’s Paradox A set which contains those sets that are not members of themselves F(x,y): x is a member of y Problem: negated and Skolemised formula

44 44 Russel’s Paradox  (y) = a Example

45 45 Thank You

46 46 Appendix A Thrm: B and C are reduced BDDs, B  C. Then B = C (isomorphic). Proof: Define f: Q B  Q C and g: Q C  Q B f(p) = q such that p  q g(q) = p such that p  q f is a homomorphism, g is the inverse of f  f is an isomorphism We assumed f and g are well defined.

47 47 Proof B  C and all nodes in B are reachable from the root  each node in B is related via  to  1 node in C p related to q 1,q 2  q 1  q 2  q 1 = q 2 (using thrm)thrm back

48 48 Appendix B Proof: The transformation operators can be formulated as rewrite rules.l 1 and l 2 are predicates. l 1 > l 2

49 49 Proof To each DAG we can obtain its canonical tree by undoing the sharing of subdags. Application of these rules must terminate on these trees. Each rewrite of the DAG corresponds to one or more rewrite of canonical tree. In Join operator the number of nodes are strictly decreasing  It should terminate back

50 50 Appendix C A set is circular if it is a member of another set, which in turn is a member of the original. There is no set containing all non circular sets. Problem: negated and Skolemised formula (a, f are skolem functions)

51 51 There are no circular sets Two relevant unifier: 1.Mapping z and x to a 2.Mapping x to z

52 52 There are no circular sets We must apply copying operator. 6 relevant unifier: 1.x:=a z:=a 2.u:=a v:=a 3.x:=v u:=a 4.u:=z x:=a 5.z:=x 6.v:=u

53 53 There are no circular sets We apply first unifier. 4 relevant unifier: 1.u:=f(a) v:=a 2.u:=a v:=a 3.u:=a 4.v:=u back


Download ppt "Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi."

Similar presentations


Ads by Google