equal
deleted
inserted
replaced
4 License: GPL (GNU GENERAL PUBLIC LICENSE) |
4 License: GPL (GNU GENERAL PUBLIC LICENSE) |
5 |
5 |
6 Tactic for solving arithmetical Goals in Presburger Arithmetic |
6 Tactic for solving arithmetical Goals in Presburger Arithmetic |
7 *) |
7 *) |
8 |
8 |
9 (* This version of presburger deals with occurences of functional symbols in the subgoal and abstract over them to try to prove the more general formula. It then resolves with the subgoal. To disable this feature call the procedure with the parameter no_abs |
9 (* This version of presburger deals with occurences of functional symbols in the subgoal and abstract over them to try to prove the more general formula. It then resolves with the subgoal. To enable this feature call the procedure with the parameter abs |
10 *) |
10 *) |
11 |
11 |
12 signature PRESBURGER = |
12 signature PRESBURGER = |
13 sig |
13 sig |
14 val presburger_tac : bool -> bool -> int -> tactic |
14 val presburger_tac : bool -> bool -> int -> tactic |
277 end handle Subscript => no_tac st | CooperDec.COOPER => no_tac st); |
277 end handle Subscript => no_tac st | CooperDec.COOPER => no_tac st); |
278 |
278 |
279 fun presburger_args meth = |
279 fun presburger_args meth = |
280 let val parse_flag = |
280 let val parse_flag = |
281 Args.$$$ "no_quantify" >> K (apfst (K false)) |
281 Args.$$$ "no_quantify" >> K (apfst (K false)) |
282 || Args.$$$ "no_abs" >> K (apsnd (K false)); |
282 || Args.$$$ "abs" >> K (apsnd (K true)); |
283 in |
283 in |
284 Method.simple_args |
284 Method.simple_args |
285 (Scan.optional (Args.$$$ "(" |-- Args.list1 parse_flag --| Args.$$$ ")") [] >> |
285 (Scan.optional (Args.$$$ "(" |-- Args.list1 parse_flag --| Args.$$$ ")") [] >> |
286 curry (foldl op |>) (true, true)) |
286 curry (foldl op |>) (true, false)) |
287 (fn (q,a) => fn _ => meth q a 1) |
287 (fn (q,a) => fn _ => meth q a 1) |
288 end; |
288 end; |
289 |
289 |
290 fun presburger_method q a i = Method.METHOD (fn facts => |
290 fun presburger_method q a i = Method.METHOD (fn facts => |
291 Method.insert_tac facts 1 THEN presburger_tac q a i) |
291 Method.insert_tac facts 1 THEN presburger_tac q a i) |
294 [Method.add_method ("presburger", |
294 [Method.add_method ("presburger", |
295 presburger_args presburger_method, |
295 presburger_args presburger_method, |
296 "decision procedure for Presburger arithmetic"), |
296 "decision procedure for Presburger arithmetic"), |
297 ArithTheoryData.map (fn {splits, inj_consts, discrete, presburger} => |
297 ArithTheoryData.map (fn {splits, inj_consts, discrete, presburger} => |
298 {splits = splits, inj_consts = inj_consts, discrete = discrete, |
298 {splits = splits, inj_consts = inj_consts, discrete = discrete, |
299 presburger = Some (presburger_tac true true)})]; |
299 presburger = Some (presburger_tac true false)})]; |
300 |
300 |
301 end; |
301 end; |
302 |
302 |
303 val presburger_tac = Presburger.presburger_tac true true; |
303 val presburger_tac = Presburger.presburger_tac true true; |