Skip to content

Commit

Permalink
README section for incrementality
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Mar 13, 2024
1 parent 452f848 commit b909745
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,41 @@ Example output:

showing any messages generated, and sorries with their goal states.

### Incrementality

The REPL now has experimental support for incrementality in command mode.
If you send two commands which use the same environment,
the second command will automatically use snapshots of the elaboration of the tactics in the first command.

That is, if you send
```json
{ "cmd" : "def f := by expensive_tactic; cheap_tactic" }
{ "cmd" : "def f := by expensive_tactic; other_cheap_tactic" }
```
then the second command should be fast!

By default the REPL tries to use the most recent available snapshot generated from the starting environment.
It is also possible to control this explicitly, using the `incr` field.
This should refer to the *result* environment for the tactic elaboration you would like to use.

Thus in
```json
{ "cmd" : "import Mathlib" }
{ "cmd" : "def f := by expensive_tactic; done", "env" : 0 }
{ "cmd" : "def f := by sorry", "env" : 0 }
{ "cmd" : "def f := by expensive_tactic; done", "env" : 0 }
```
both invocations of `expensive_tactic` will be slow.

However, if the first `def f` command returned `{"env" : 1}`, then we can use
```json
{ "cmd" : "import Mathlib" }
{ "cmd" : "def f := by expensive_tactic; done", "env" : 0 }
{ "cmd" : "def f := by sorry", "env" : 0 }
{ "cmd" : "def f := by expensive_tactic; done", "env" : 0, "incr" : 1 }
```
and then the second invocation of `expensive_tactic` will be fast again.

## Tactic mode (experimental)

To enter tactic mode issue a command containing a `sorry`,
Expand Down

0 comments on commit b909745

Please sign in to comment.