-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from aqjune-aws/then1
Add `(un)set_then_multiple_subgoals` to control the behavior of THEN
- Loading branch information
Showing
7 changed files
with
120 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
\DOC unset_jrh_lexer | ||
|
||
\TYPE {unset_jrh_lexer : (preprocessor keyword)} | ||
|
||
\SYNOPSIS | ||
Updates the HOL Light preprocessor to respect OCaml's identifier convention. | ||
|
||
\DESCRIBE | ||
If a preprocessor reads {unset_jrh_lexer}, it switches its lexer to | ||
use OCaml's identifier convention. This makes an identifier starting with a | ||
capiter letter unusable as the name of a let binding, but enables using it as a | ||
module constructor. | ||
Modulo this side effect, {unset_jrh_lexer} is simply identical to {false}. | ||
The lexer can be enabled again using {set_jrh_lexer}, which is identical to | ||
{true} after preprocessing. | ||
|
||
\EXAMPLE | ||
{ | ||
# module OrdInt = struct type t = int let compare = (-) end;; | ||
Toplevel input: | ||
# module OrdInt = struct type t = int let compare = (-) end;; | ||
^^^^^^ | ||
Parse error: 'type' or [ext_attributes] expected after 'module' (in | ||
[str_item]) | ||
# unset_jrh_lexer;; | ||
val it : bool = false | ||
# module OrdInt = struct type t = int let compare = (-) end;; | ||
module OrdInt : sig type t = int val compare : int -> int -> int end | ||
} | ||
|
||
\FAILURE | ||
Never fails. | ||
|
||
\ENDDOC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
\DOC unset_then_multiple_subgoals | ||
|
||
\TYPE {unset_then_multiple_subgoals : (preprocessor keyword)} | ||
|
||
\SYNOPSIS | ||
Updates the HOL Light preprocessor to read {THEN} as an alternative operator | ||
which fails if the first tactic creates more than one subgoal. | ||
|
||
\KEYWORDS | ||
tactical. | ||
|
||
\DESCRIBE | ||
If a preprocessor reads {unset_then_multiple_subgoals}, it starts to translate | ||
{t1 THEN t2} into {then1_ t1 t2} which fails when {t1} generates more than one | ||
subgoal. | ||
This is useful when one wants to check whether a proof written using {THEN} can | ||
be syntactically converted to the `e`-`g` form. | ||
If this setting is on, {t1 THEN t2 THEN ..} and {e(t1);; e(t2);; ...} | ||
have the same meaning (modulo the validity check). | ||
After preprocessing, {unset_then_multiple_subgoals} is identical to the {false} | ||
constant in OCaml. | ||
To roll back the behavior of {THEN}, use {set_then_multiple_subgoals}, | ||
which is identical to {true} modulo its side effect. | ||
|
||
This command is only available for OCaml 4.xx and above. | ||
|
||
\EXAMPLE | ||
{ | ||
# prove(`x + 1 = 1 + x /\ x + 2 = 2 + x`, CONJ_TAC THEN ARITH_TAC);; | ||
val it : thm = |- x + 1 = 1 + x /\ x + 2 = 2 + x | ||
|
||
# unset_then_multiple_subgoals;; | ||
val it : bool = false | ||
# prove(`x + 1 = 1 + x /\ x + 2 = 2 + x`, CONJ_TAC THEN ARITH_TAC);; | ||
Exception: Failure "seqapply: Length mismatch". | ||
# prove(`x + 1 = 1 + x /\ x + 2 = 2 + x`, CONJ_TAC THENL [ARITH_TAC; ARITH_TAC]);; | ||
val it : thm = |- x + 1 = 1 + x /\ x + 2 = 2 + x | ||
# prove(`x + 1 = 1 + x /\ x + 2 = 2 + x`, CONJ_TAC THENL (replicate ARITH_TAC 2));; | ||
val it : thm = |- x + 1 = 1 + x /\ x + 2 = 2 + x | ||
} | ||
|
||
\FAILURE | ||
Never fails. | ||
|
||
\SEEALSO | ||
e, THEN, VALID. | ||
|
||
\ENDDOC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters