equal
deleted
inserted
replaced
118 |
118 |
119 val calculationN = "calculation"; |
119 val calculationN = "calculation"; |
120 |
120 |
121 fun calculate final opt_rules print state = |
121 fun calculate final opt_rules print state = |
122 let |
122 let |
|
123 fun err_if b msg = if b then raise Proof.STATE (msg, state) else (); |
123 val fact = Proof.the_fact state; |
124 val fact = Proof.the_fact state; |
124 val rules = Seq.of_list (case opt_rules of None => get_local_rules state | Some thms => thms); |
125 val rules = Seq.of_list (case opt_rules of None => get_local_rules state | Some thms => thms); |
125 val calculations = |
126 val (initial, calculations) = |
126 (case get_calculation state of |
127 (case get_calculation state of |
127 None => Seq.single fact |
128 None => (true, Seq.single fact) |
128 | Some thm => Seq.flat (Seq.map (Method.multi_resolve [thm, fact]) rules)); |
129 | Some thm => (false, Seq.flat (Seq.map (Method.multi_resolve [thm, fact]) rules))); |
129 in |
130 in |
|
131 err_if (initial andalso final) "No calculation yet"; |
|
132 err_if (initial andalso is_some opt_rules) "Initial calculation -- no rules to be given"; |
130 calculations |> Seq.map (fn calc => |
133 calculations |> Seq.map (fn calc => |
131 (print calc; |
134 (print calc; |
132 (if final then |
135 (if final then |
133 state |
136 state |
134 |> reset_calculation |
137 |> reset_calculation |