equal
deleted
inserted
replaced
107 (filter_used_facts used_facts seen, result) |
107 (filter_used_facts used_facts seen, result) |
108 | _ => sublinear_minimize test xs (x :: seen, result) |
108 | _ => sublinear_minimize test xs (x :: seen, result) |
109 |
109 |
110 fun binary_minimize test xs = |
110 fun binary_minimize test xs = |
111 let |
111 let |
112 fun p xs = #outcome (test xs : prover_result) = NONE |
112 fun pred xs = #outcome (test xs : prover_result) = NONE |
113 fun split [] p = p |
113 fun split [] p = p |
114 | split [h] (l, r) = (h :: l, r) |
114 | split [h] (l, r) = (h :: l, r) |
115 | split (h1 :: h2 :: t) (l, r) = split t (h1 :: l, h2 :: r) |
115 | split (h1 :: h2 :: t) (l, r) = split t (h1 :: l, h2 :: r) |
116 fun min _ _ [] = raise Empty |
116 fun min _ _ [] = raise Empty |
117 | min _ _ [s0] = [s0] |
117 | min _ _ [s0] = [s0] |
122 n_facts (map fst sup) ^ " and " ^ |
122 n_facts (map fst sup) ^ " and " ^ |
123 n_facts (map fst xs))) |
123 n_facts (map fst xs))) |
124 *) |
124 *) |
125 val (l0, r0) = split xs ([], []) |
125 val (l0, r0) = split xs ([], []) |
126 in |
126 in |
127 if p (sup @ l0) then |
127 if pred (sup @ l0) then |
128 min (depth + 1) sup l0 |
128 min (depth + 1) sup l0 |
129 else if p (sup @ r0) then |
129 else if pred (sup @ r0) then |
130 min (depth + 1) sup r0 |
130 min (depth + 1) sup r0 |
131 else |
131 else |
132 let |
132 let |
133 val l = min (depth + 1) (sup @ r0) l0 |
133 val l = min (depth + 1) (sup @ r0) l0 |
134 val r = min (depth + 1) (sup @ l) r0 |
134 val r = min (depth + 1) (sup @ l) r0 |
137 (* |
137 (* |
138 |> tap (fn _ => warning (replicate_string depth " " ^ "}")) |
138 |> tap (fn _ => warning (replicate_string depth " " ^ "}")) |
139 *) |
139 *) |
140 val xs = |
140 val xs = |
141 case min 0 [] xs of |
141 case min 0 [] xs of |
142 [x] => if p [] then [] else [x] |
142 [x] => if pred [] then [] else [x] |
143 | xs => xs |
143 | xs => xs |
144 in (xs, test xs) end |
144 in (xs, test xs) end |
145 |
145 |
146 (* Give the external prover some slack. The ATP gets further slack because the |
146 (* Give the external prover some slack. The ATP gets further slack because the |
147 Sledgehammer preprocessing time is included in the estimate below but isn't |
147 Sledgehammer preprocessing time is included in the estimate below but isn't |