|
1 (* Title: Pure/ProofGeneral/preferences.ML |
|
2 ID: $Id$ |
|
3 Author: David Aspinall and Markus Wenzel |
|
4 |
|
5 User preferences for Isabelle which are maintained by the interface. |
|
6 *) |
|
7 |
|
8 signature PREFERENCES = |
|
9 sig |
|
10 type pgiptype = PgipTypes.pgiptype |
|
11 |
|
12 type isa_preference = { name: string, |
|
13 descr: string, |
|
14 default: string, |
|
15 pgiptype: pgiptype, |
|
16 get: unit -> string, |
|
17 set: string -> unit } |
|
18 |
|
19 val preferences : (string * isa_preference list) list |
|
20 end |
|
21 |
|
22 structure Preferences : PREFERENCES = |
|
23 struct |
|
24 |
|
25 val thm_depsN = "thm_deps"; (* also in proof_general_pgip.ML: move to pgip_isabelle? *) |
|
26 |
|
27 type pgiptype = PgipTypes.pgiptype |
|
28 |
|
29 type isa_preference = { name: string, |
|
30 descr: string, |
|
31 default: string, |
|
32 pgiptype: pgiptype, |
|
33 get: unit -> string, |
|
34 set: string -> unit } |
|
35 |
|
36 |
|
37 fun mkpref get set typ nm descr = |
|
38 { name=nm, descr=descr, pgiptype=typ, get=get, set=set, default=get() } : isa_preference |
|
39 |
|
40 fun mkpref_from_ref read write typ r nm descr = |
|
41 mkpref (fn()=> read (!r)) (fn v=> r:= (write v)) typ nm descr |
|
42 |
|
43 val int_pref = |
|
44 mkpref_from_ref PgipTypes.int_to_pgstring (PgipTypes.read_pgipint (NONE,NONE)) |
|
45 (PgipTypes.Pgipint (NONE, NONE)) |
|
46 val nat_pref = |
|
47 mkpref_from_ref PgipTypes.int_to_pgstring PgipTypes.read_pgipnat PgipTypes.Pgipnat |
|
48 |
|
49 val bool_pref = |
|
50 mkpref_from_ref PgipTypes.bool_to_pgstring PgipTypes.read_pgipbool PgipTypes.Pgipbool |
|
51 |
|
52 val proof_pref = |
|
53 let |
|
54 fun get () = PgipTypes.bool_to_pgstring (! proofs >= 2) |
|
55 fun set s = proofs := (if (PgipTypes.read_pgipbool s) then 1 else 2) |
|
56 in |
|
57 mkpref get set PgipTypes.Pgipbool "full-proofs" |
|
58 "Record full proof objects internally" |
|
59 end |
|
60 |
|
61 val thm_deps_pref = |
|
62 let |
|
63 fun get () = PgipTypes.bool_to_pgstring (Output.has_mode thm_depsN) |
|
64 fun set s = if (PgipTypes.read_pgipbool s) then |
|
65 change print_mode (insert (op =) thm_depsN) |
|
66 else |
|
67 change print_mode (remove (op =) thm_depsN) |
|
68 in |
|
69 mkpref get set PgipTypes.Pgipbool "theorem-dependencies" |
|
70 "Track theorem dependencies within Proof General" |
|
71 end |
|
72 |
|
73 val print_depth_pref = |
|
74 let |
|
75 val pg_print_depth_val = ref 10 |
|
76 fun get () = PgipTypes.int_to_pgstring (! pg_print_depth_val) |
|
77 fun setn n = (print_depth n; pg_print_depth_val := n) |
|
78 val set = setn o PgipTypes.read_pgipnat |
|
79 in |
|
80 mkpref get set PgipTypes.Pgipbool "print-depth" "Setting for the ML print depth" |
|
81 end |
|
82 |
|
83 |
|
84 val display_preferences = |
|
85 [bool_pref show_types |
|
86 "show-types" |
|
87 "Include types in display of Isabelle terms", |
|
88 bool_pref show_sorts |
|
89 "show-sorts" |
|
90 "Include sorts in display of Isabelle terms", |
|
91 bool_pref show_consts |
|
92 "show-consts" |
|
93 "Show types of consts in Isabelle goal display", |
|
94 bool_pref long_names |
|
95 "long-names" |
|
96 "Show fully qualified names in Isabelle terms", |
|
97 bool_pref show_brackets |
|
98 "show-brackets" |
|
99 "Show full bracketing in Isabelle terms", |
|
100 bool_pref Proof.show_main_goal |
|
101 "show-main-goal" |
|
102 "Show main goal in proof state display", |
|
103 bool_pref Syntax.eta_contract |
|
104 "eta-contract" |
|
105 "Print terms eta-contracted"] |
|
106 |
|
107 val advanced_display_preferences = |
|
108 [nat_pref goals_limit |
|
109 "goals-limit" |
|
110 "Setting for maximum number of goals printed", |
|
111 int_pref ProofContext.prems_limit |
|
112 "prems-limit" |
|
113 "Setting for maximum number of premises printed", |
|
114 print_depth_pref, |
|
115 bool_pref show_question_marks |
|
116 "show-question-marks" |
|
117 "Show leading question mark of variable name"] |
|
118 |
|
119 val tracing_preferences = |
|
120 [bool_pref trace_simp |
|
121 "trace-simplifier" |
|
122 "Trace simplification rules.", |
|
123 nat_pref trace_simp_depth_limit |
|
124 "trace-simplifier-depth" |
|
125 "Trace simplifier depth limit.", |
|
126 bool_pref trace_rules |
|
127 "trace-rules" |
|
128 "Trace application of the standard rules", |
|
129 bool_pref Pattern.trace_unify_fail |
|
130 "trace-unification" |
|
131 "Output error diagnostics during unification", |
|
132 bool_pref Output.timing |
|
133 "global-timing" |
|
134 "Whether to enable timing in Isabelle.", |
|
135 bool_pref Output.show_debug_msgs |
|
136 "debug-messages" |
|
137 "Whether to show debugging messages."] |
|
138 |
|
139 val proof_preferences = |
|
140 [bool_pref quick_and_dirty |
|
141 "quick-and-dirty" |
|
142 "Take a few short cuts", |
|
143 bool_pref Toplevel.skip_proofs |
|
144 "skip-proofs" |
|
145 "Ignore proof scripts (interactive-only)"] |
|
146 |
|
147 val preferences = |
|
148 [("Display", display_preferences), |
|
149 ("Advanced Display", advanced_display_preferences), |
|
150 ("Tracing", tracing_preferences), |
|
151 ("Proof", proof_preferences)] |
|
152 |
|
153 end |