forked from ProofGeneral/PG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproof-config.el
2017 lines (1644 loc) · 76.1 KB
/
proof-config.el
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; proof-config.el --- Proof General configuration for proof assistant
;; This file is part of Proof General.
;; Portions © Copyright 1994-2012 David Aspinall and University of Edinburgh
;; Portions © Copyright 2003-2021 Free Software Foundation, Inc.
;; Portions © Copyright 2001-2017 Pierre Courtieu
;; Portions © Copyright 2010, 2016 Erik Martin-Dorel
;; Portions © Copyright 2011-2013, 2016-2017 Hendrik Tews
;; Portions © Copyright 2015-2017 Clément Pit-Claudel
;; Author: David Aspinall <[email protected]> and others
;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary:
;;
;; This file declares all prover-specific configuration variables for
;; Proof General. The variables are used variously by the proof
;; script mode and the proof shell mode, menus, and toolbar.
;;
;; To customize Proof General for a new proof assistant, you
;; should read this file carefully!
;;
;; 1. Menus, user-level commands, toolbar
;; 2. Script mode configuration
;; 3. Shell mode configuration
;; 3a. commands
;; 3b. regexps
;; 3c. tokens
;; 3d. hooks and others
;; 4. Goals buffer configuration
;;
;; The remaining variables in should be set for each proof assistant.
;; You don't need to set every variable for basic functionality;
;; consult the manual for details of which ones are important.
;;
;; Customization groups and structure (sections in brackets)
;;
;; proof-general : Overall group
;; proof-user-options : User options for Proof General
;; (see proof-useropts.el)
;; <ProverName> : User options for proof assistant
;; (see pg-custom.el)
;; <ProverName->-internals : Internal settings for proof assistant
;; (see pg-custom.el)
;;
;; proof-general-internals : Internal settings of Proof General
;; prover-config : Configuration for proof assistant (1)
;; proof-script : settings for proof script mode (2)
;; proof-shell : settings for proof shell mode (3)
;; proof-goals : settings for goals buffer (4)
;; <Prover name>-config : Specific internal settings for a prover
;;
;; ======================================================================
;;
;; Developer notes:
;;
;; i. When adding a new configuration variable, please
;; (a) put it in the right customize group, and
;; (b) add a magical comment in ProofGeneral.texi/PG-adapting.texi
;;
;; ii. Presently the customize library seems a bit picky over the
;; :type property and some correct but complex types don't work:
;; If the type is ill-formed, editing the whole group will be
;; broken. Check after updates, by killing all customize buffers
;; and invoking customize-group
;;
;;
;; See also:
;;
;; pg-custom.el
;; pg-vars.el
;;; Code:
(require 'proof-useropts) ; user options
(require 'proof-faces) ; user options: faces
(eval-when-compile
(require 'custom))
;;
;; Prelude
;;
(defgroup prover-config nil
"Configuration of Proof General for the prover in use."
:group 'proof-general-internals
:prefix "proof-")
;; The variables in the "prover-config" (NB: not "proof config"!!)
;; customize group are those which are intended to be set by the
;; prover specific elisp, i.e. constants set on a per-prover basis.
;; Putting these in a customize group is useful for documenting this
;; type of variable, and for developing a new instantiation of Proof
;; General. But it is *not* useful for final user-level
;; customization! The reason is that saving these customizations
;; across a session is not liable to work, because the prover specific
;; elisp usually overrides with a series of setq's in
;; <assistant>-mode-config type functions. This is why prover-config
;; appears under the proof-general-internal group.
(defcustom proof-guess-command-line nil
"Function to guess command line for proof assistant, given a filename.
The function could take a filename as argument, run `make -n' to see
how to compile the file non-interactively, then translate the result
into an interactive invocation of the proof assistant with the same
command line options. For an example, see coq/coq.el."
:type 'function
:group 'prover-config)
;;
;; 1. Configuration for menus, user-level commands, toolbar, etc.
;;
(defcustom proof-assistant-home-page ""
"Web address for information on proof assistant.
Used for Proof General's help menu."
:type 'string
:group 'prover-config)
(defcustom proof-context-command nil
"Command to display the context in proof assistant."
:type 'string
:group 'prover-config)
(defcustom proof-info-command nil
"Command to ask for help or information in the proof assistant.
String or fn. If a string, the command to use.
If a function, it should return the command string to insert."
:type '(choice string function)
:group 'prover-config)
(defcustom proof-showproof-command nil
"Command to display proof state in proof assistant."
:type 'string
:group 'prover-config)
(defcustom proof-goal-command nil
"Command to set a goal in the proof assistant. String or fn.
If a string, the format character `%s' will be replaced by the
goal string.
If a function, it should return the command string to insert."
:type '(choice string function)
:group 'prover-config)
(defcustom proof-save-command nil
"Command to save a proved theorem in the proof assistant. String or fn.
If a string, the format character `%s' will be replaced by the
theorem name.
If a function, it should return the command string to insert."
:type '(choice string function)
:group 'prover-config)
(defcustom proof-find-theorems-command nil
"Command to search for a theorem containing a given term. String or fn.
If a string, the format character `%s' will be replaced by the term.
If a function, it should return the command string to send."
:type '(choice string function)
:group 'prover-config)
(defcustom proof-query-identifier-command nil
"Command sent to the prover to query about a given identifier (or string).
This is typically a command used to print a theorem, constant, or whatever.
Inside the command the string %s is replaced by the given identifier or
string.
Value should be a string for a single command, or maybe an association
list between values for `proof-buffer-syntactic-context' and strings,
which allows different prover commands to be sent based on the syntactic
context of the string.
If value is an alist, must include a default value for no context (nil)."
:type '(or string (list (cons (choice 'nil 'string 'comment) string)))
:group 'proof-shell)
(defcustom proof-assistant-true-value "true"
"String for true values in proof assistant, used for setting flags.
Default is the string \"true\"."
:type 'string
:group 'prover-config)
(defcustom proof-assistant-false-value "false"
"String for false values in proof assistant, used for setting flags.
Default is the string \"false\"."
:type 'string
:group 'prover-config)
(defcustom proof-assistant-format-int-fn 'int-to-string
"Function for converting integer values to ints in proof assistant.
Used for configuring settings in proof assistant.
Default is `int-to-string'."
:type 'function
:group 'prover-config)
(defcustom proof-assistant-format-float-fn 'number-to-string
"Function for converting float values to ints in proof assistant.
Used for configuring settings in proof assistant.
Default is `number-to-string'."
:type 'function
:group 'prover-config)
(defcustom proof-assistant-format-string-fn (lambda (value) value)
"Function for converting string values to strings in proof assistant.
Used for configuring settings in proof assistant.
Default is the identity function."
:type 'string
:group 'prover-config)
(defcustom proof-assistant-setting-format nil
"Function for formatting setting strings for proof assistant.
Setting strings are calculated by replacing a format character
%b, %i, %f, %s, or %l in the :setting string in for each variable
defined with `defpacustom', using the current value of that variable.
This function is applied as a final step to do any extra markup, or
conversion, etc. (No changes are done if nil)."
:type '(choice string (const nil))
:group 'prover-config)
(defcustom proof-tree-configured nil
"Whether external proof-tree display is configured.
This boolean enables the proof-tree menu entry and the function
that starts external proof-tree display."
:type 'boolean
:group 'proof-tree-internals)
;;
;; 2. Configuration for proof script mode
;;
;;
;; The following variables should be set before proof-config-done
;; is called. These configure the mode for the script buffer,
;; including highlighting, etc.
;;
(defgroup proof-script nil
"Proof General configuration of scripting buffer mode."
:group 'prover-config
:prefix "proof-")
(defcustom proof-terminal-string nil
"String that terminates commands sent to prover; nil if none.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands', `proof-script-command-end-regexp',
`proof-script-command-start-regexp', `proof-terminal-string',
or `proof-script-parse-function'."
:type 'character
:group 'prover-config)
(defcustom proof-electric-terminator-noterminator nil
"If non-nil, electric terminator does not actually insert a terminator."
:type 'boolean
:group 'prover-config)
(defcustom proof-script-sexp-commands nil
"Non-nil if script has Lisp-like syntax: commands are top-level sexps.
You should set this variable in script mode configuration.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands', `proof-script-command-end-regexp',
`proof-script-command-start-regexp', `proof-terminal-string',
or `proof-script-parse-function'."
:type 'boolean
:group 'prover-config)
(defcustom proof-script-command-end-regexp nil
"Regular expression which matches end of commands in proof script.
You should set this variable in script mode configuration.
The end of the command is considered to be the end of the match
of this regexp. The regexp may include a nested group, which
can be used to recognize the start of the following command
\(or white space). If there is a nested group, the end of the
command is considered to be the start of the nested group,
i.e. (match-beginning 1), rather than (match-end 0).
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands', `proof-script-command-end-regexp',
`proof-script-command-start-regexp', `proof-terminal-string',
or `proof-script-parse-function'."
:type 'string
:group 'prover-config)
(defcustom proof-script-command-start-regexp nil
"Regular expression which matches start of commands in proof script.
You should set this variable in script mode configuration.
To configure command recognition properly, you must set at least one
of these: `proof-script-sexp-commands', `proof-script-command-end-regexp',
`proof-script-command-start-regexp', `proof-terminal-string',
or `proof-script-parse-function'."
:type 'string
:group 'prover-config)
(defcustom proof-script-integral-proofs nil
"Whether the complete text after a goal confines the actual proof.
In structured proof languages like Isabelle/Isar a theorem is
established by a goal statement (with full information about the
result, including name and statement), followed by a self-contained
piece of text for the proof. The latter should be treated as an
integral entity for purposes of hiding proof bodies etc.
This variable is better set to nil for tactical provers (like Coq)
where important information about the result is spread over the
initial ``goal'' and the final ``save'' command."
:type 'boolean
:group 'prover-config)
(defcustom proof-script-fly-past-comments nil
"*If non-nil, fly past successive comments, coalescing into single spans."
:type 'boolean
:group 'proof-user-options)
(defcustom proof-script-parse-function nil
"A function which parses a portion of the proof script.
It is called with the proof script as the current buffer, and
point the position where the parse should begin. It should
move point to the exact end of the next \"segment\", and return
a symbol indicating what has been parsed:
'comment for a comment
'cmd for a proof script command
nil if there is no complete next segment in the buffer
If this is left unset, it will be configured automatically to
a generic function according to which of `proof-terminal-string'
and its friends are set."
:type 'string
:group 'prover-config)
(defcustom proof-script-comment-start ""
"String which starts a comment in the proof assistant command language.
The script buffer's `comment-start' is set to this string plus a space.
Moreover, comments are usually ignored during script management, and not
sent to the proof process.
You should set this variable for reliable working of Proof General,
as well as `proof-script-comment-end'."
:type 'string
:group 'proof-script)
(defcustom proof-script-comment-start-regexp nil
"Regexp which matches a comment start in the proof command language.
The default value for this is set as (regexp-quote `proof-script-comment-start')
but you can set this variable to something else more precise if necessary."
:type 'string
:group 'proof-script)
(defcustom proof-script-comment-end ""
"String which ends a comment in the proof assistant command language.
Should be an empty string if comments are terminated by `end-of-line'
The script buffer's `comment-end' is set to a space plus this string,
if it is non-empty.
See also `proof-script-comment-start'.
You should set this variable for reliable working of Proof General."
:type 'string
:group 'proof-script)
(defcustom proof-script-comment-end-regexp nil
"Regexp which matches a comment end in the proof command language.
The default value for this is set as (regexp-quote `proof-script-comment-end')
but you can set this variable to something else more precise if necessary."
:type 'string
:group 'proof-script)
(defcustom proof-string-start-regexp "\""
"Matches the start of a quoted string in the proof assistant command language."
:type 'string
:group 'proof-script)
(defcustom proof-string-end-regexp "\""
"Matches the end of a quoted string in the proof assistant command language."
:type 'string
:group 'proof-script)
(defcustom proof-case-fold-search nil
"Value for `case-fold-search' when recognizing portions of proof scripts.
Also used for completion, via `proof-script-complete'.
The default value is nil. If your prover has a case *insensitive*
input syntax, `proof-case-fold-search' should be set to t instead.
NB: This setting is not used for matching output from the prover."
:type 'boolean :group
'proof-script)
(defcustom proof-save-command-regexp nil
"Matches a save command."
:type 'regexp
:group 'proof-script)
(defcustom proof-show-proof-diffs-regexp nil
"Matches all \"Show Proof\" forms (specific to the Coq prover)."
:type 'regexp
:group 'proof-script)
(defcustom proof-save-with-hole-regexp nil
"Regexp which matches a command to save a named theorem.
The name of the theorem is built from the variable
`proof-save-with-hole-result' using the same convention as
`query-replace-regexp'.
Used for setting names of goal..save and proof regions.
It's safe to leave this setting as nil."
:type 'regexp
:group 'proof-script)
(defcustom proof-save-with-hole-result 2
"How to get theorem name after ‘proof-save-with-hole-regexp’ match.
String or Int.
If an int N, use ‘match-string’ to get the value of the Nth parenthesis matched.
If a string, use ‘replace-match’. In this case, ‘proof-save-with-hole-regexp’
should match the entire command."
:type '(choice string integer)
:group 'proof-script)
;; FIXME: unify uses so that proof-anchor-regexp works sensibly
(defcustom proof-goal-command-regexp nil
"Matches a goal command in the proof script.
This is used to make the default value for `proof-goal-command-p',
used as an important part of script management to find the start
of an atomic undo block."
:type 'regexp
:group 'proof-script)
(defcustom proof-goal-with-hole-regexp nil
"Regexp which matches a command used to issue and name a goal.
The name of the theorem is built from the variable
`proof-goal-with-hole-result' using the same convention as
for `query-replace-regexp'.
Used for setting names of goal..save regions and for default
configuration of other modes (function menu, imenu).
It's safe to leave this setting as nil."
:type 'regexp
:group 'proof-script)
(defcustom proof-goal-with-hole-result 2
"How to get theorem name after `proof-goal-with-hole-regexp' match.
String or Int.
If an int N, use `match-string' to get the value of the Nth parenthesis matched.
If a string, use `replace-match'. In this case, `proof-goal-with-hole-regexp'
should match the entire command."
:type '(choice string integer)
:group 'proof-script)
(defcustom proof-non-undoables-regexp nil
"Regular expression matching commands which are *not* undoable.
These are commands which should not appear in proof scripts,
for example, undo commands themselves (if the proof assistant
cannot \"redo\" an \"undo\").
Used in default functions `proof-generic-state-preserving-p'
and `proof-generic-count-undos'. If you don't use those,
may be left as nil."
:type '(choice (const nil) regexp)
:group 'proof-script)
(defcustom proof-nested-undo-regexp nil
"Regexp for commands that must be counted in nested goal-save regions.
Used for provers which allow nested atomic goal-saves, but with some
nested history that must be undone specially.
At the moment, the behaviour is that a goal-save span has a 'nestedundos
property which is set to the number of commands within it which match
this regexp. The idea is that the prover-specific code can create a
customized undo command to retract the goal-save region, based on the
'nestedundos setting. Coq uses this to forget declarations, since
declarations in Coq reside in a separate context with its own (flat)
history."
:type '(choice (const nil) regexp)
:group 'proof-script)
(defcustom proof-ignore-for-undo-count nil
"Matcher for script commands to be ignored in undo count.
May be left as nil, in which case it will be set to
`proof-non-undoables-regexp'.
Used in default function `proof-generic-count-undos'."
:type '(choice (const nil) regexp function)
:group 'proof-script)
(defcustom proof-script-imenu-generic-expression nil
"Regular expressions to help find definitions and proofs in a script.
Value for `imenu-generic-expression', see documentation of Imenu
and that variable for details."
:type 'sexp
:group 'proof-script)
;; FIXME da: unify this with proof-save-command-regexp, to allow fn or regexp
(defcustom proof-goal-command-p 'proof-generic-goal-command-p
"A function to test: is this really a goal command span?
This is added as a more refined addition to `proof-goal-command-regexp',
to solve the problem that Coq and some other provers can have goals which
look like definitions, etc. (In the future we may generalize
`proof-goal-command-regexp' instead)."
:type 'function
:group 'proof-script)
;; FIXME da: unify this with proof-save-command-regexp, to allow fn or regexp
(defcustom proof-really-save-command-p (lambda (span cmd) t)
"Is this really a save command?
This is a more refined addition to `proof-save-command-regexp'.
It should be a function taking a span and command as argument,
and can be used to track nested proofs."
:type 'function
:group 'proof-script)
(defcustom proof-completed-proof-behaviour nil
"Indicates how Proof General treats commands beyond the end of a proof.
Normally goal...save regions are \"closed\", i.e. made atomic for undo.
But once a proof has been completed, there may be a delay before
the \"save\" command appears --- or it may not appear at all. Unless
nested proofs are supported, this can spoil the undo-behaviour in
script management since once a new goal arrives the old undo history
may be lost in the prover. So we allow Proof General to close
off the goal..[save] region in more flexible ways.
The possibilities are:
nil - nothing special; close only when a save arrives
'closeany - close as soon as the next command arrives, save or not
'closegoal - close when the next \"goal\" command arrives
'extend - keep extending the closed region until a save or goal.
If your proof assistant allows nested goals, it will be wrong to close
off the portion of proof so far, so this variable should be set to nil.
NB: 'extend behaviour is not currently compatible with appearance of
save commands, so don't use that if your prover has save commands."
:type '(choice
(const :tag "Close on save only" nil)
(const :tag "Close next command" closeany)
(const :tag "Close next goal" closegoal)
(const :tag "Extend" ignore))
:group 'proof-script)
(defcustom proof-count-undos-fn 'proof-generic-count-undos
"Function to calculate a list of commands to undo to reach a target span.
The function takes a span as an argument, and should return a string
which is the command to undo to the target span. The target is
guaranteed to be within the current (open) proof.
This is an important function for script management.
The default setting `proof-generic-count-undos' is based on the
settings `proof-non-undoables-regexp' and
`proof-non-undoables-regexp'."
:type 'function
:group 'proof-script)
(defcustom proof-find-and-forget-fn 'proof-generic-find-and-forget
"Function to return list of commands to forget to before its argument span.
This setting is used to for retraction (undoing) in proof scripts.
It should undo the effect of all settings between its target span
up to (proof-unprocessed-begin). This may involve forgetting a number
of definitions, declarations, or whatever.
If return value is nil, it means there is nothing to do.
This is an important function for script management.
Study one of the existing instantiations for examples of how to write it,
or leave it set to the default function `proof-generic-find-and-forget'
\(which see)."
:type 'function
:group 'proof-script)
(defcustom proof-forget-id-command nil
"Command to forget back to a given named span.
A string; `%s' will be replaced by the name of the span.
This is only used in the implementation of `proof-generic-find-and-forget',
you only need to set if you use that function (by not customizing
`proof-find-and-forget-fn'."
:type 'string
:group 'proof-script)
(defcustom pg-topterm-goalhyplit-fn nil
"Function to return cons if point is at a goal/hypothesis/literal.
This is used to parse the proofstate output to mark it up for
proof-by-pointing or literal command insertion. It should return a cons or nil.
First element of the cons is a symbol, 'goal', 'hyp' or 'lit'.
The second element is a string: the goal, hypothesis, or literal command itself.
If you leave this variable unset, no proof-by-pointing markup
will be attempted."
:type '(choice function (const nil))
:group 'proof-script)
(defcustom proof-kill-goal-command nil
"Command to kill the currently open goal.
If this is set to nil, PG will expect `proof-find-and-forget-fn'
to do all the work of retracting to an arbitrary point in a file.
Otherwise, the generic split-phase mechanism will be used:
1. If inside an unclosed proof, use `proof-count-undos'.
2. If retracting to before an unclosed proof, use
`proof-kill-goal-command', followed by `proof-find-and-forget-fn'
if necessary."
:type 'string
:group 'proof-script)
(defcustom proof-undo-n-times-cmd nil
"Command to undo n steps of the currently open goal.
String or function.
If this is set to a string, `%s' will be replaced by the number of
undo steps to issue.
If this is set to a function, it should return a list of
the appropriate commands (given the number of undo steps).
This setting is used for the default `proof-generic-count-undos'.
If you set `proof-count-undos-fn' to some other function, there is no
need to set this variable."
:type '(or string function)
:group 'proof-script)
(defcustom proof-nested-goals-history-p nil
"Whether the prover supports recovery of history for nested proofs.
If it does (non-nil), Proof General will retain history inside
nested proofs.
If it does not, Proof General will amalgamate nested proofs into single
steps within the outer proof."
:type 'boolean
:group 'proof-script)
(defcustom proof-arbitrary-undo-positions nil
"Non-nil if Proof General may undo to arbitrary positions.
The classic behaviour of Proof General is to undo completed
proofs in one step: this design arose because older provers
discarded nested history once proofs were complete. The proof
script engine amalgamates spans for a complete proof (into a
single 'goalsave) to give this effect.
Newer designs keep more state, and may support arbitrary undo
with a file being processed. If this flag is non-nil,
amalgamation will not happen."
:type 'boolean
:group 'proof-script)
(defcustom proof-state-preserving-p 'proof-generic-state-preserving-p
"A predicate, non-nil if its argument (a command) preserves the proof state.
This is a safety-test used by `proof-minibuffer-cmd' to filter out scripting
commands which should be entered directly into the script itself.
The default setting for this function, `proof-generic-state-preserving-p'
tests by negating the match on `proof-non-undoables-regexp'."
:type 'function
:group 'proof-script)
(defcustom proof-activate-scripting-hook nil
"Hook run when a buffer is switched into scripting mode.
The current buffer will be the newly active scripting buffer.
This hook may be useful for synchronizing with the proof
assistant, for example, to switch to a new theory
\(in case that isn't already done by commands in the proof
script).
When functions in this hook are called, the variable
`activated-interactively' will be non-nil if
`proof-activate-scripting' was called interactively
\(rather than as a side-effect of some other action).
If a hook function sends commands to the proof process,
it should wait for them to complete (so the queue is cleared
for scripting commands), unless activated-interactively is set."
:type '(repeat function)
:group 'proof-script)
(defcustom proof-deactivate-scripting-hook nil
"Hook run when a buffer is switched out of scripting mode.
The current buffer will be the recently scripting buffer.
This hook may be useful for synchronizing with the proof
assistant, for example, to compile a completed file."
:type '(repeat function)
:group 'proof-script)
(defcustom proof-no-fully-processed-buffer nil
"Set to t if buffers should always retract before scripting elsewhere.
Leave at nil if fully processed buffers make sense for the current
proof assistant. If nil the user can choose to fully assert a
buffer when starting scripting in a different buffer. If t there
is only the choice to fully retract the active buffer before
starting scripting in a different buffer. This last behavior is
needed for Coq."
:type 'boolean
:group 'proof-script)
(defcustom proof-omit-proofs-configured nil
"t if the omit proofs feature has been configured by the proof assitant.
See also `proof-omit-proofs-option' or the Proof General manual
for a description of the feature. This option can only be set, if
all of `proof-script-proof-start-regexp',
`proof-script-proof-end-regexp',
`proof-script-definition-end-regexp' and
`proof-script-proof-admit-command' have been configured.
The omit proofs feature skips over opaque proofs in the source
code, admitting the theorems, to speed up processing.
If `proof-omit-proofs-option' is set by the user, all proof
commands in the source following a match of
`proof-script-proof-start-regexp' up to and including the next
match of `proof-script-proof-end-regexp', are omitted (not send
to the proof assistant) and replaced by
`proof-script-proof-admit-command'. If a match for
`proof-script-definition-end-regexp' is found while searching
forward for the proof end or if
`proof-script-cmd-prevents-proof-omission' recognizes a proof
command that prevents proof omission then the current proof (up
to and including the match of
`proof-script-definition-end-regexp' or
`proof-script-proof-end-regexp') is considered to be not opaque
and not omitted, thus all these proof commands _are_ sent to the
proof assistant.
The feature does not work for nested proofs. If a match for
`proof-script-proof-start-regexp' is found before the next match
for `proof-script-proof-end-regexp' or
`proof-script-definition-end-regexp', the search for opaque
proofs immediately stops and all commands following the previous
match of `proof-script-proof-start-regexp' are sent verbatim to
the proof assistant.
All the regular expressions for this feature are matched against
the commands inside proof action items, that is as strings,
without surrounding space."
:type 'boolean
:group 'proof-script)
;; proof-omit-proofs-option is in proof-useropts as user option
(defcustom proof-script-proof-start-regexp nil
"Regular expression for the start of a proof for the omit proofs feature.
See `proof-omit-proofs-configured'."
:type 'regexp
:group 'proof-script)
(defcustom proof-script-proof-end-regexp nil
"Regular expression for the end of an opaque proof for the omit proofs feature.
See `proof-omit-proofs-configured'."
:type 'regexp
:group 'proof-script)
(defcustom proof-script-definition-end-regexp nil
"Regexp for the end of a non-opaque proof for the omit proofs feature.
See `proof-omit-proofs-configured'."
:type 'regexp
:group 'proof-script)
(defcustom proof-script-proof-admit-command nil
"Proof command to be inserted instead of omitted proofs."
:type 'string
:group 'proof-script)
(defcustom proof-script-cmd-prevents-proof-omission nil
"Optional predicate to match commands that prevent omitting the current proof.
If set, this option should contain a function that takes a proof
command (as string) as argument and returns t or nil. If set, the
function is called on every proof command inside a proof while
scanning for proofs to omit. The predicate should return t if the
command has effects ouside the proof, potentially breaking the
script if the current proof is omitted. If the predicate returns
t, the proof is considered to be not opaque and thus not omitted."
:type 'function
:group 'proof-script)
(defcustom proof-script-cmd-force-next-proof-kept nil
"Optional regexp for commands that prevent omitting the next proof.
If set, this option should contain a regular expression that
matches proof-script commands that prevent the omission of proofs
dirctly following this command. When scanning the newly asserted
region for proofs to omit, every proof-script command outside
proofs is matched against this regexp. If it matches and the next
command matches `proof-script-proof-start-regexp' this following
proof will not be omitted.
Note that recognition of commands with this regular expression
does only work if the command and the following proof are
asserted together."
:type 'regexp
:group 'proof-script)
;;
;; Proof script indentation
;;
(defcustom proof-indent 2
"Amount of proof script indentation."
:type 'number
:group 'proof-script)
(defcustom proof-indent-hang nil
"Enable 'hanging' indentation for proof script."
:type 'boolean
:group 'proof-script)
(defcustom proof-indent-enclose-offset 1
"Extra offset for enclosing indentation syntax elements."
:type 'number
:group 'proof-script)
(defcustom proof-indent-open-offset 1
"Extra offset for opening indentation syntax elements."
:type 'number
:group 'proof-script)
(defcustom proof-indent-close-offset 1
"Extra offset for closing indentation syntax elements."
:type 'number
:group 'proof-script)
(defcustom proof-indent-any-regexp "\\s(\\|\\s)"
"Regexp for *any* syntax element guiding proof script indentation."
:type 'string
:group 'proof-script)
(defcustom proof-indent-inner-regexp nil
"Regexp for text within syntax elements of proof script indentation."
:type 'string
:group 'proof-script)
(defcustom proof-indent-enclose-regexp nil
"Regexp for enclosing syntax elements of proof script indentation."
:type 'string
:group 'proof-script)
(defcustom proof-indent-open-regexp "\\s("
"Regexp for opening syntax elements of proof script indentation."
:type 'string
:group 'proof-script)
(defcustom proof-indent-close-regexp "\\s)"
"Regexp for closing syntax elements of proof script indentation."
:type 'string
:group 'proof-script)
(defcustom proof-script-insert-newlines t
"If non-nil, insert a newline between each message in response buffer."
:type 'boolean
:group 'proof-script)
(defcustom proof-script-color-error-messages t
"If non-nil, error messages will be globally colored with corresponding face.
If prover mode has a better coloring mechanism for errors, set this to nil."
:type 'boolean
:group 'proof-script)
(defcustom proof-script-font-lock-keywords nil
"Value of `font-lock-keywords' used to fontify proof scripts.
The proof script mode should set this before calling `proof-config-done'.
Used also by `proof-easy-config' mechanism.
See also `proof-goals-font-lock-keywords' and `proof-response-font-lock-keywords'."
:type 'sexp
:group 'proof-script)
(defcustom proof-script-syntax-table-entries nil
"List of syntax table entries for proof script mode.
A flat list of the form
(CHAR SYNCODE CHAR SYNCODE ...)
See doc of `modify-syntax-entry' for details of characters
and syntax codes.
At present this is used only by the `proof-easy-config' macro."
:type 'sexp
:group 'proof-script)
;;
;; Proof script context menu customization
;;
(defcustom proof-script-span-context-menu-extensions nil
"Extensions for the in-span context sensitive menu.
This should be a function which accepts three arguments: SPAN IDIOM NAME.
See pg-user.el: `pg-create-in-span-context-menu' for more hints."
:type 'function
:group 'proof-script)
;;
;; 3. Configuration for proof shell
;;
;; The variables in this section concern the proof shell mode.
;; The first group of variables are hooks invoked at various points.
;; The second group of variables are concerned with matching the output
;; from the proof assistant.
;;
;; Variables here are put into the customize group 'proof-shell'.
;;
;; These should be set in the shell mode configuration, again,
;; before proof-shell-config-done is called.
;;
(defgroup proof-shell nil
"Settings for output from the proof assistant in the proof shell."
:group 'prover-config
:prefix "proof-shell-")
;;
;; 3a. commands
;;
(defcustom proof-prog-name nil
"System command to run the proof assistant in the proof shell.
May contain arguments separated by spaces, but see also the
prover specific settings `<PA>-prog-args' and `<PA>-prog-env'.
Remark: if `<PA>-prog-args' is non-nil, then `proof-prog-name' is considered
strictly: it must contain *only* the program name with no option, spaces
are interpreted literally as part of the program name."
:type 'string
:group 'proof-shell)
(defcustom proof-shell-auto-terminate-commands t
"Non-nil if Proof General should try to add terminator to every command.
If non-nil, whenever a command is sent to the prover using
`proof-shell-invisible-command', Proof General will check to see if it
ends with `proof-terminal-string', and add it if not.
If `proof-terminal-string' is nil, this has no effect."
:type 'boolean
:group 'proof-shell)
(defcustom proof-shell-pre-sync-init-cmd nil
"The command for configuring the proof process to gain synchronization.
This command is sent before Proof General's synchronization
mechanism is engaged, to allow customization inside the process
to help gain syncrhonization (e.g. engaging special markup).
It is better to configure the proof assistant for this purpose
via command line options if possible, in which case this variable
does not need to be set.
See also `proof-shell-init-cmd'."
:type '(choice string (const nil))
:group 'proof-shell)
(defcustom proof-shell-init-cmd nil
"The command(s) for initially configuring the proof process.
This command is sent to the process as soon as synchronization is gained
\(when an annotated prompt is first recognized). It can be used to configure
the proof assistant in some way, or print a welcome message
\(since output before the first prompt is discarded).
See also `proof-shell-pre-sync-init-cmd'."
:type '(choice (list string) string (const nil))
:group 'proof-shell)
;; TODO: remove proof-shell-init-cmd in favour of this hook
(defcustom proof-shell-init-hook nil
"Hooks run when the proof process has started up."
:type '(list function)
:group 'proof-shell)
(defcustom proof-shell-restart-cmd ""
"A command for re-initialising the proof process."
:type '(choice string (const nil))
:group 'proof-shell)
(defcustom proof-shell-quit-cmd nil
"A command to quit the proof process. If nil, send EOF instead."
:type '(choice string (const nil))
:group 'proof-shell)
(defcustom proof-shell-cd-cmd nil
"Command to the proof assistant to change the working directory.
The format character `%s' is replaced with the directory, and
the escape sequences in `proof-shell-filename-escapes' are
applied to the filename.
This setting is used to define the function `proof-cd' which
changes to the value of (default-directory) for script buffers.
For files, the value of (default-directory) is simply the
directory the file resides in.
NB: By default, `proof-cd' is called from `proof-activate-scripting-hook',
so that the prover switches to the directory of a proof
script every time scripting begins."
:type 'string
:group 'proof-shell)