thousandproblems 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thousandproblems-0.3.0/CHANGELOG.md +32 -0
- {thousandproblems-0.2.0/src/thousandproblems.egg-info → thousandproblems-0.3.0}/PKG-INFO +139 -1
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/README.md +137 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/pyproject.toml +6 -2
- thousandproblems-0.3.0/src/thousandproblems/__main__.py +7 -0
- thousandproblems-0.3.0/src/thousandproblems/cli.py +856 -0
- thousandproblems-0.3.0/src/thousandproblems/discover.py +239 -0
- thousandproblems-0.3.0/src/thousandproblems/download.py +148 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/library.py +34 -0
- thousandproblems-0.3.0/src/thousandproblems/search.py +549 -0
- thousandproblems-0.3.0/src/thousandproblems/stats.py +392 -0
- thousandproblems-0.3.0/src/thousandproblems/updates.py +231 -0
- thousandproblems-0.3.0/src/thousandproblems/validate.py +208 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0/src/thousandproblems.egg-info}/PKG-INFO +139 -1
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems.egg-info/SOURCES.txt +13 -1
- thousandproblems-0.3.0/src/thousandproblems.egg-info/entry_points.txt +2 -0
- thousandproblems-0.3.0/tests/test_cli.py +703 -0
- thousandproblems-0.3.0/tests/test_discover.py +253 -0
- thousandproblems-0.3.0/tests/test_updates.py +209 -0
- thousandproblems-0.2.0/CHANGELOG.md +0 -12
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/LICENSE +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/MANIFEST.in +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/benchmarks/bench.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/setup.cfg +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/setup.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/__init__.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/_cparser.c +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/_cparser.pyi +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/_pyparser.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/nodes.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems/py.typed +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems.egg-info/dependency_links.txt +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/src/thousandproblems.egg-info/top_level.txt +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/tests/corpus.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/tests/test_backends.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/tests/test_library.py +0 -0
- {thousandproblems-0.2.0 → thousandproblems-0.3.0}/tests/test_tptp.py +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Python 3.15: binary wheels with the C parser, and 3.15 in the test matrix.
|
|
6
|
+
- A `thousandproblems` command (also `python -m thousandproblems`) with the subcommands
|
|
7
|
+
`fetch` (problems with their axioms), `download` (the whole library), `validate` (check a
|
|
8
|
+
local install), `find`, `stats` and `search`.
|
|
9
|
+
- `thousandproblems.search`: an offline version of TPTP2T's problem-property search over a
|
|
10
|
+
local library, using a cached index of the problem headers.
|
|
11
|
+
- `thousandproblems.stats`: `syntax_stats` and `SPC` read a problem's `% Syntax` and `% SPC`
|
|
12
|
+
header lines; `compute_stats` works out dialect, roles, atoms, predicates, functions,
|
|
13
|
+
variables and depths from the formulae.
|
|
14
|
+
- `thousandproblems.validate.validate_library` and `thousandproblems.download.download_library`.
|
|
15
|
+
- `Library.problem_files(name)`: a problem and every file it includes.
|
|
16
|
+
- `thousandproblems discover`: find TPTP libraries on this machine, check them, and print the
|
|
17
|
+
command that sets `$TPTP`, or add it to the shell's startup file (`--set`; `setx` on Windows).
|
|
18
|
+
- `thousandproblems refresh` (and `thousandproblems.updates.check_for_updates`): look up the
|
|
19
|
+
latest TPTP release, clear cached website downloads from older releases, and compare a local
|
|
20
|
+
library with it. Other commands remind you after 30 days without a check (y / n / snooze);
|
|
21
|
+
`THOUSANDPROBLEMS_NO_UPDATE_CHECK=1` turns that off.
|
|
22
|
+
|
|
23
|
+
## 0.1.0
|
|
24
|
+
|
|
25
|
+
- `Variable.index` and `TypedVariable.index`: the distinct variables of a formula are numbered
|
|
26
|
+
1, 2, 3 ... in order of first appearance (scoped by quantifier; 0 outside a formula).
|
|
27
|
+
- `TPTPFile.symbols` and `AnnotatedFormula.symbols`: the symbol table, a tuple of
|
|
28
|
+
`Symbol(name, arity)` in order of first appearance, without `$` and `$$` symbols.
|
|
29
|
+
- First release: parser and printer for every TPTP language (`thf`, `tff`, `tcf`, `fof`,
|
|
30
|
+
`cnf`, `tpi`), with a C extension and a pure-Python fallback that build identical trees.
|
|
31
|
+
- `fetch_problem` / `open_library`: read problems, and expand their includes, from a TPTP
|
|
32
|
+
folder, a tarball or the TPTP website.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thousandproblems
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Fast parser and printer for the TPTP problem and solution syntax (thf, tff, tcf, fof, cnf, tpi).
|
|
5
5
|
Author-email: Ontology Portal <pypi@ontologyportal.org>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -691,6 +691,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
691
691
|
Classifier: Programming Language :: Python :: 3.12
|
|
692
692
|
Classifier: Programming Language :: Python :: 3.13
|
|
693
693
|
Classifier: Programming Language :: Python :: 3.14
|
|
694
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
694
695
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
695
696
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
696
697
|
Classifier: Topic :: Software Development :: Compilers
|
|
@@ -830,6 +831,143 @@ tarball. For anything more than a handful of problems, download the library.
|
|
|
830
831
|
Reading a compressed tarball means decompressing up to each file, so unpack it
|
|
831
832
|
(and use the folder) if you will read many problems.
|
|
832
833
|
|
|
834
|
+
## Command line
|
|
835
|
+
|
|
836
|
+
Installing the package adds a `thousandproblems` command (`python -m thousandproblems` works
|
|
837
|
+
too). Commands that need a library take `-L/--library` with a folder, a tarball or a server
|
|
838
|
+
URL. Without it they use the folder named by `$TPTP`, and `fetch` and `stats` fall back to the
|
|
839
|
+
TPTP website.
|
|
840
|
+
|
|
841
|
+
```sh
|
|
842
|
+
# the whole library (about 1 GB): the latest release, or --version 9.0.0; --list shows them all
|
|
843
|
+
thousandproblems download -o ~/tptp # prints e.g. ~/tptp/TPTP-v10.0.0
|
|
844
|
+
export TPTP=~/tptp/TPTP-v10.0.0
|
|
845
|
+
|
|
846
|
+
# a few problems, with the axiom files they include, saved in the standard layout
|
|
847
|
+
thousandproblems fetch SET001-1 'SEU14*' -o problems/
|
|
848
|
+
thousandproblems fetch SET001-1 --expand # print it, includes replaced by their formulae
|
|
849
|
+
|
|
850
|
+
# already have a library somewhere? find it, and set $TPTP for new terminals
|
|
851
|
+
thousandproblems discover ~/datasets --set
|
|
852
|
+
|
|
853
|
+
# is this a usable TPTP library? (exit status 1 if not)
|
|
854
|
+
thousandproblems validate ~/tptp/TPTP-v10.0.0 --includes
|
|
855
|
+
|
|
856
|
+
# where is it?
|
|
857
|
+
thousandproblems find SET001-1 'SYO00?^1' SET001-0.ax
|
|
858
|
+
|
|
859
|
+
# dialect, status, symbols, variables ...
|
|
860
|
+
thousandproblems stats SET001-1
|
|
861
|
+
thousandproblems stats my_problem.p --symbols --json
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
`validate` checks the standard layout: the `Problems/` and `Axioms/` folders, three-letter
|
|
865
|
+
domain folders, and problem files named after their domain. `--includes` checks that every
|
|
866
|
+
include can be found, and `--parse` also parses every file (slow). A missing `Documents/`,
|
|
867
|
+
`Generators/`, `Scripts/` or `TPTP2X/` folder is only a warning, since a trimmed copy still
|
|
868
|
+
works; `--strict` makes warnings fail too.
|
|
869
|
+
|
|
870
|
+
`discover` looks for libraries: folders holding `Problems/` and `Axioms/`, searched four levels
|
|
871
|
+
deep (`--depth`) under the folders you name, or by default under the current folder, your home
|
|
872
|
+
folder, `/opt`, `/usr/local/share`, `/usr/share`, `/srv` and `/data`. It checks each one,
|
|
873
|
+
lists them (usable ones first, then newest), and prints the command that sets `$TPTP` for your
|
|
874
|
+
shell (`--shell bash|zsh|fish|sh|powershell|cmd` to choose another). With `--set`, or when you
|
|
875
|
+
say yes at the prompt, it adds that command to your shell's startup file (`~/.zshrc`,
|
|
876
|
+
`~/.bashrc`, or `~/.bash_profile` on macOS, a `conf.d` file for fish, `~/.profile` otherwise)
|
|
877
|
+
between marker comments, so running it again replaces that line rather than adding another.
|
|
878
|
+
On Windows it runs `setx` instead. Without a terminal, `--set` also needs `--yes`. A program
|
|
879
|
+
can't change the environment of the shell that started it, so the current terminal still needs
|
|
880
|
+
the printed command, or a new window.
|
|
881
|
+
|
|
882
|
+
`stats` shows the figures it works out from the formulae (with the included axioms, unless you
|
|
883
|
+
pass `--no-expand`) next to the `% Syntax` statistics that the TPTP header declares:
|
|
884
|
+
|
|
885
|
+
```
|
|
886
|
+
Problem : SET001-1 (Problems/SET/SET001-1.p)
|
|
887
|
+
Domain : SET Set Theory
|
|
888
|
+
Title : Set members are superset members
|
|
889
|
+
Status : Unsatisfiable
|
|
890
|
+
Rating : 0.11 (v10.0.0)
|
|
891
|
+
SPC : CNF_UNS_RFO_NEQ_NHN (clause normal form, Unsatisfiable, real first-order, no equality, non-Horn)
|
|
892
|
+
Dialect : cnf [CNF]
|
|
893
|
+
Formulae : 9 (6 axiom, 2 hypothesis, 1 negated_conjecture)
|
|
894
|
+
Unit formulae : 3
|
|
895
|
+
Atoms : 17 (0 equality)
|
|
896
|
+
Symbols : 7 (arity 0-2)
|
|
897
|
+
predicates : 3 (arity 2-2)
|
|
898
|
+
functions : 1 (arity 2-2)
|
|
899
|
+
constants : 3 (arity 0-0)
|
|
900
|
+
Variables : 13 (bound: 13 !) (0 singleton)
|
|
901
|
+
|
|
902
|
+
Declared in the header (% Syntax), covering the problem with its includes:
|
|
903
|
+
clauses : 9 (3 unt; 1 nHn; 8 RR)
|
|
904
|
+
literals : 17 (0 equ; 8 neg)
|
|
905
|
+
...
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### Keeping up with new TPTP releases
|
|
909
|
+
|
|
910
|
+
The website only serves the current release, so problems cached from it go out of date when a
|
|
911
|
+
new release comes out. `thousandproblems refresh` looks up the latest release on tptp.org,
|
|
912
|
+
deletes cached downloads that come from an older one (they are fetched again when next
|
|
913
|
+
needed), and compares your local library (`-L` or `$TPTP`) with the latest release.
|
|
914
|
+
`--index` also rebuilds the search index.
|
|
915
|
+
|
|
916
|
+
```
|
|
917
|
+
$ thousandproblems refresh
|
|
918
|
+
latest TPTP release : v10.0.0
|
|
919
|
+
online cache : held v9.3.0; cleared 12 files, so problems are fetched again from v10.0.0
|
|
920
|
+
local library : /data/TPTP-v9.3.0 is v9.3.0; get v10.0.0 with 'thousandproblems download'
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
If you haven't checked for 30 days, the next command asks first:
|
|
924
|
+
|
|
925
|
+
```
|
|
926
|
+
You have not checked for a new TPTP library version in 30 days, check now? [y]es / [n]o / [s]nooze for thirty days:
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
`n` asks again the next day and `s` waits another 30 days. Without a terminal (in scripts and
|
|
930
|
+
pipelines) you get a one-line warning on stderr instead, at most once a day. Set
|
|
931
|
+
`THOUSANDPROBLEMS_NO_UPDATE_CHECK=1` to turn the reminder off, e.g. in CI. The time of the last
|
|
932
|
+
check is kept in `state.json` in the cache directory, and the version the online cache holds
|
|
933
|
+
in a `VERSION` file next to the cached files.
|
|
934
|
+
|
|
935
|
+
### Searching by problem properties (TPTP2T)
|
|
936
|
+
|
|
937
|
+
`search` covers the problem-properties part of the [TPTP2T](https://tptp.org/cgi-bin/TPTP2T)
|
|
938
|
+
form, run offline against a local library: domain, logical form, first-order subform, problem
|
|
939
|
+
version, status, rating, numbers of formulae, unit formulae, atoms, types, datatypes,
|
|
940
|
+
codatatypes, symbols, predicates, functions, the arities, equality, unit equality, variables
|
|
941
|
+
and binders, and arithmetic.
|
|
942
|
+
|
|
943
|
+
```sh
|
|
944
|
+
thousandproblems search --form FOF --status THM --rating 0.5..1 --equality none
|
|
945
|
+
thousandproblems search --domain SET,SEU --form THF --format table
|
|
946
|
+
thousandproblems search --form not:CNF --predicates '>1' --function-arity 0 --count
|
|
947
|
+
thousandproblems search --form TF0 --arithmetic yes | thousandproblems fetch - -o out/
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
Lists are comma-separated and match any item. Numbers take `N`, `MIN..MAX`, `MIN..`, `..MAX`,
|
|
951
|
+
`>N`, `>=N`, `<N` or `<=N`, and `not:` negates a criterion like TPTP2T's `~` box. All
|
|
952
|
+
criteria must hold. `thousandproblems search --help` lists them all. The answers come from the
|
|
953
|
+
problem headers (`% SPC`, `% Status`, `% Rating`, `% Version` and `% Syntax`), which are
|
|
954
|
+
indexed on first use (a couple of seconds for a folder; a tarball has to be decompressed once)
|
|
955
|
+
and cached in `$THOUSANDPROBLEMS_CACHE` until the library changes. TPTP2T's *solution*
|
|
956
|
+
properties (which systems solved a problem, and how) come from the TSTP solution library, not
|
|
957
|
+
the problem library, so `search` does not offer them.
|
|
958
|
+
|
|
959
|
+
The same is available from Python:
|
|
960
|
+
|
|
961
|
+
```python
|
|
962
|
+
from thousandproblems.search import search
|
|
963
|
+
for record in search("/data/TPTP-v10.0.0", form="FOF", status="THM", rating="unsolved"):
|
|
964
|
+
print(record.name, record.rating, record.stat("formulae"))
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
`thousandproblems.stats` (`compute_stats`, `syntax_stats`, `SPC`),
|
|
968
|
+
`thousandproblems.validate.validate_library` and `thousandproblems.download.download_library`
|
|
969
|
+
are the other building blocks the commands use.
|
|
970
|
+
|
|
833
971
|
## Which parser is running?
|
|
834
972
|
|
|
835
973
|
```python
|
|
@@ -128,6 +128,143 @@ tarball. For anything more than a handful of problems, download the library.
|
|
|
128
128
|
Reading a compressed tarball means decompressing up to each file, so unpack it
|
|
129
129
|
(and use the folder) if you will read many problems.
|
|
130
130
|
|
|
131
|
+
## Command line
|
|
132
|
+
|
|
133
|
+
Installing the package adds a `thousandproblems` command (`python -m thousandproblems` works
|
|
134
|
+
too). Commands that need a library take `-L/--library` with a folder, a tarball or a server
|
|
135
|
+
URL. Without it they use the folder named by `$TPTP`, and `fetch` and `stats` fall back to the
|
|
136
|
+
TPTP website.
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
# the whole library (about 1 GB): the latest release, or --version 9.0.0; --list shows them all
|
|
140
|
+
thousandproblems download -o ~/tptp # prints e.g. ~/tptp/TPTP-v10.0.0
|
|
141
|
+
export TPTP=~/tptp/TPTP-v10.0.0
|
|
142
|
+
|
|
143
|
+
# a few problems, with the axiom files they include, saved in the standard layout
|
|
144
|
+
thousandproblems fetch SET001-1 'SEU14*' -o problems/
|
|
145
|
+
thousandproblems fetch SET001-1 --expand # print it, includes replaced by their formulae
|
|
146
|
+
|
|
147
|
+
# already have a library somewhere? find it, and set $TPTP for new terminals
|
|
148
|
+
thousandproblems discover ~/datasets --set
|
|
149
|
+
|
|
150
|
+
# is this a usable TPTP library? (exit status 1 if not)
|
|
151
|
+
thousandproblems validate ~/tptp/TPTP-v10.0.0 --includes
|
|
152
|
+
|
|
153
|
+
# where is it?
|
|
154
|
+
thousandproblems find SET001-1 'SYO00?^1' SET001-0.ax
|
|
155
|
+
|
|
156
|
+
# dialect, status, symbols, variables ...
|
|
157
|
+
thousandproblems stats SET001-1
|
|
158
|
+
thousandproblems stats my_problem.p --symbols --json
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`validate` checks the standard layout: the `Problems/` and `Axioms/` folders, three-letter
|
|
162
|
+
domain folders, and problem files named after their domain. `--includes` checks that every
|
|
163
|
+
include can be found, and `--parse` also parses every file (slow). A missing `Documents/`,
|
|
164
|
+
`Generators/`, `Scripts/` or `TPTP2X/` folder is only a warning, since a trimmed copy still
|
|
165
|
+
works; `--strict` makes warnings fail too.
|
|
166
|
+
|
|
167
|
+
`discover` looks for libraries: folders holding `Problems/` and `Axioms/`, searched four levels
|
|
168
|
+
deep (`--depth`) under the folders you name, or by default under the current folder, your home
|
|
169
|
+
folder, `/opt`, `/usr/local/share`, `/usr/share`, `/srv` and `/data`. It checks each one,
|
|
170
|
+
lists them (usable ones first, then newest), and prints the command that sets `$TPTP` for your
|
|
171
|
+
shell (`--shell bash|zsh|fish|sh|powershell|cmd` to choose another). With `--set`, or when you
|
|
172
|
+
say yes at the prompt, it adds that command to your shell's startup file (`~/.zshrc`,
|
|
173
|
+
`~/.bashrc`, or `~/.bash_profile` on macOS, a `conf.d` file for fish, `~/.profile` otherwise)
|
|
174
|
+
between marker comments, so running it again replaces that line rather than adding another.
|
|
175
|
+
On Windows it runs `setx` instead. Without a terminal, `--set` also needs `--yes`. A program
|
|
176
|
+
can't change the environment of the shell that started it, so the current terminal still needs
|
|
177
|
+
the printed command, or a new window.
|
|
178
|
+
|
|
179
|
+
`stats` shows the figures it works out from the formulae (with the included axioms, unless you
|
|
180
|
+
pass `--no-expand`) next to the `% Syntax` statistics that the TPTP header declares:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Problem : SET001-1 (Problems/SET/SET001-1.p)
|
|
184
|
+
Domain : SET Set Theory
|
|
185
|
+
Title : Set members are superset members
|
|
186
|
+
Status : Unsatisfiable
|
|
187
|
+
Rating : 0.11 (v10.0.0)
|
|
188
|
+
SPC : CNF_UNS_RFO_NEQ_NHN (clause normal form, Unsatisfiable, real first-order, no equality, non-Horn)
|
|
189
|
+
Dialect : cnf [CNF]
|
|
190
|
+
Formulae : 9 (6 axiom, 2 hypothesis, 1 negated_conjecture)
|
|
191
|
+
Unit formulae : 3
|
|
192
|
+
Atoms : 17 (0 equality)
|
|
193
|
+
Symbols : 7 (arity 0-2)
|
|
194
|
+
predicates : 3 (arity 2-2)
|
|
195
|
+
functions : 1 (arity 2-2)
|
|
196
|
+
constants : 3 (arity 0-0)
|
|
197
|
+
Variables : 13 (bound: 13 !) (0 singleton)
|
|
198
|
+
|
|
199
|
+
Declared in the header (% Syntax), covering the problem with its includes:
|
|
200
|
+
clauses : 9 (3 unt; 1 nHn; 8 RR)
|
|
201
|
+
literals : 17 (0 equ; 8 neg)
|
|
202
|
+
...
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Keeping up with new TPTP releases
|
|
206
|
+
|
|
207
|
+
The website only serves the current release, so problems cached from it go out of date when a
|
|
208
|
+
new release comes out. `thousandproblems refresh` looks up the latest release on tptp.org,
|
|
209
|
+
deletes cached downloads that come from an older one (they are fetched again when next
|
|
210
|
+
needed), and compares your local library (`-L` or `$TPTP`) with the latest release.
|
|
211
|
+
`--index` also rebuilds the search index.
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
$ thousandproblems refresh
|
|
215
|
+
latest TPTP release : v10.0.0
|
|
216
|
+
online cache : held v9.3.0; cleared 12 files, so problems are fetched again from v10.0.0
|
|
217
|
+
local library : /data/TPTP-v9.3.0 is v9.3.0; get v10.0.0 with 'thousandproblems download'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
If you haven't checked for 30 days, the next command asks first:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
You have not checked for a new TPTP library version in 30 days, check now? [y]es / [n]o / [s]nooze for thirty days:
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`n` asks again the next day and `s` waits another 30 days. Without a terminal (in scripts and
|
|
227
|
+
pipelines) you get a one-line warning on stderr instead, at most once a day. Set
|
|
228
|
+
`THOUSANDPROBLEMS_NO_UPDATE_CHECK=1` to turn the reminder off, e.g. in CI. The time of the last
|
|
229
|
+
check is kept in `state.json` in the cache directory, and the version the online cache holds
|
|
230
|
+
in a `VERSION` file next to the cached files.
|
|
231
|
+
|
|
232
|
+
### Searching by problem properties (TPTP2T)
|
|
233
|
+
|
|
234
|
+
`search` covers the problem-properties part of the [TPTP2T](https://tptp.org/cgi-bin/TPTP2T)
|
|
235
|
+
form, run offline against a local library: domain, logical form, first-order subform, problem
|
|
236
|
+
version, status, rating, numbers of formulae, unit formulae, atoms, types, datatypes,
|
|
237
|
+
codatatypes, symbols, predicates, functions, the arities, equality, unit equality, variables
|
|
238
|
+
and binders, and arithmetic.
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
thousandproblems search --form FOF --status THM --rating 0.5..1 --equality none
|
|
242
|
+
thousandproblems search --domain SET,SEU --form THF --format table
|
|
243
|
+
thousandproblems search --form not:CNF --predicates '>1' --function-arity 0 --count
|
|
244
|
+
thousandproblems search --form TF0 --arithmetic yes | thousandproblems fetch - -o out/
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Lists are comma-separated and match any item. Numbers take `N`, `MIN..MAX`, `MIN..`, `..MAX`,
|
|
248
|
+
`>N`, `>=N`, `<N` or `<=N`, and `not:` negates a criterion like TPTP2T's `~` box. All
|
|
249
|
+
criteria must hold. `thousandproblems search --help` lists them all. The answers come from the
|
|
250
|
+
problem headers (`% SPC`, `% Status`, `% Rating`, `% Version` and `% Syntax`), which are
|
|
251
|
+
indexed on first use (a couple of seconds for a folder; a tarball has to be decompressed once)
|
|
252
|
+
and cached in `$THOUSANDPROBLEMS_CACHE` until the library changes. TPTP2T's *solution*
|
|
253
|
+
properties (which systems solved a problem, and how) come from the TSTP solution library, not
|
|
254
|
+
the problem library, so `search` does not offer them.
|
|
255
|
+
|
|
256
|
+
The same is available from Python:
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
from thousandproblems.search import search
|
|
260
|
+
for record in search("/data/TPTP-v10.0.0", form="FOF", status="THM", rating="unsolved"):
|
|
261
|
+
print(record.name, record.rating, record.stat("formulae"))
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
`thousandproblems.stats` (`compute_stats`, `syntax_stats`, `SPC`),
|
|
265
|
+
`thousandproblems.validate.validate_library` and `thousandproblems.download.download_library`
|
|
266
|
+
are the other building blocks the commands use.
|
|
267
|
+
|
|
131
268
|
## Which parser is running?
|
|
132
269
|
|
|
133
270
|
```python
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "thousandproblems"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Fast parser and printer for the TPTP problem and solution syntax (thf, tff, tcf, fof, cnf, tpi)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -22,11 +22,15 @@ classifiers = [
|
|
|
22
22
|
"Programming Language :: Python :: 3.12",
|
|
23
23
|
"Programming Language :: Python :: 3.13",
|
|
24
24
|
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Programming Language :: Python :: 3.15",
|
|
25
26
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
26
27
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
28
|
"Topic :: Software Development :: Compilers",
|
|
28
29
|
"Typing :: Typed",
|
|
29
30
|
]
|
|
31
|
+
[project.scripts]
|
|
32
|
+
thousandproblems = "thousandproblems.cli:main"
|
|
33
|
+
|
|
30
34
|
[project.urls]
|
|
31
35
|
Home = "https://ontologyportal.org"
|
|
32
36
|
Source = "https://github.com/ontologyportal/thousandproblems"
|
|
@@ -41,7 +45,7 @@ include-package-data = false
|
|
|
41
45
|
thousandproblems = ["py.typed", "*.pyi"]
|
|
42
46
|
|
|
43
47
|
[tool.cibuildwheel]
|
|
44
|
-
build = "cp311-* cp312-* cp313-* cp314-*"
|
|
48
|
+
build = "cp311-* cp312-* cp313-* cp314-* cp315-*"
|
|
45
49
|
skip = "*-musllinux_i686 *-manylinux_i686"
|
|
46
50
|
build-verbosity = 1
|
|
47
51
|
# The checks that the C parser really is in the wheel are in the test suite
|