kurt-lang 0.7.1__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.
- kurt_lang-0.7.1/LICENSE +21 -0
- kurt_lang-0.7.1/PKG-INFO +210 -0
- kurt_lang-0.7.1/README.md +164 -0
- kurt_lang-0.7.1/pyproject.toml +47 -0
- kurt_lang-0.7.1/setup.cfg +4 -0
- kurt_lang-0.7.1/src/kurt/__init__.py +1 -0
- kurt_lang-0.7.1/src/kurt/__main__.py +4 -0
- kurt_lang-0.7.1/src/kurt/kurt.py +7049 -0
- kurt_lang-0.7.1/src/kurt/theories/analysis.kurt +66 -0
- kurt_lang-0.7.1/src/kurt/theories/arith.kurt +138 -0
- kurt_lang-0.7.1/src/kurt/theories/equality.kurt +35 -0
- kurt_lang-0.7.1/src/kurt/theories/group.kurt +168 -0
- kurt_lang-0.7.1/src/kurt/theories/logic.kurt +64 -0
- kurt_lang-0.7.1/src/kurt/theories/minimal.kurt +72 -0
- kurt_lang-0.7.1/src/kurt/theories/modal.kurt +35 -0
- kurt_lang-0.7.1/src/kurt/theories/natural.kurt +23 -0
- kurt_lang-0.7.1/src/kurt/theories/prop.kurt +97 -0
- kurt_lang-0.7.1/src/kurt/theories/set.kurt +96 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/PKG-INFO +210 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/SOURCES.txt +54 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/dependency_links.txt +1 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/entry_points.txt +2 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/requires.txt +3 -0
- kurt_lang-0.7.1/src/kurt_lang.egg-info/top_level.txt +1 -0
- kurt_lang-0.7.1/tests/test_bare_bool_schema_warning.py +65 -0
- kurt_lang-0.7.1/tests/test_bracket_sexpr_display.py +39 -0
- kurt_lang-0.7.1/tests/test_cli_exit_code.py +41 -0
- kurt_lang-0.7.1/tests/test_equal_expr_alpha.py +78 -0
- kurt_lang-0.7.1/tests/test_exists_intro_and_blocked_sets.py +159 -0
- kurt_lang-0.7.1/tests/test_export_bundle.py +80 -0
- kurt_lang-0.7.1/tests/test_file_fingerprint.py +27 -0
- kurt_lang-0.7.1/tests/test_gen_all_combinations.py +172 -0
- kurt_lang-0.7.1/tests/test_generate_all_combinations.py +186 -0
- kurt_lang-0.7.1/tests/test_kernel.py +305 -0
- kurt_lang-0.7.1/tests/test_kurt2latex.py +27 -0
- kurt_lang-0.7.1/tests/test_kurt2lean.py +70 -0
- kurt_lang-0.7.1/tests/test_kurt_lexer.py +18 -0
- kurt_lang-0.7.1/tests/test_kurt_parser.py +23 -0
- kurt_lang-0.7.1/tests/test_kurt_proofs.py +93 -0
- kurt_lang-0.7.1/tests/test_kurt_tutorial.py +30 -0
- kurt_lang-0.7.1/tests/test_kurtc.py +220 -0
- kurt_lang-0.7.1/tests/test_load_file_exception_narrowing.py +36 -0
- kurt_lang-0.7.1/tests/test_load_isolation.py +139 -0
- kurt_lang-0.7.1/tests/test_local_label.py +84 -0
- kurt_lang-0.7.1/tests/test_match_exprs_to_patterns.py +192 -0
- kurt_lang-0.7.1/tests/test_non_flat_symmetric_operators.py +183 -0
- kurt_lang-0.7.1/tests/test_save_command.py +124 -0
- kurt_lang-0.7.1/tests/test_shell_errors.py +83 -0
- kurt_lang-0.7.1/tests/test_small_fixes.py +60 -0
- kurt_lang-0.7.1/tests/test_standalone_bundle.py +58 -0
- kurt_lang-0.7.1/tests/test_standalone_script.py +47 -0
- kurt_lang-0.7.1/tests/test_strict_mode.py +63 -0
- kurt_lang-0.7.1/tests/test_sub_matching.py +210 -0
- kurt_lang-0.7.1/tests/test_sub_walk_capture.py +192 -0
- kurt_lang-0.7.1/tests/test_theory_syntax_survives_load.py +59 -0
- kurt_lang-0.7.1/tests/test_versions_agree.py +24 -0
kurt_lang-0.7.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-2026 Stefan Harmeling
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
kurt_lang-0.7.1/PKG-INFO
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kurt-lang
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: Kurt: a small language for mathematical proofs close to how humans write them, checked automatically.
|
|
5
|
+
Author-email: Stefan Harmeling <stefan.harmeling@tu-dortmund.de>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2016-2026 Stefan Harmeling
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://www.kurt-lang.org
|
|
29
|
+
Project-URL: Repository, https://github.com/harmeling/kurt-lang
|
|
30
|
+
Project-URL: Documentation, https://github.com/harmeling/kurt-lang/blob/main/doc/kurt-doc.md
|
|
31
|
+
Project-URL: Issues, https://github.com/harmeling/kurt-lang/issues
|
|
32
|
+
Keywords: proof,proof checker,logic,mathematics,education,natural deduction
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Education
|
|
35
|
+
Classifier: Intended Audience :: Science/Research
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Topic :: Education
|
|
39
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
40
|
+
Requires-Python: >=3.10
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
License-File: LICENSE
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: coverage; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# Kurt
|
|
48
|
+
|
|
49
|
+
Kurt is a small language for writing mathematical proofs in a form close to how people write
|
|
50
|
+
them — one claim per line, blocks for assumptions and cases — and a checker that tells you
|
|
51
|
+
immediately, line by line, whether each step follows. It is meant for students learning to prove
|
|
52
|
+
things, much like running tests while learning to program. Kurt has been developed by Stefan
|
|
53
|
+
Harmeling (TU Dortmund University) since 2016.
|
|
54
|
+
|
|
55
|
+
**Status: 0.7, a public beta.** Kurt is used for teaching, but the language isn't frozen yet: a
|
|
56
|
+
proof written for 0.7 may need small changes for 1.0.
|
|
57
|
+
|
|
58
|
+
Website: [www.kurt-lang.org](https://www.kurt-lang.org) (it leads here).
|
|
59
|
+
|
|
60
|
+
**Try it in your browser**, without installing anything:
|
|
61
|
+
[harmeling.github.io/kurt-web](https://harmeling.github.io/kurt-web/). The playground runs the same
|
|
62
|
+
Kurt in the browser, with the tutorial lessons and examples.
|
|
63
|
+
|
|
64
|
+
## A first proof
|
|
65
|
+
|
|
66
|
+
A file `modus-ponens.kurt`:
|
|
67
|
+
|
|
68
|
+
; simple modus ponens proof
|
|
69
|
+
bool A, B
|
|
70
|
+
use A implies B
|
|
71
|
+
use A
|
|
72
|
+
B
|
|
73
|
+
|
|
74
|
+
Check it on the command line:
|
|
75
|
+
|
|
76
|
+
$ kurt modus-ponens.kurt
|
|
77
|
+
This is Kurt, v0.7.0 (made by Stefan Harmeling, 2016-2026), file 014d63c1e32a
|
|
78
|
+
use A implies B ; 3 without proof
|
|
79
|
+
use A ; 4 without proof
|
|
80
|
+
B ; 5 by 3(4)
|
|
81
|
+
Proof checked
|
|
82
|
+
|
|
83
|
+
Each line gets the reason it holds: `B` follows by the rule of line 3 from the fact of line 4.
|
|
84
|
+
A proof with blocks, from the theory `prop` that comes with Kurt:
|
|
85
|
+
|
|
86
|
+
; if A implies B, then not B implies not A
|
|
87
|
+
load prop
|
|
88
|
+
bool A, B
|
|
89
|
+
|
|
90
|
+
show (A implies B) implies (not B implies not A)
|
|
91
|
+
proof
|
|
92
|
+
assume A implies B
|
|
93
|
+
assume not B
|
|
94
|
+
assume A
|
|
95
|
+
B
|
|
96
|
+
false
|
|
97
|
+
not A
|
|
98
|
+
qed
|
|
99
|
+
|
|
100
|
+
`kurt` without a file starts an interactive shell, which reads the same language, with the
|
|
101
|
+
same indentation rules as a file.
|
|
102
|
+
|
|
103
|
+
## What Kurt offers
|
|
104
|
+
|
|
105
|
+
- **Proofs as text**, line by line. Kurt finds each single step by itself, from the facts and
|
|
106
|
+
rules around. You don't need tactics or rule names.
|
|
107
|
+
- **Theories written in Kurt itself**: propositional and first-order logic, equality, sets,
|
|
108
|
+
arithmetic, natural numbers with induction, analysis (sums, limits), and groups; and, as an
|
|
109
|
+
experimental example, a fragment of modal logic.
|
|
110
|
+
Even the grammar is declared there (`infix`, `bindop`, `chain`), so students can read why a
|
|
111
|
+
step goes through.
|
|
112
|
+
- **A kernel checks every step again**: the search hands each accepted step to a small checker
|
|
113
|
+
as a certificate. `cert N` shows the certificate of line `N`. The certificates of a checked
|
|
114
|
+
file are kept in a `.kurtc` file, and next time the kernel checks them again, without any
|
|
115
|
+
search.
|
|
116
|
+
- **Exact arithmetic** with `calc on`: `0.1 + 0.2 = 0.3` holds, and `1 / 3` stays a fraction.
|
|
117
|
+
- **For grading**: `kurt --strict` rejects axioms (`use`), `todo` and new rules outside the
|
|
118
|
+
theories that come with Kurt.
|
|
119
|
+
- **No dependencies**: one Python file. It's also available as a single self-contained script
|
|
120
|
+
with all theories embedded, to hand out in a course.
|
|
121
|
+
|
|
122
|
+
## Installing
|
|
123
|
+
|
|
124
|
+
With Python 3.10 or newer:
|
|
125
|
+
|
|
126
|
+
pip install git+https://github.com/harmeling/kurt-lang.git
|
|
127
|
+
|
|
128
|
+
or a specific version, e.g. `...kurt-lang.git@v0.7.0`, or from a local clone with `pip install .`.
|
|
129
|
+
Then run `kurt` or `python -m kurt`.
|
|
130
|
+
|
|
131
|
+
**Without installing**, for a course: download the single self-contained `kurt.py` of the
|
|
132
|
+
latest release,
|
|
133
|
+
|
|
134
|
+
https://github.com/harmeling/kurt-lang/releases/latest/download/kurt.py
|
|
135
|
+
|
|
136
|
+
It has all the theories embedded (`load prop` and so on work right away) and needs nothing but
|
|
137
|
+
Python: `python3 kurt.py proof.kurt`. You can also build it from this repository yourself, with
|
|
138
|
+
`python3 scripts/build_standalone.py` (writes `dist/kurt.py`). To keep the theories as separate, editable files instead,
|
|
139
|
+
copy `src/kurt/kurt.py` together with the directory `src/kurt/theories/`.
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
- [`tutorial/`](tutorial/): 49 short lessons (00 to 48), one keyword or idea each. Each one is a Kurt file
|
|
144
|
+
you can run and change ([plan](tutorial/plan.md)).
|
|
145
|
+
- [`doc/kurt-cookbook.md`](doc/kurt-cookbook.md): recipes for common tasks. Prove an
|
|
146
|
+
implication, argue by contradiction, split into cases, rewrite with equality, use induction,
|
|
147
|
+
diagnose "can not derive".
|
|
148
|
+
- [`doc/kurt-doc.md`](doc/kurt-doc.md): the language reference.
|
|
149
|
+
- [`doc/kurt-soundness.md`](doc/kurt-soundness.md): what the checker's correctness rests on,
|
|
150
|
+
rule by rule, and the bugs found so far, each with its regression test.
|
|
151
|
+
- [`proofs/`](proofs/): many more example proofs. Each one is also a test.
|
|
152
|
+
|
|
153
|
+
## Why trust it?
|
|
154
|
+
|
|
155
|
+
A checker is only useful if what it accepts is correct. In Kurt, every step the search finds is
|
|
156
|
+
checked again by the kernel. Loaded theories are checked on their own, independent of what was
|
|
157
|
+
loaded before. A `def` must be conservative. Adversarial test files (`proofs/soundness/`) keep
|
|
158
|
+
every bug found so far from coming back. Kurt is not a small-kernel system like Metamath or HOL
|
|
159
|
+
Light yet: the kernel still shares the parser and the normal forms with the search.
|
|
160
|
+
`doc/kurt-soundness.md` says exactly what is trusted.
|
|
161
|
+
|
|
162
|
+
## AI assistance
|
|
163
|
+
|
|
164
|
+
Stefan Harmeling has designed and developed Kurt since 2016, and AI tools have helped with
|
|
165
|
+
parts of the work:
|
|
166
|
+
|
|
167
|
+
- **ChatGPT**, used in interactive chat to figure out bugs and details of the search procedure,
|
|
168
|
+
in particular how to generate all possible matches.
|
|
169
|
+
- **AI coding assistants** since September 2026: Anthropic's Claude via Claude Code, and OpenAI's
|
|
170
|
+
Codex. They implemented features and wrote tests, tutorial lessons and documentation. They
|
|
171
|
+
also reviewed the code for soundness bugs.
|
|
172
|
+
|
|
173
|
+
The author has not checked every line of the code they produced. He has reviewed the changes,
|
|
174
|
+
to see that they do what they should. Every change must also pass the test suite, which checks
|
|
175
|
+
every proof in `proofs/` and every tutorial lesson, including the adversarial cases in
|
|
176
|
+
`proofs/soundness/`. Commits made with an AI coding assistant say so in a `Co-Authored-By:`
|
|
177
|
+
line. The design of the language, and the responsibility for it, remain the author's.
|
|
178
|
+
|
|
179
|
+
## Editor support
|
|
180
|
+
|
|
181
|
+
The [kurt-syntax](https://github.com/harmeling/kurt-syntax) repository has editor support for
|
|
182
|
+
`.kurt` files: highlighting, comments and indentation, and, in VS Code and Emacs, LaTeX-style
|
|
183
|
+
shortcuts such as `\forall` → `∀`.
|
|
184
|
+
|
|
185
|
+
- **VS Code**: an extension with snippets, built with `npm install` and `npm run package`, then
|
|
186
|
+
installed with `code --install-extension kurt-syntax-<version>.vsix`.
|
|
187
|
+
- **Emacs**: put `kurt-mode.el` and `replacements.json` together in a directory on your load
|
|
188
|
+
path, and add `(require 'kurt-mode)` to your configuration.
|
|
189
|
+
- **Vim and Neovim**: use the repository as a plugin, e.g. clone it into
|
|
190
|
+
`~/.vim/pack/plugins/start/kurt-syntax`, or into Neovim's plugin directory.
|
|
191
|
+
|
|
192
|
+
## Developing Kurt
|
|
193
|
+
|
|
194
|
+
python -m venv .venv
|
|
195
|
+
source .venv/bin/activate
|
|
196
|
+
pip install -e .[dev]
|
|
197
|
+
python -m unittest # the test suite, including every file in proofs/
|
|
198
|
+
coverage run -m unittest && coverage report
|
|
199
|
+
|
|
200
|
+
The implementation is the single file `src/kurt/kurt.py`. The theories are in
|
|
201
|
+
`src/kurt/theories/`.
|
|
202
|
+
|
|
203
|
+
The banner's `file <hash>` is a fingerprint of the exact `kurt.py` you're running. When you
|
|
204
|
+
compare unexpected behavior with someone else, it tells you whether you really run the same
|
|
205
|
+
code.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
[MIT](./LICENSE) © 2016-2026 Stefan Harmeling. When you use or cite Kurt, please link back to
|
|
210
|
+
this repository. A star on GitHub is also appreciated!
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Kurt
|
|
2
|
+
|
|
3
|
+
Kurt is a small language for writing mathematical proofs in a form close to how people write
|
|
4
|
+
them — one claim per line, blocks for assumptions and cases — and a checker that tells you
|
|
5
|
+
immediately, line by line, whether each step follows. It is meant for students learning to prove
|
|
6
|
+
things, much like running tests while learning to program. Kurt has been developed by Stefan
|
|
7
|
+
Harmeling (TU Dortmund University) since 2016.
|
|
8
|
+
|
|
9
|
+
**Status: 0.7, a public beta.** Kurt is used for teaching, but the language isn't frozen yet: a
|
|
10
|
+
proof written for 0.7 may need small changes for 1.0.
|
|
11
|
+
|
|
12
|
+
Website: [www.kurt-lang.org](https://www.kurt-lang.org) (it leads here).
|
|
13
|
+
|
|
14
|
+
**Try it in your browser**, without installing anything:
|
|
15
|
+
[harmeling.github.io/kurt-web](https://harmeling.github.io/kurt-web/). The playground runs the same
|
|
16
|
+
Kurt in the browser, with the tutorial lessons and examples.
|
|
17
|
+
|
|
18
|
+
## A first proof
|
|
19
|
+
|
|
20
|
+
A file `modus-ponens.kurt`:
|
|
21
|
+
|
|
22
|
+
; simple modus ponens proof
|
|
23
|
+
bool A, B
|
|
24
|
+
use A implies B
|
|
25
|
+
use A
|
|
26
|
+
B
|
|
27
|
+
|
|
28
|
+
Check it on the command line:
|
|
29
|
+
|
|
30
|
+
$ kurt modus-ponens.kurt
|
|
31
|
+
This is Kurt, v0.7.0 (made by Stefan Harmeling, 2016-2026), file 014d63c1e32a
|
|
32
|
+
use A implies B ; 3 without proof
|
|
33
|
+
use A ; 4 without proof
|
|
34
|
+
B ; 5 by 3(4)
|
|
35
|
+
Proof checked
|
|
36
|
+
|
|
37
|
+
Each line gets the reason it holds: `B` follows by the rule of line 3 from the fact of line 4.
|
|
38
|
+
A proof with blocks, from the theory `prop` that comes with Kurt:
|
|
39
|
+
|
|
40
|
+
; if A implies B, then not B implies not A
|
|
41
|
+
load prop
|
|
42
|
+
bool A, B
|
|
43
|
+
|
|
44
|
+
show (A implies B) implies (not B implies not A)
|
|
45
|
+
proof
|
|
46
|
+
assume A implies B
|
|
47
|
+
assume not B
|
|
48
|
+
assume A
|
|
49
|
+
B
|
|
50
|
+
false
|
|
51
|
+
not A
|
|
52
|
+
qed
|
|
53
|
+
|
|
54
|
+
`kurt` without a file starts an interactive shell, which reads the same language, with the
|
|
55
|
+
same indentation rules as a file.
|
|
56
|
+
|
|
57
|
+
## What Kurt offers
|
|
58
|
+
|
|
59
|
+
- **Proofs as text**, line by line. Kurt finds each single step by itself, from the facts and
|
|
60
|
+
rules around. You don't need tactics or rule names.
|
|
61
|
+
- **Theories written in Kurt itself**: propositional and first-order logic, equality, sets,
|
|
62
|
+
arithmetic, natural numbers with induction, analysis (sums, limits), and groups; and, as an
|
|
63
|
+
experimental example, a fragment of modal logic.
|
|
64
|
+
Even the grammar is declared there (`infix`, `bindop`, `chain`), so students can read why a
|
|
65
|
+
step goes through.
|
|
66
|
+
- **A kernel checks every step again**: the search hands each accepted step to a small checker
|
|
67
|
+
as a certificate. `cert N` shows the certificate of line `N`. The certificates of a checked
|
|
68
|
+
file are kept in a `.kurtc` file, and next time the kernel checks them again, without any
|
|
69
|
+
search.
|
|
70
|
+
- **Exact arithmetic** with `calc on`: `0.1 + 0.2 = 0.3` holds, and `1 / 3` stays a fraction.
|
|
71
|
+
- **For grading**: `kurt --strict` rejects axioms (`use`), `todo` and new rules outside the
|
|
72
|
+
theories that come with Kurt.
|
|
73
|
+
- **No dependencies**: one Python file. It's also available as a single self-contained script
|
|
74
|
+
with all theories embedded, to hand out in a course.
|
|
75
|
+
|
|
76
|
+
## Installing
|
|
77
|
+
|
|
78
|
+
With Python 3.10 or newer:
|
|
79
|
+
|
|
80
|
+
pip install git+https://github.com/harmeling/kurt-lang.git
|
|
81
|
+
|
|
82
|
+
or a specific version, e.g. `...kurt-lang.git@v0.7.0`, or from a local clone with `pip install .`.
|
|
83
|
+
Then run `kurt` or `python -m kurt`.
|
|
84
|
+
|
|
85
|
+
**Without installing**, for a course: download the single self-contained `kurt.py` of the
|
|
86
|
+
latest release,
|
|
87
|
+
|
|
88
|
+
https://github.com/harmeling/kurt-lang/releases/latest/download/kurt.py
|
|
89
|
+
|
|
90
|
+
It has all the theories embedded (`load prop` and so on work right away) and needs nothing but
|
|
91
|
+
Python: `python3 kurt.py proof.kurt`. You can also build it from this repository yourself, with
|
|
92
|
+
`python3 scripts/build_standalone.py` (writes `dist/kurt.py`). To keep the theories as separate, editable files instead,
|
|
93
|
+
copy `src/kurt/kurt.py` together with the directory `src/kurt/theories/`.
|
|
94
|
+
|
|
95
|
+
## Documentation
|
|
96
|
+
|
|
97
|
+
- [`tutorial/`](tutorial/): 49 short lessons (00 to 48), one keyword or idea each. Each one is a Kurt file
|
|
98
|
+
you can run and change ([plan](tutorial/plan.md)).
|
|
99
|
+
- [`doc/kurt-cookbook.md`](doc/kurt-cookbook.md): recipes for common tasks. Prove an
|
|
100
|
+
implication, argue by contradiction, split into cases, rewrite with equality, use induction,
|
|
101
|
+
diagnose "can not derive".
|
|
102
|
+
- [`doc/kurt-doc.md`](doc/kurt-doc.md): the language reference.
|
|
103
|
+
- [`doc/kurt-soundness.md`](doc/kurt-soundness.md): what the checker's correctness rests on,
|
|
104
|
+
rule by rule, and the bugs found so far, each with its regression test.
|
|
105
|
+
- [`proofs/`](proofs/): many more example proofs. Each one is also a test.
|
|
106
|
+
|
|
107
|
+
## Why trust it?
|
|
108
|
+
|
|
109
|
+
A checker is only useful if what it accepts is correct. In Kurt, every step the search finds is
|
|
110
|
+
checked again by the kernel. Loaded theories are checked on their own, independent of what was
|
|
111
|
+
loaded before. A `def` must be conservative. Adversarial test files (`proofs/soundness/`) keep
|
|
112
|
+
every bug found so far from coming back. Kurt is not a small-kernel system like Metamath or HOL
|
|
113
|
+
Light yet: the kernel still shares the parser and the normal forms with the search.
|
|
114
|
+
`doc/kurt-soundness.md` says exactly what is trusted.
|
|
115
|
+
|
|
116
|
+
## AI assistance
|
|
117
|
+
|
|
118
|
+
Stefan Harmeling has designed and developed Kurt since 2016, and AI tools have helped with
|
|
119
|
+
parts of the work:
|
|
120
|
+
|
|
121
|
+
- **ChatGPT**, used in interactive chat to figure out bugs and details of the search procedure,
|
|
122
|
+
in particular how to generate all possible matches.
|
|
123
|
+
- **AI coding assistants** since September 2026: Anthropic's Claude via Claude Code, and OpenAI's
|
|
124
|
+
Codex. They implemented features and wrote tests, tutorial lessons and documentation. They
|
|
125
|
+
also reviewed the code for soundness bugs.
|
|
126
|
+
|
|
127
|
+
The author has not checked every line of the code they produced. He has reviewed the changes,
|
|
128
|
+
to see that they do what they should. Every change must also pass the test suite, which checks
|
|
129
|
+
every proof in `proofs/` and every tutorial lesson, including the adversarial cases in
|
|
130
|
+
`proofs/soundness/`. Commits made with an AI coding assistant say so in a `Co-Authored-By:`
|
|
131
|
+
line. The design of the language, and the responsibility for it, remain the author's.
|
|
132
|
+
|
|
133
|
+
## Editor support
|
|
134
|
+
|
|
135
|
+
The [kurt-syntax](https://github.com/harmeling/kurt-syntax) repository has editor support for
|
|
136
|
+
`.kurt` files: highlighting, comments and indentation, and, in VS Code and Emacs, LaTeX-style
|
|
137
|
+
shortcuts such as `\forall` → `∀`.
|
|
138
|
+
|
|
139
|
+
- **VS Code**: an extension with snippets, built with `npm install` and `npm run package`, then
|
|
140
|
+
installed with `code --install-extension kurt-syntax-<version>.vsix`.
|
|
141
|
+
- **Emacs**: put `kurt-mode.el` and `replacements.json` together in a directory on your load
|
|
142
|
+
path, and add `(require 'kurt-mode)` to your configuration.
|
|
143
|
+
- **Vim and Neovim**: use the repository as a plugin, e.g. clone it into
|
|
144
|
+
`~/.vim/pack/plugins/start/kurt-syntax`, or into Neovim's plugin directory.
|
|
145
|
+
|
|
146
|
+
## Developing Kurt
|
|
147
|
+
|
|
148
|
+
python -m venv .venv
|
|
149
|
+
source .venv/bin/activate
|
|
150
|
+
pip install -e .[dev]
|
|
151
|
+
python -m unittest # the test suite, including every file in proofs/
|
|
152
|
+
coverage run -m unittest && coverage report
|
|
153
|
+
|
|
154
|
+
The implementation is the single file `src/kurt/kurt.py`. The theories are in
|
|
155
|
+
`src/kurt/theories/`.
|
|
156
|
+
|
|
157
|
+
The banner's `file <hash>` is a fingerprint of the exact `kurt.py` you're running. When you
|
|
158
|
+
compare unexpected behavior with someone else, it tells you whether you really run the same
|
|
159
|
+
code.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
[MIT](./LICENSE) © 2016-2026 Stefan Harmeling. When you use or cite Kurt, please link back to
|
|
164
|
+
this repository. A star on GitHub is also appreciated!
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kurt-lang"
|
|
7
|
+
dynamic = ["version"] # from `version` in src/kurt/kurt.py
|
|
8
|
+
description = "Kurt: a small language for mathematical proofs close to how humans write them, checked automatically."
|
|
9
|
+
authors = [ { name = "Stefan Harmeling", email = "stefan.harmeling@tu-dortmund.de" } ]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = [] # runtime deps
|
|
14
|
+
keywords = ["proof", "proof checker", "logic", "mathematics", "education", "natural deduction"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Education",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Education",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://www.kurt-lang.org"
|
|
27
|
+
Repository = "https://github.com/harmeling/kurt-lang"
|
|
28
|
+
Documentation = "https://github.com/harmeling/kurt-lang/blob/main/doc/kurt-doc.md"
|
|
29
|
+
Issues = "https://github.com/harmeling/kurt-lang/issues"
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["coverage"]
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
kurt = "kurt.kurt:main"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools]
|
|
38
|
+
package-dir = {"" = "src"}
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.dynamic]
|
|
44
|
+
version = {attr = "kurt.kurt.version"}
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
kurt = ["theories/*.kurt"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .kurt import * # mainly for testing purposes
|