-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_rollback.py
More file actions
executable file
·57 lines (41 loc) · 874 Bytes
/
Copy pathexample_rollback.py
File metadata and controls
executable file
·57 lines (41 loc) · 874 Bytes
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
#!/bin/env python
USAGE = """
USAGE: example_rollback.py <ADDRESS OF SERVER>
Argument <ADDRESS OF SERVER> is necessary.
This script demonstrates the basic usage of state rollback.
"""
from IsaREPL import Client
import json
import sys
if len(sys.argv) != 2:
print(USAGE)
exit(1)
addr = sys.argv[1]
c = Client(addr, 'HOL')
def pp(x):
print(json.dumps(x, indent=2))
return x
def echo_eval (src):
print('>>> '.join(src.splitlines(True)))
ret = c.silly_eval(src)
return pp(ret)
echo_eval ("""
theory HHH
imports Main
begin
lemma "\<exists>x::nat. x + 1 = 2"
""")
c.record_state("S0")
echo_eval("""
apply (rule exI[where x=666])
""")
c.record_state("S1")
print("Recorded histories:")
pp(c.silly_history())
print("rollback to state S0")
pp(c.silly_rollback ("S0"))
echo_eval("""
by (rule exI[where x=1], auto)
end
""")
c.close()