Meta-Complexity Theorems for Bottom-up Logic Programs Harald - PowerPoint PPT Presentation
Meta-Complexity Theorems for Bottom-up Logic Programs Harald Ganzinger Max-Planck-Institut f ur Informatik David McAllester ATT Bell-Labs Research Introduction 2 logic programming of efficient algorithms complexity analysis through
Reachability in Graphs 8 r ( u ) O ( | V | ) s ( u ) O ( | V | ) e ( u, v ) r ( u ) r ( v )
Reachability in Graphs 8 r ( u ) O ( | V | ) s ( u ) O ( | V | ) e ( u, v ) + O ( | E | ) r ( u ) r ( v ) Theorem Reachability can be decided in linear time.
Interprocedural Reachability: Database 9 program facts 1 procedure main proc(main,2,6) 2 begin next(main,2,5) 3 declare x: int 4 read(x) call(main,p,5,6) 5 call p(x) 6 end 7 procedure p(a:int) proc(p,8,15) 8 begin 9 if a>0 then next(p,8,12) 10 read(g) 11 a:=a-g call(p,p,12,13) 12 call p(a) next(p,13,15) 13 print(a) 14 fi next(p,8,15) 15 end
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) P β B P call ( Q, P, L c , R r ) proc ( P, B P , E P ) next ( Q, L, L β² ) P β E P Q β L Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) proc ( P, B P , E P ) next ( Q, L, L β² ) P β E P Q β L Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) proc ( P, B P , E P ) next ( Q, L, L β² ) O ( n ) P β E P Q β L Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) proc ( P, B P , E P ) next ( Q, L, L β² ) O ( n ) P β E P Q β L β O (1) Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) O ( n ) proc ( P, B P , E P ) next ( Q, L, L β² ) O ( n ) P β E P Q β L β O (1) Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) O ( n ) proc ( P, B P , E P ) β O (1) next ( Q, L, L β² ) O ( n ) P β E P Q β L β O (1) Q β L c Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) O ( n ) proc ( P, B P , E P ) β O (1) next ( Q, L, L β² ) O ( n ) P β E P β O (1) Q β L β O (1) Q β L c β O (1) Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Interprocedural Reachability: Rules 10 Read β P β L β as βin procedure P label L can be reachedβ. proc ( P, B P , E P ) O ( n ) P β B P call ( Q, P, L c , R r ) O ( n ) proc ( P, B P , E P ) β O (1) next ( Q, L, L β² ) O ( n ) P β E P β O (1) Q β L β O (1) Q β L c β O (1) Q β L β² Q β L r Theorem IPR β ( D ) can be computed in time O ( n ), with n = | | D | | .
Proof of the Meta-Complexity Theorem I 11 Assumption: all terms in fully shared form
Proof of the Meta-Complexity Theorem I 11 Assumption: all terms in fully shared form Matching: in O (1) (for atoms in rules against atoms in D )
Proof of the Meta-Complexity Theorem I 11 Assumption: all terms in fully shared form Matching: in O (1) (for atoms in rules against atoms in D ) Unary Rules A β B : matching of A against each atom in R ( D ), plus construction of B , costs total time O ( | R ( D ) | )
Proof of the Meta-Complexity Theorem I 11 Assumption: all terms in fully shared form Matching: in O (1) (for atoms in rules against atoms in D ) Unary Rules A β B : matching of A against each atom in R ( D ), plus construction of B , costs total time O ( | R ( D ) | ) Note: programs not cons-free
Proof of the Meta-Complexity Theorem I 11 Assumption: all terms in fully shared form Matching: in O (1) (for atoms in rules against atoms in D ) Unary Rules A β B : matching of A against each atom in R ( D ), plus construction of B , costs total time O ( | R ( D ) | ) Note: programs not cons-free Problem: avoiding O ( | R ( D ) | k ) for rules of length k
Proof of the Meta-Complexity Theorem II 12 Data structure for rules Ο of the form p ( X, Y ) β§ q ( Y, Z ) β r ( X, Y, Z )
Proof of the Meta-Complexity Theorem II 12 Data structure for rules Ο of the form p ( X, Y ) β§ q ( Y, Z ) β r ( X, Y, Z ) Ο [ Y ] p -list of Ο [ t ] q -list of Ο [ t ] p ( a,t ) p ( b,t ) q ( t,u ) q ( t,v ) p ( c,t ) q ( t,w ) p ( d,t ) p ( e,t ) q ( t,s )
Proof of the Meta-Complexity Theorem II 12 Data structure for rules Ο of the form p ( X, Y ) β§ q ( Y, Z ) β r ( X, Y, Z ) Ο [ Y ] p -list of Ο [ t ] q -list of Ο [ t ] p ( a,t ) p ( b,t ) q ( t,u ) q ( t,v ) p ( c,t ) q ( t,w ) p ( d,t ) p ( e,t ) q ( t,s ) Upon adding a fact p ( e, t ), fire all r ( e, t, z ), for z on the q -list of A [ t ].
Proof of the Meta-Complexity Theorem II 12 Data structure for rules Ο of the form p ( X, Y ) β§ q ( Y, Z ) β r ( X, Y, Z ) Ο [ Y ] p -list of Ο [ t ] q -list of Ο [ t ] p ( a,t ) p ( b,t ) q ( t,u ) q ( t,v ) p ( c,t ) q ( t,w ) p ( d,t ) p ( e,t ) q ( t,s ) Upon adding a fact p ( e, t ), fire all r ( e, t, z ), for z on the q -list of A [ t ]. The inference system can be transformed (maintaining Ο ) so that it contains only unary rules and binary rules of the form Ο .
Remarks 13 β’ memory consumption often much smaller
Remarks 13 β’ memory consumption often much smaller β’ if R β ( D ) infinite, consider R β ( D ) β© atoms(subterms( D )) β concept of local inference systems (Givan, McAllester 1993)
Remarks 13 β’ memory consumption often much smaller β’ if R β ( D ) infinite, consider R β ( D ) β© atoms(subterms( D )) β concept of local inference systems (Givan, McAllester 1993) β’ in the presence of transitivity laws, complexity is in β¦( n 3 )
II. Redundancy, Deletion, and Priorities
Removal of Redundant Information 15 β’ redundant information causes inefficiency D = { . . . , dist ( x ) β€ d, dist ( x ) β€ d β² , d β² < d, . . . } β delete dist ( x ) β€ d β’ Notation: antecedents to be deleted in parenthesis [ . . . ] . . . , [ A ] , . . . , A β² , . . . , [ A β²β² ] , . . . β B β’ in the presence of deletion, computations are nondeterministic: P β Q [ Q ] β S [ Q ] β W β either S or W can be derived, but not both β’ non-determinism donβt-care and/or restricted by priorities
Removal of Redundant Information 15 β’ redundant information causes inefficiency D = { . . . , dist ( x ) β€ d, dist ( x ) β€ d β² , d β² < d, . . . } β delete dist ( x ) β€ d β’ Notation: antecedents to be deleted in parenthesis [ . . . ] . . . , [ A ] , . . . , A β² , . . . , [ A β²β² ] , . . . β B β’ in the presence of deletion, computations are nondeterministic: P β Q [ Q ] β S [ Q ] β W β either S or W can be derived, but not both β’ non-determinism donβt-care and/or restricted by priorities
Removal of Redundant Information 15 β’ redundant information causes inefficiency D = { . . . , dist ( x ) β€ d, dist ( x ) β€ d β² , d β² < d, . . . } β delete dist ( x ) β€ d β’ Notation: antecedents to be deleted in parenthesis [ . . . ] . . . , [ A ] , . . . , A β² , . . . , [ A β²β² ] , . . . β B β’ in the presence of deletion, computations are nondeterministic: P β Q [ Q ] β S [ Q ] β W β either S or W can be derived, but not both β’ non-determinism donβt-care and/or restricted by priorities
Removal of Redundant Information 15 β’ redundant information causes inefficiency D = { . . . , dist ( x ) β€ d, dist ( x ) β€ d β² , d β² < d, . . . } β delete dist ( x ) β€ d β’ Notation: antecedents to be deleted in parenthesis [ . . . ] . . . , [ A ] , . . . , A β² , . . . , [ A β²β² ] , . . . β B β’ in the presence of deletion, computations are nondeterministic: P β Q [ Q ] β S [ Q ] β W β either S or W can be derived, but not both β’ non-determinism donβt-care and/or restricted by priorities
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Logic Programs with Priorities and Deletion 16 β’ rules can have antecedents to be deleted after firing β’ priorities assigned to rule schemes β’ computation states S contain positive and negative (deleted) atoms β’ A visible in S if A β S and Β¬ A οΏ½β S (deletions are permanent) β’ Ξ β B applicable in S if β each atom in Ξ is visible in S , and β rule application changes S (by adding B or some Β¬ A ) β’ S visible to a rule if no higher-priority rule is applicable in S β’ computations are maximal sequences of applications of visible rules β’ the final state of a computation starting with D is called an ( R -) saturation of D
Second Meta-Complexity Theorem 17 Let C = S 0 , S 1 , . . . , S T be a computation. Prefix firing in C : pair ( rΟ, i ) such that for some 0 β€ t < T : β r = A 1 β§ . . . β§ A i β§ . . . β§ A n β A 0 β R β S t visible to r β A j Ο visible in S t , for 1 β€ j β€ i
Second Meta-Complexity Theorem 17 Let C = S 0 , S 1 , . . . , S T be a computation. Prefix firing in C : pair ( rΟ, i ) such that for some 0 β€ t < T : β r = A 1 β§ . . . β§ A i β§ . . . β§ A n β A 0 β R β S t visible to r β A j Ο visible in S t , for 1 β€ j β€ i Prefix count: Ο R ( D ) = max {| p . f . ( C ) | | C a computation from D }
Second Meta-Complexity Theorem 17 Let C = S 0 , S 1 , . . . , S T be a computation. Prefix firing in C : pair ( rΟ, i ) such that for some 0 β€ t < T : β r = A 1 β§ . . . β§ A i β§ . . . β§ A n β A 0 β R β S t visible to r β A j Ο visible in S t , for 1 β€ j β€ i Prefix count: Ο R ( D ) = max {| p . f . ( C ) | | C a computation from D } Theorem [Ganzinger/McAllester 2001] Let R be an inference system such that R ( D ) is finite. Then some R ( D ) can be computed in time O ( | | D | | + Ο R ( D )).
Second Meta-Complexity Theorem 17 Let C = S 0 , S 1 , . . . , S T be a computation. Prefix firing in C : pair ( rΟ, i ) such that for some 0 β€ t < T : β r = A 1 β§ . . . β§ A i β§ . . . β§ A n β A 0 β R β S t visible to r β A j Ο visible in S t , for 1 β€ j β€ i Prefix count: Ο R ( D ) = max {| p . f . ( C ) | | C a computation from D } Theorem [Ganzinger/McAllester 2001] Let R be an inference system such that R ( D ) is finite. Then some R ( D ) can be computed in time O ( | | D | | + Ο R ( D )). Proof as before, but also using constant-length priority queues
Second Meta-Complexity Theorem 17 Let C = S 0 , S 1 , . . . , S T be a computation. Prefix firing in C : pair ( rΟ, i ) such that for some 0 β€ t < T : β r = A 1 β§ . . . β§ A i β§ . . . β§ A n β A 0 β R β S t visible to r β A j Ο visible in S t , for 1 β€ j β€ i Prefix count: Ο R ( D ) = max {| p . f . ( C ) | | C a computation from D } Theorem [Ganzinger/McAllester 2001] Let R be an inference system such that R ( D ) is finite. Then some R ( D ) can be computed in time O ( | | D | | + Ο R ( D )). Proof as before, but also using constant-length priority queues Note: again prefix firings count only once; priorities are for free
Union-Find 18 find( x ) x β ! y x β y (Refl) y β z x β z x β ! x (N) (Comm) x β ! z union( y, z )
Union-Find 18 find( x ) x β ! y x β y (Refl) y β z x β z x β ! x (N) (Comm) x β ! z union( y, z ) union( x, y ) x β ! z 1 y β ! z 2 union( x, y ) (Init) (Orient) find( x ) , z 1 β z 2 find( y ) We are interested in x . = y defined as β z ( x β ! z β§ y β ! z )
Union-Find 18 O ( n 2 ) O ( n 2 ) find( x ) x β ! y x β y β O ( n ) β O ( n ) (Refl) y β z x β z x β ! x (N) (Comm) x β ! z union( y, z ) union( x, y ) x β ! z 1 y β ! z 2 union( x, y ) (Init) (Orient) find( x ) , z 1 β z 2 find( y ) Naive Knuth/Bendix completion
Union-Find 18 O ( n 2 ) find( x ) [ [ x β ! y ] ] x β y O ( n ) β O (1) β O (1) (Refl) y β z x β z x β ! x (N) (Comm) x β ! z union( y, z ) [ [union( x, y )] ] [ [union( x, y )] ] x β ! z 1 x β ! z y β ! z 2 union( x, y ) y β ! z (Init) (Triv) (Orient) find( x ) , β€ z 1 β z 2 find( y ) Naive Knuth/Bendix completion + normalization (eager path compression)
Union-Find 18 find( x ) [ [ x β ! y ] ] O ( n log n ) x β y β O (1) (Refl) y β z x β z x β ! x (N) (Comm) weight( x, 1) x β ! z union( y, z ) [ [union( x, y )] ] [ [union( x, y )] ] x β ! z 1 , weight( z 1 , w 1 ) x β ! z y β ! z 2 , [ [weight( z 2 , w 2 )] ] union( x, y ) y β ! z w 1 β€ w 2 (Init) (Triv) (Orient) find( x ) , β€ z 1 β z 2 find( y ) weight( z 2 , w 1 + w 2 ) + symmetric variant of (Orient) Naive Knuth/Bendix completion + normalization (eager path compression) + logarithmic merge
Congruence Closure for Ground Horn Clauses 19 Extension to congruence closure: 7 more rules, guaranteed optimal complexity O ( m + n log n ), where m = | union assertions | , n = | (sub)terms |
Congruence Closure for Ground Horn Clauses 19 Extension to congruence closure: 7 more rules, guaranteed optimal complexity O ( m + n log n ), where m = | union assertions | , n = | (sub)terms | Extension to ground Horn clauses with equality: 13 more rules
Congruence Closure for Ground Horn Clauses 19 Extension to congruence closure: 7 more rules, guaranteed optimal complexity O ( m + n log n ), where m = | union assertions | , n = | (sub)terms | Extension to ground Horn clauses with equality: 13 more rules Theorem [Ganzinger/McAllester 01] Satisfiability of a set D of ground Horn clauses with equality can be decided in time | + n log n + min( m log n, n 2 )) where m is the number O ( | | D | of antecedents and input clauses and n is the number of | )) whenever m is in β¦( n 2 ). terms. This is optimal ( = O ( | | D |
Congruence Closure for Ground Horn Clauses 19 Extension to congruence closure: 7 more rules, guaranteed optimal complexity O ( m + n log n ), where m = | union assertions | , n = | (sub)terms | Extension to ground Horn clauses with equality: 13 more rules Theorem [Ganzinger/McAllester 01] Satisfiability of a set D of ground Horn clauses with equality can be decided in time | + n log n + min( m log n, n 2 )) where m is the number O ( | | D | of antecedents and input clauses and n is the number of | )) whenever m is in β¦( n 2 ). terms. This is optimal ( = O ( | | D | Logic View: We can (partly) deal with logic programs with equality
Congruence Closure for Ground Horn Clauses 19 Extension to congruence closure: 7 more rules, guaranteed optimal complexity O ( m + n log n ), where m = | union assertions | , n = | (sub)terms | Extension to ground Horn clauses with equality: 13 more rules Theorem [Ganzinger/McAllester 01] Satisfiability of a set D of ground Horn clauses with equality can be decided in time | + n log n + min( m log n, n 2 )) where m is the number O ( | | D | of antecedents and input clauses and n is the number of | )) whenever m is in β¦( n 2 ). terms. This is optimal ( = O ( | | D | Logic View: We can (partly) deal with logic programs with equality Applications: several program analysis algorithms (Steensgaard, Henglein)
Formal Notion of Redundancy 20 Let β» a well-founded ordering on ground atoms. Definition A is redundant in S (denoted A β Red ( S )) whenever A 1 , . . . , A n | = R A , with A i in S such that A i βΊ A .
Formal Notion of Redundancy 20 Let β» a well-founded ordering on ground atoms. Definition A is redundant in S (denoted A β Red ( S )) whenever A 1 , . . . , A n | = R A , with A i in S such that A i βΊ A . Properties stable under enrichments and under deletion of redundant atoms
Formal Notion of Redundancy 20 Let β» a well-founded ordering on ground atoms. Definition A is redundant in S (denoted A β Red ( S )) whenever A 1 , . . . , A n | = R A , with A i in S such that A i βΊ A . Properties stable under enrichments and under deletion of redundant atoms Definition S is saturated up to redundancy wrt R if R ( S \ Red ( S )) β S βͺ Red ( S ).
Formal Notion of Redundancy 20 Let β» a well-founded ordering on ground atoms. Definition A is redundant in S (denoted A β Red ( S )) whenever A 1 , . . . , A n | = R A , with A i in S such that A i βΊ A . Properties stable under enrichments and under deletion of redundant atoms Definition S is saturated up to redundancy wrt R if R ( S \ Red ( S )) β S βͺ Red ( S ). Theorem If deletion is based on redundancy then the result of every computation is saturated wrt R up to redundancy.
Formal Notion of Redundancy 20 Let β» a well-founded ordering on ground atoms. Definition A is redundant in S (denoted A β Red ( S )) whenever A 1 , . . . , A n | = R A , with A i in S such that A i βΊ A . Properties stable under enrichments and under deletion of redundant atoms Definition S is saturated up to redundancy wrt R if R ( S \ Red ( S )) β S βͺ Red ( S ). Theorem If deletion is based on redundancy then the result of every computation is saturated wrt R up to redundancy. Corollary Priorities are irrelevant logically β choose them so as to minimize prefix firings
Deletions based on Redundancy 21 Criterion: If r = [ A 1 ] , . . . , [ A k ] , B 1 , . . . , B m β B and if S βͺ { A 1 Ο, . . . , A k Ο, B 1 Ο, . . . , B m Ο } is visible to r then A i Ο β Red ( S βͺ { B 1 Ο, . . . , B m Ο, BΟ } ) .
Deletions based on Redundancy 21 Criterion: If r = [ A 1 ] , . . . , [ A k ] , B 1 , . . . , B m β B and if S βͺ { A 1 Ο, . . . , A k Ο, B 1 Ο, . . . , B m Ο } is visible to r then A i Ο β Red ( S βͺ { B 1 Ο, . . . , B m Ο, BΟ } ) . Union-find example: not so easy to check, need proof orderings ` a la Bachmair and Dershowitz
Deletions based on Redundancy 21 Criterion: If r = [ A 1 ] , . . . , [ A k ] , B 1 , . . . , B m β B and if S βͺ { A 1 Ο, . . . , A k Ο, B 1 Ο, . . . , B m Ο } is visible to r then A i Ο β Red ( S βͺ { B 1 Ο, . . . , B m Ο, BΟ } ) . Union-find example: not so easy to check, need proof orderings ` a la Bachmair and Dershowitz Note: redundancy should also be efficiently decidable
III. Instance-based Priorities
Shortest Paths 23 [ [dist( x ) β€ d ] ] dist( x ) β€ d β² dist( x ) β€ d d β² < d c x β y (Init) (Upd) (Add) dist(src) β€ 0 β€ dist( y ) β€ c + d
Shortest Paths 23 [ [dist( x ) β€ d ] ] dist( x ) β€ d β² dist( x ) β€ d d β² < d c x β y (Init) (Upd) (Add) dist(src) β€ 0 β€ dist( y ) β€ c + d Correctness: obvious; deletion is based on redundancy
Shortest Paths 23 [ [dist( x ) β€ d ] ] dist( x ) β€ d β² dist( x ) β€ d d β² < d c x β y (Init) (Upd) (Add) dist(src) β€ 0 β€ dist( y ) β€ c + d Correctness: obvious; deletion is based on redundancy Priorities (Dijkstra): always choose an instance of (Add) where d is minimal β allow for instance-based rule priorities ( Init ) > ( Upd ) > ( Add )[ n/d ] > ( Add )[ m/d ] , for m > n
Shortest Paths 23 [ [dist( x ) β€ d ] ] dist( x ) β€ d β² dist( x ) β€ d d β² < d c x β y (Init) (Upd) (Add) dist(src) β€ 0 β€ dist( y ) β€ c + d Correctness: obvious; deletion is based on redundancy Priorities (Dijkstra): always choose an instance of (Add) where d is minimal β allow for instance-based rule priorities ( Init ) > ( Upd ) > ( Add )[ n/d ] > ( Add )[ m/d ] , for m > n Prefix firing count: O ( | E | ), but Dijkstraβs algorithm runs in time O ( | E | + | V | log | V | ) β one cannot expect a linear-time meta-complexity theorem for instance-based priorities
Minimum Spanning Tree 24 Basis: Union-find module
Minimum Spanning Tree 24 Basis: Union-find module c [ [ x β y ] ] c x β ! z [ [ x β y ] ] y β ! z (Add) mst( x, c, y ) (Del) union( x, y ) T
Minimum Spanning Tree 24 Basis: Union-find module c [ [ x β y ] ] c x β ! z [ [ x β y ] ] y β ! z (Add) mst( x, c, y ) (Del) union( x, y ) T Priorities: (here needed for correctness) union β find > ( Del ) > ( Add )[ n/c ] > ( Add )[ m/c ] , for m > n
Minimum Spanning Tree 24 Basis: Union-find module c [ [ x β y ] ] c x β ! z [ [ x β y ] ] y β ! z (Add) mst( x, c, y ) (Del) union( x, y ) T Priorities: (here needed for correctness) union β find > ( Del ) > ( Add )[ n/c ] > ( Add )[ m/c ] , for m > n Prefix firing count: O ( | E | + | V | log | V | )
3rd Meta-Complexity Theorem 25 Programs: as before but priorities of rule instances depend on first atom in antecedent and can be computed from the atom in constant time Theorem [in preparation] Let R be an inference system such that R β ( D ) is finite. Then some R ( D ) can be computed in time O ( | | D | | + Ο R ( D ) log p ) where p is the number of different priorities assigned to atoms in R β ( D ). Corollary 2nd meta-complexity theorem is a special case Proof technically involved; uses priority queues with log time operations; memory usage worse
3rd Meta-Complexity Theorem 25 Programs: as before but priorities of rule instances depend on first atom in antecedent and can be computed from the atom in constant time Theorem [in preparation] Let R be an inference system such that R β ( D ) is finite. Then some R ( D ) can be computed in time O ( | | D | | + Ο R ( D ) log p ) where p is the number of different priorities assigned to atoms in R β ( D ). Corollary 2nd meta-complexity theorem is a special case Proof technically involved; uses priority queues with log time operations; memory usage worse
Recommend
More recommend
Explore More Topics
Stay informed with curated content and fresh updates.