Update README.md
Browse files
README.md
CHANGED
|
@@ -4,12 +4,18 @@ license: mit
|
|
| 4 |
|
| 5 |
# PVSGym: A Proof Learning Environment
|
| 6 |
|
| 7 |
-
Paper
|
| 8 |
|
| 9 |
-
This
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
pvs_sft5
|
| 14 |
βββ config.json
|
| 15 |
βββ generation_config.json
|
|
@@ -25,11 +31,17 @@ pvs_sft5
|
|
| 25 |
βββ training_args.bin
|
| 26 |
```
|
| 27 |
|
| 28 |
-
|
| 29 |
-
(Implementaion details ( recommend function) here https://huggingface.co/ma7583/pvs_oracle/blob/main/sft_fastapi.py )
|
| 30 |
|
|
|
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
Current Sequent:
|
| 34 |
[1] norm((# x := -1, y := 0 #)) = 1
|
| 35 |
|
|
@@ -39,7 +51,7 @@ Prev Command 3: (HIDE-ALL-BUT 1)
|
|
| 39 |
Next Command:
|
| 40 |
```
|
| 41 |
|
| 42 |
-
```
|
| 43 |
Current Sequent:
|
| 44 |
{1} expt(c, (3 + 4 * n)) = expt(c, (1 + 4 * n)) * expt(c, 2)
|
| 45 |
|
|
@@ -47,10 +59,9 @@ Prev Command 1: (PROPAX)
|
|
| 47 |
Prev Command 2: (HIDE 2)
|
| 48 |
Prev Command 3: (EXPAND "^")
|
| 49 |
Next Command:
|
| 50 |
-
|
| 51 |
```
|
| 52 |
|
| 53 |
-
```
|
| 54 |
Current Sequent:
|
| 55 |
[-1] derivable?(sin, x!1) AND derivable?(sin, x!1) IMPLIES deriv(sin * sin, x!1) = 2 * (deriv(sin, x!1) * sin(x!1))
|
| 56 |
[-2] derivable?[real](sin * sin, x!1)
|
|
@@ -63,10 +74,9 @@ Prev Command 1: (ASSERT)
|
|
| 63 |
Prev Command 2: (EXPAND "derivable?" -4)
|
| 64 |
Prev Command 3: (EXPAND "derivable?" -5)
|
| 65 |
Next Command:
|
| 66 |
-
|
| 67 |
```
|
| 68 |
|
| 69 |
-
```
|
| 70 |
Current Sequent:
|
| 71 |
[1] FORALL (x: real): LET S = LAMBDA (n: nat): powerseq(cos_coef, x)(2 * n) IN conv_series?(S) AND cos(x) = inf_sum(S)
|
| 72 |
|
|
@@ -74,24 +84,21 @@ Prev Command 1: (ASSERT)
|
|
| 74 |
Prev Command 2: (ASSERT)
|
| 75 |
Prev Command 3: (HIDE 2)
|
| 76 |
Next Command:
|
| 77 |
-
|
| 78 |
```
|
| 79 |
|
| 80 |
-
|
| 81 |
Current Sequent:
|
| 82 |
{-1} FORALL (a: {x: real | 0 < x AND x <= pi / 2}): sin(a) > 0
|
| 83 |
[-2] a <= pi / 2
|
| 84 |
[1] sin(a) > 0
|
| 85 |
|
| 86 |
-
```
|
| 87 |
Prev Command 1: (SKEEP)
|
| 88 |
Prev Command 2: (CASE "a <= pi/2")
|
| 89 |
Prev Command 3: (LEMMA "sin_pos_0tohalfpi")
|
| 90 |
Next Command:
|
| 91 |
-
|
| 92 |
```
|
| 93 |
|
| 94 |
-
```
|
| 95 |
Current Sequent:
|
| 96 |
{-1} FORALL (x_1: real): NOT (key_arb_intersections(p, v, G)(x_1) OR parallel_intersections(p, v, G)(x_1))
|
| 97 |
{1} FORALL (x: real): NOT key_arb_intersections(p, v, G)(x)
|
|
@@ -100,33 +107,41 @@ Prev Command 1: (EXPAND "empty?")
|
|
| 100 |
Prev Command 2: (EXPAND "member")
|
| 101 |
Prev Command 3: (GROUND)
|
| 102 |
Next Command:
|
| 103 |
-
|
| 104 |
```
|
| 105 |
|
|
|
|
| 106 |
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
|
| 110 |
-
```
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
|
| 114 |
-
|
|
|
|
|
|
|
| 115 |
|
|
|
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
"sequent": "{1} FORALL (A, B: simple_polygon_2d, j: below(A`num_vertices), i: nat): LET IV = injected_vertices(A, B, A`num_vertices), s = edges_of_polygon(A)(j), L = injected_vertices(A, B, j)`length, Q = injected_edge_seq(s, injected_edge(s, B)) IN i < IV`length AND i >= L AND i < Q`length + L IMPLIES IV`seq(i) = Q`seq(i - L)",
|
| 122 |
"prev_commands": ["None", "None", "None"],
|
| 123 |
"top_k": 3
|
| 124 |
}'
|
| 125 |
```
|
| 126 |
|
|
|
|
| 127 |
|
| 128 |
## PVSgym
|
| 129 |
|
| 130 |
-
|
|
|
|
| 131 |
|
| 132 |
-
|
|
|
|
| 4 |
|
| 5 |
# PVSGym: A Proof Learning Environment
|
| 6 |
|
| 7 |
+
Paper: https://openreview.net/forum?id=NpytqGYVPa¬eId=NpytqGYVPa
|
| 8 |
|
| 9 |
+
This repository contains models and a web server that use LLMs to assist
|
| 10 |
+
theorem proving in PVS.
|
| 11 |
|
| 12 |
+
------------------------------------------------------------------------
|
| 13 |
+
|
| 14 |
+
## Model Files
|
| 15 |
+
|
| 16 |
+
Place all model files in a directory that follows this structure:
|
| 17 |
+
|
| 18 |
+
``` text
|
| 19 |
pvs_sft5
|
| 20 |
βββ config.json
|
| 21 |
βββ generation_config.json
|
|
|
|
| 31 |
βββ training_args.bin
|
| 32 |
```
|
| 33 |
|
| 34 |
+
------------------------------------------------------------------------
|
|
|
|
| 35 |
|
| 36 |
+
## Input Format
|
| 37 |
|
| 38 |
+
> **Important:** The model is sensitive to newline formatting.\
|
| 39 |
+
> For reference, see the `recommend` implementation here:\
|
| 40 |
+
> https://huggingface.co/ma7583/pvs_oracle/blob/main/sft_fastapi.py
|
| 41 |
+
|
| 42 |
+
Each query to the recommender should be formatted like this:
|
| 43 |
+
|
| 44 |
+
``` text
|
| 45 |
Current Sequent:
|
| 46 |
[1] norm((# x := -1, y := 0 #)) = 1
|
| 47 |
|
|
|
|
| 51 |
Next Command:
|
| 52 |
```
|
| 53 |
|
| 54 |
+
``` text
|
| 55 |
Current Sequent:
|
| 56 |
{1} expt(c, (3 + 4 * n)) = expt(c, (1 + 4 * n)) * expt(c, 2)
|
| 57 |
|
|
|
|
| 59 |
Prev Command 2: (HIDE 2)
|
| 60 |
Prev Command 3: (EXPAND "^")
|
| 61 |
Next Command:
|
|
|
|
| 62 |
```
|
| 63 |
|
| 64 |
+
``` text
|
| 65 |
Current Sequent:
|
| 66 |
[-1] derivable?(sin, x!1) AND derivable?(sin, x!1) IMPLIES deriv(sin * sin, x!1) = 2 * (deriv(sin, x!1) * sin(x!1))
|
| 67 |
[-2] derivable?[real](sin * sin, x!1)
|
|
|
|
| 74 |
Prev Command 2: (EXPAND "derivable?" -4)
|
| 75 |
Prev Command 3: (EXPAND "derivable?" -5)
|
| 76 |
Next Command:
|
|
|
|
| 77 |
```
|
| 78 |
|
| 79 |
+
``` text
|
| 80 |
Current Sequent:
|
| 81 |
[1] FORALL (x: real): LET S = LAMBDA (n: nat): powerseq(cos_coef, x)(2 * n) IN conv_series?(S) AND cos(x) = inf_sum(S)
|
| 82 |
|
|
|
|
| 84 |
Prev Command 2: (ASSERT)
|
| 85 |
Prev Command 3: (HIDE 2)
|
| 86 |
Next Command:
|
|
|
|
| 87 |
```
|
| 88 |
|
| 89 |
+
``` text
|
| 90 |
Current Sequent:
|
| 91 |
{-1} FORALL (a: {x: real | 0 < x AND x <= pi / 2}): sin(a) > 0
|
| 92 |
[-2] a <= pi / 2
|
| 93 |
[1] sin(a) > 0
|
| 94 |
|
|
|
|
| 95 |
Prev Command 1: (SKEEP)
|
| 96 |
Prev Command 2: (CASE "a <= pi/2")
|
| 97 |
Prev Command 3: (LEMMA "sin_pos_0tohalfpi")
|
| 98 |
Next Command:
|
|
|
|
| 99 |
```
|
| 100 |
|
| 101 |
+
``` text
|
| 102 |
Current Sequent:
|
| 103 |
{-1} FORALL (x_1: real): NOT (key_arb_intersections(p, v, G)(x_1) OR parallel_intersections(p, v, G)(x_1))
|
| 104 |
{1} FORALL (x: real): NOT key_arb_intersections(p, v, G)(x)
|
|
|
|
| 107 |
Prev Command 2: (EXPAND "member")
|
| 108 |
Prev Command 3: (GROUND)
|
| 109 |
Next Command:
|
|
|
|
| 110 |
```
|
| 111 |
|
| 112 |
+
------------------------------------------------------------------------
|
| 113 |
|
| 114 |
+
## Running the Web Server
|
| 115 |
|
| 116 |
+
Start the FastAPI server with:
|
| 117 |
|
| 118 |
+
``` bash
|
| 119 |
+
python -m uvicorn sft_fastapi:app --host 0.0.0.0 --port 8000
|
| 120 |
+
```
|
| 121 |
|
| 122 |
+
### Health Check
|
| 123 |
|
| 124 |
+
``` bash
|
| 125 |
+
curl http://localhost:8000/health
|
| 126 |
+
```
|
| 127 |
|
| 128 |
+
### Command Recommendation Endpoint
|
| 129 |
|
| 130 |
+
Example request:
|
| 131 |
+
|
| 132 |
+
``` bash
|
| 133 |
+
curl -X POST http://localhost:8000/recommend -H "Content-Type: application/json" -d '{
|
| 134 |
"sequent": "{1} FORALL (A, B: simple_polygon_2d, j: below(A`num_vertices), i: nat): LET IV = injected_vertices(A, B, A`num_vertices), s = edges_of_polygon(A)(j), L = injected_vertices(A, B, j)`length, Q = injected_edge_seq(s, injected_edge(s, B)) IN i < IV`length AND i >= L AND i < Q`length + L IMPLIES IV`seq(i) = Q`seq(i - L)",
|
| 135 |
"prev_commands": ["None", "None", "None"],
|
| 136 |
"top_k": 3
|
| 137 |
}'
|
| 138 |
```
|
| 139 |
|
| 140 |
+
------------------------------------------------------------------------
|
| 141 |
|
| 142 |
## PVSgym
|
| 143 |
|
| 144 |
+
PVSGym is not strictly required to run this server, but a joint demo
|
| 145 |
+
will be added later.
|
| 146 |
|
| 147 |
+
Repository: https://github.com/manoja328/expmath/tree/main/pvspy
|