equal
deleted
inserted
replaced
212 tactic tac0 sets up the initial priority queue, while tac1 searches it. *) |
212 tactic tac0 sets up the initial priority queue, while tac1 searches it. *) |
213 fun THEN_BEST_FIRST tac0 (satp, sizef) tac1 = |
213 fun THEN_BEST_FIRST tac0 (satp, sizef) tac1 = |
214 let val tac = tracify trace_BEST_FIRST tac1 |
214 let val tac = tracify trace_BEST_FIRST tac1 |
215 fun pairsize th = (sizef th, th); |
215 fun pairsize th = (sizef th, th); |
216 fun bfs (news,nprf_heap) = |
216 fun bfs (news,nprf_heap) = |
217 (case partition satp news of |
217 (case List.partition satp news of |
218 ([],nonsats) => next(foldr ThmHeap.insert |
218 ([],nonsats) => next(Library.foldr ThmHeap.insert |
219 (map pairsize nonsats, nprf_heap)) |
219 (map pairsize nonsats, nprf_heap)) |
220 | (sats,_) => some_of_list sats) |
220 | (sats,_) => some_of_list sats) |
221 and next nprf_heap = |
221 and next nprf_heap = |
222 if ThmHeap.is_empty nprf_heap then NONE |
222 if ThmHeap.is_empty nprf_heap then NONE |
223 else |
223 else |
237 (*Breadth-first search to satisfy satpred (including initial state) |
237 (*Breadth-first search to satisfy satpred (including initial state) |
238 SLOW -- SHOULD NOT USE APPEND!*) |
238 SLOW -- SHOULD NOT USE APPEND!*) |
239 fun gen_BREADTH_FIRST message satpred (tac:tactic) = |
239 fun gen_BREADTH_FIRST message satpred (tac:tactic) = |
240 let val tacf = Seq.list_of o tac; |
240 let val tacf = Seq.list_of o tac; |
241 fun bfs prfs = |
241 fun bfs prfs = |
242 (case partition satpred prfs of |
242 (case List.partition satpred prfs of |
243 ([],[]) => [] |
243 ([],[]) => [] |
244 | ([],nonsats) => |
244 | ([],nonsats) => |
245 (message("breadth=" ^ string_of_int(length nonsats)); |
245 (message("breadth=" ^ string_of_int(length nonsats)); |
246 bfs (List.concat (map tacf nonsats))) |
246 bfs (List.concat (map tacf nonsats))) |
247 | (sats,_) => sats) |
247 | (sats,_) => sats) |
273 |
273 |
274 fun THEN_ASTAR tac0 (satp, costf) tac1 = |
274 fun THEN_ASTAR tac0 (satp, costf) tac1 = |
275 let val tf = tracify trace_ASTAR tac1; |
275 let val tf = tracify trace_ASTAR tac1; |
276 fun bfs (news,nprfs,level) = |
276 fun bfs (news,nprfs,level) = |
277 let fun cost thm = (level, costf level thm, thm) |
277 let fun cost thm = (level, costf level thm, thm) |
278 in (case partition satp news of |
278 in (case List.partition satp news of |
279 ([],nonsats) |
279 ([],nonsats) |
280 => next (foldr insert_with_level (map cost nonsats, nprfs)) |
280 => next (Library.foldr insert_with_level (map cost nonsats, nprfs)) |
281 | (sats,_) => some_of_list sats) |
281 | (sats,_) => some_of_list sats) |
282 end and |
282 end and |
283 next [] = NONE |
283 next [] = NONE |
284 | next ((level,n,prf)::nprfs) = |
284 | next ((level,n,prf)::nprfs) = |
285 (if !trace_ASTAR |
285 (if !trace_ASTAR |