dyna
play

Dyna Evaluation of Logic Programs with Built-Ins and Aggregation: - PowerPoint PPT Presentation

Dyna Evaluation of Logic Programs with Built-Ins and Aggregation: A Calculus for Bag Relations Matthew Francis-Landau , Tim Vieira, Jason Eisner mfl@cs.jhu.edu Johns Hopkins University WRLA 2020 October 21 1 R-exprs (Relational


  1. Example Program: Shortest path distance(Start, Y) min= distance(Start, X) + edge(X, Y). distance(Start, Start) min= 0. Variables not present in the head of an expression are aggregated over like with the dot product example. 6

  2. Example Program: Shortest path distance(Start, Y) min= distance(Start, X) + edge(X, Y). distance(Start, Start) min= 0. Here the “ min=“ aggregator only keeps the minimal value that we have computed 6

  3. Example Program: Shortest path distance(Start, Y) min= distance(Start, X) + edge(X, Y). distance(Start, Start) min= 0. edge("a", "b") = 10. edge("b", "c") = 2. edge("c", "d") = 7. 6

  4. Example Program: Shortest path Dyna programs are equivalent to the set of values they distance(Start, Y) min= distance(Start, X) + edge(X, Y). define distance(Start, Start) min= 0. Start Y distance(Start, Y) edge("a", "b") = 10. "a" "a" 0 edge("b", "c") = 2. "a" "b" 10 edge("c", "d") = 7. "a" "c" 12 "a" "d" 19 "b" "b" 0 "b" "c" 2 "b" "d" 9 "c" "c" 0 "c" "d" 7 6 "d" "d" 0

  5. Example Program: Shortest path distance(Start, Y) min= distance(Start, X) + edge(X, Y). distance(Start, Start) min= 0. Defined for all cases where both Start Y distance(Start, Y) edge("a", "b") = 10. arguments are "a" "a" 0 edge("b", "c") = 2. "a" "b" 10 equal edge("c", "d") = 7. "a" "c" 12 "a" "d" 19 "b" "b" 0 "b" "c" 2 Start distance(Start, Y) Y "b" "d" 9 "foo" "foo" 0 "c" "c" 0 7 7 0 "c" "d" 7 3.1415 3.1415 0 6 "d" "d" 0

  6. Shortest Path (cont.) distance(S, S) = 0. 7

  7. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) "foo" "foo" 0 7 7 0 3.1415 3.1415 0 7

  8. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 7

  9. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 7

  10. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 Tuple of Named Variables 7

  11. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 Executable Code Defines the Rule Tuple of Named Variables 7

  12. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 Executable Code Defines the Rule Tuple of Named Variables distance(S, Y) = distance(S, X) + edge(X, Y). 7

  13. Shortest Path (cont.) distance(S, S) = 0. S Y distance(S, Y) ሼ 𝐵𝑠𝑕 1 , 𝐵𝑠𝑕 2 , 𝑆𝑓𝑡𝑣𝑚𝑢 : 𝐵𝑠𝑕 1 = 𝐵𝑠𝑕 2 𝐁𝐎𝐄 𝑆𝑓𝑡𝑣𝑚𝑢 = 0ሽ "foo" "foo" 0 7 7 0 3.1415 3.1415 0 Executable Code Defines the Rule Tuple of Named Variables distance(S, Y) = distance(S, X) + edge(X, Y). Because of recursion, it can not be expressed using the set builder notation 7

  14. distance(Start, Y) = edge(X, Y) + distance(Start, X). 8

  15. distance(Start, Y) = edge(X, Y) + distance(Start, X). Normalize with standard names for all arguments Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). 8

  16. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). R-expr to Call (E is edge(Arg2, X)) function by name 8

  17. distance(Start, Y) = edge(X, Y) + distance(Start, X). Intermediate results are mapped to Result is distance(Arg1, Arg2) :- variables Result = edge(Arg2, X) + distance(Arg1, X). R-expr to Call (E is edge(Arg2, X)) function by name 8

  18. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). (E is edge(Arg2, X)) Recursive (D is distance(Arg1, X)) call to distance 8

  19. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). (E is edge(Arg2, X)) (D is distance(Arg1, X)) builtin_plus(Result, E, D) Built-in represented in the R-expr 8

  20. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). Intersect the bag by multiplying the (E is edge(Arg2, X)) ∩ multiplicities and * joining these (D is distance(Arg1, X)) ∩ * expressions using builtin_plus(Result, E, D) the same variable names 8

  21. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). (E is edge(Arg2, X)) ∩ * (D is distance(Arg1, X)) ∩ * builtin_plus(Result, E, D) Over the tuple ⟨Arg1, Arg2, Result, E, D, X⟩ 8

  22. distance(Start, Y) = edge(X, Y) + distance(Start, X). Result is distance(Arg1, Arg2) :- Result = edge(Arg2, X) + distance(Arg1, X). (E is edge(Arg2, X)) ∩ * (D is distance(Arg1, X)) ∩ * builtin_plus(Result, E, D) proj(E, proj(D, proj(X, ))) Project out all local variables Now Over the tuple ⟨Arg1, Arg2, Result⟩ 8

  23. What about Aggregation? distance(S, X) min= edge(X, Y) + distance(S, Y). • Any semi-group: min, max, sum, product, logical OR, logical AND 9

  24. What about Aggregation? distance(S, X) min= edge(X, Y) + distance(S, Y). • Any semi-group: min, max, sum, product, logical OR, logical AND (Result=min(MinInputVariable, R)) 9

  25. What about Aggregation? distance(S, X) min= edge(X, Y) + distance(S, Y). • Any semi-group: min, max, sum, product, logical OR, logical AND (Result=min(MinInputVariable, R)) R-expr composed on previous slide 9

  26. What about Aggregation? distance(S, X) min= edge(X, Y) + distance(S, Y). • Any semi-group: min, max, sum, product, logical OR, logical AND (Result=min(MinInputVariable, R)) New R-expr intermediate composed on variable previous slide introduced (Like project) 9

  27. What about Aggregation? distance(S, X) min= edge(X, Y) + distance(S, Y). • Any semi-group: min, max, sum, product, logical OR, logical AND (Result=min(MinInputVariable, R)) New Resulting R-expr intermediate value from composed on variable aggregation previous slide introduced (Like project) 9

  28. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). 10

  29. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). Result is distance(Arg1, Arg2) min= Arg1=Arg2, Result=0. Result is distance(Arg1, Arg2) min= Result=edge(Arg2, Y) + distance(Arg1, Y). 10

  30. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). Result is distance(Arg1, Arg2) min= Arg1=Arg2, Result=0. Result is distance(Arg1, Arg2) min= Result=edge(Arg2, Y) + distance(Arg1, Y). ∩ (Arg1=Arg2) * (MinInput=0) 10

  31. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). Result is distance(Arg1, Arg2) min= Arg1=Arg2, Result=0. Result is distance(Arg1, Arg2) min= Result=edge(Arg2, Y) + distance(Arg1, Y). ∩ (Arg1=Arg2) * (MinInput=0) proj(E, proj(D, proj(Y, ∩ ∩ (E is edge(Arg2, Y)) * (D is distance(Arg1, Y)) * builtin_plus(MinInput, E, D) ))) 10

  32. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). Result is distance(Arg1, Arg2) min= Arg1=Arg2, Result=0. Result is distance(Arg1, Arg2) min= Result=edge(Arg2, Y) + distance(Arg1, Y). ∩ ( ) (Arg1=Arg2) * (MinInput=0) ∪ + ( ) proj(E, proj(D, proj(Y, ∩ ∩ (E is edge(Arg2, Y)) * (D is distance(Arg1, Y)) * builtin_plus(MinInput, E, D) ))) 10

  33. Shortest Path All Together Now distance(S, S) min= 0. distance(S, X) min= edge(X, Y) + distance(S, Y). Result is distance(Arg1, Arg2) min= Arg1=Arg2, Result=0. Result is distance(Arg1, Arg2) min= Result=edge(Arg2, Y) + distance(Arg1, Y). The complete distance ( Result=min ( MinInput, rule as a R-expr ∩ ( ) (Arg1=Arg2) * (MinInput=0) ∪ + ( ) proj(E, proj(D, proj(Y, ∩ ∩ (E is edge(Arg2, Y)) * (D is distance(Arg1, Y)) * builtin_plus(MinInput, E, D) ))) )) 10

  34. Manipulating R-exprs via Rewrites 11

  35. Manipulating R-exprs via Rewrites • A series of semantic preserving rewrites which attempt to simplify the expression • Look for a sub-R-expr which can be rewritten to be simpler, do so! 11

  36. Manipulating R-exprs via Rewrites • A series of semantic preserving rewrites which attempt to simplify the expression • Look for a sub-R-expr which can be rewritten to be simpler, do so! • Non-deterministic: Any order of rewrites is acceptable • Requires searching through the entire R-expr to identify what can be rewritten/run 11

  37. Manipulating R-exprs via Rewrites • A series of semantic preserving rewrites which attempt to simplify the expression • Look for a sub-R-expr which can be rewritten to be simpler, do so! • Non-deterministic: Any order of rewrites is acceptable • Requires searching through the entire R-expr to identify what can be rewritten/run • Fair rewrites: non-normal form sub-expression are eventually rewritten • Important in the case of recursive programs 11

  38. Manipulating R-exprs via Rewrites • A series of semantic preserving rewrites which attempt to simplify the expression • Look for a sub-R-expr which can be rewritten to be simpler, do so! • Non-deterministic: Any order of rewrites is acceptable • Requires searching through the entire R-expr to identify what can be rewritten/run • Fair rewrites: non-normal form sub-expression are eventually rewritten • Important in the case of recursive programs • Core rewrites are presented in the paper 11

  39. R-expr Rewrites — Built-ins 12

  40. R-expr Rewrites — Built-ins builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ 12

  41. R-expr Rewrites — Built-ins builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ builtin_plus(1,2,Z) → (Z=3) builtin_plus runs and its result is assigned Z 12

  42. R-expr Rewrites — Built-ins builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ builtin_plus(1,2,Z) → (Z=3) No rewrites available for: builtin_plus(1,Y,Z) 1+Y=Z Y=1, Z=2 Y=2, Z=3 Y=3, Z=4 …. 12

  43. R-expr Rewrites — Built-ins Propagate the builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ assignment to Z builtin_plus(1,2,Z) → (Z=3) builtin_plus(1,Y,Z) (Z=3)*builtin_plus(1,Y,Z) → (Z=3)*builtin_plus(1,Y,3) 12

  44. R-expr Rewrites — Built-ins Propagate the builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ assignment to Z builtin_plus(1,2,Z) → (Z=3) builtin_plus(1,Y,Z) (Z=3)*builtin_plus(1,Y,Z) → (Z=3)*builtin_plus(1,Y,3) (Z=3)*builtin_plus(1,Y,3) → (Z=3)*(Y=2) Built-ins support multiple modes for computation 12

  45. R-expr Rewrites — Built-ins * and + are over the builtin_plus(X,Y,Z) ≡ ሼ 𝑌, 𝑍, 𝑎 : 𝑌 + 𝑍 = 𝑎ሽ bag’s multiplicity builtin_plus(1,2,Z) → (Z=3) Maps to the builtin_plus(1,Y,Z) multiplicity of being contained in (Z=3)*builtin_plus(1,Y,Z) → (Z=3)*builtin_plus(1,Y,3) the bag (Z=3)*builtin_plus(1,Y,3) → (Z=3)*(Y=2) builtin_plus(1,2,3) → 1 Check builtin_plus(1,2,4) → 0 assignment is consistent 12

  46. Rewriting Example: Shortest Path Distance is distance("a", "c") 13

  47. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) 13

  48. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) 13

  49. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Rewrites Rules 0 Variables not equal ("a"="c") → 0 Variables not equal 13

  50. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Rewrites Rules 0 Multiplicative annihilation 0 Variables not equal 0 * R → 0 Multiplicative annihilation 13

  51. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Rewrites Rules R Additive identity 0 Multiplicative annihilation 0 Variables not equal 0 + R → R Additive identity 13

  52. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Rewrites Rules R Additive identity R Additive identity 0 Multiplicative annihilation 0 + R → R Additive identity 0 + R → R Additive identity 13

  53. Rewriting Example: Shortest Path Distance is distance("a", "c") Program (Result=min(MinInput, (Arg1=Arg2)*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge(Arg2, X))*(D is distance(Argr1,X)*bultin_plus(E,D,MinInput)))) (Distance=min(MinInput, ("a"="c")*(MinInput=0) + proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Rewrites Rules R Additive identity R Additive identity 0 Multiplicative annihilation 0 + R → R Additive identity (Distance=min(MinInput, proj(E, proj(D, proj(X, 0 + R → R (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Additive identity 13

  54. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) 14

  55. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) 14

  56. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) 14

  57. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) 1 0 0 Equality checks ("c"="c") → 1 14

  58. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) R Multiplicative identity 1 0 0 Equality checks 1 * R → R Multiplicative identity 14

  59. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) R Multiplicative identity R Multiplicative identity 1 0 1 * R → R Multiplicative identity 1 * R → R Multiplicative identity 14

  60. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) R Multiplicative identity R Multiplicative identity 1 0 1 * R → R Multiplicative identity (Distance=min(MinInput, proj(E, proj(D, proj(X, 1 * R → R Multiplicative identity ((X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) 14

  61. (Distance=min(MinInput, proj(E, proj(D, proj(X, (E is edge("c", X))*(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Program (Result is edge(Arg1, Arg2)) :- (Arg1="a")*(Arg2="b")*(Result=10) + (Arg1="b")*(Arg2="c")*(Result=2) + (Arg1="c")*(Arg2="d")*(Result=7) (Distance=min(MinInput, proj(E, proj(D, proj(X, (("c"="a")*(X="b")*(E=10)+ ("c"="b")*(X="c")*(E=2)+ ("c"="c")*(X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) R Multiplicative identity R Multiplicative identity 1 0 1 * R → R Multiplicative identity (Distance=min(MinInput, proj(E, proj(D, proj(X, 1 * R → R Multiplicative identity ((X="d")*(E=7)) *(D is distance("a",X)*bultin_plus(E,D,MinInput)))) Propagate values (Distance=min(MinInput, proj(D, (D is distance("a","d")*bultin_plus(7,D,MinInput)))) 14

  62. Rewrites for Aggregators 15

  63. Rewrites for Aggregators (Result=min(MinInput, (MinInput=789))) → (Result=789) A final value has been determined. Assign it to the Result Variable 15

  64. Rewrites for Aggregators (Result=min(MinInput, (MinInput=789))) → (Result=789) (Result=min(MinInput, R+S)) → builtin_min(MR, MS, Result)* (MR=min(MinInput, R))*(MS=min(MinInput, S)) Two disjunctive R-exprs can be split and processed individually 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend