-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simp_No_Conditional.thy
64 lines (45 loc) · 2.02 KB
/
Simp_No_Conditional.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*)
theory Simp_No_Conditional
imports Main
begin
text \<open>
Simplification without conditional rewriting. Setting the simplifier depth
limit to zero prevents attempts at conditional rewriting. This should make
the simplifier faster and more predictable on average. It may be particularly
useful in derived tactics and methods to avoid situations where the simplifier
repeatedly attempts and fails a conditional rewrite.
As always, there are caveats. Failing to perform a simple conditional rewrite
may open the door to expensive alternatives. Various simprocs which are
conditional in nature will not be deactivated.
\<close>
ML \<open>
structure Simp_No_Conditional = struct
val set_no_cond = Config.put Raw_Simplifier.simp_depth_limit 0
val simp_tac = Simplifier.simp_tac o set_no_cond
val asm_simp_tac = Simplifier.asm_simp_tac o set_no_cond
val full_simp_tac = Simplifier.full_simp_tac o set_no_cond
val asm_full_simp_tac = Simplifier.asm_full_simp_tac o set_no_cond
val clarsimp_tac = Clasimp.clarsimp_tac o set_no_cond
val auto_tac = Clasimp.auto_tac o set_no_cond
fun mk_method secs tac
= Method.sections secs >> K (SIMPLE_METHOD' o tac)
val mk_clasimp_method = mk_method Clasimp.clasimp_modifiers
fun mk_clasimp_all_method tac =
Method.sections Clasimp.clasimp_modifiers >> K (SIMPLE_METHOD o tac)
val simp_method = mk_method Simplifier.simp_modifiers
(CHANGED_PROP oo asm_full_simp_tac)
val clarsimp_method = mk_clasimp_method (CHANGED_PROP oo clarsimp_tac)
val auto_method = mk_clasimp_all_method (CHANGED_PROP o auto_tac)
end
\<close>
method_setup simp_no_cond = \<open>Simp_No_Conditional.simp_method\<close>
"Simplification with no conditional simplification."
method_setup clarsimp_no_cond = \<open>Simp_No_Conditional.clarsimp_method\<close>
"Clarsimp with no conditional simplification."
method_setup auto_no_cond = \<open>Simp_No_Conditional.auto_method\<close>
"Auto with no conditional simplification."
end