PROP-LOGIC-KERNEL
This project is a small proposition-logic tactic kernel in Lean, exposed through a line-based REPL.
LEAN MODULE
PropLogicKernel/Basic.lean: proposition syntax, tactics, goals, and statePropLogicKernel/Parser.lean: parser for propositions and tactic commands (written by cursor)PropLogicKernel/Resolver.lean: operational semantics for tacticsPropLogicKernel/Printer.lean: rendering of propositions, tactics, and goalsPropLogicKernel/REPL.lean: REPL-level state, status lines, and exit-code policyREPL/REPL.lean: generic line-based REPL loopMain.lean: executable entrypoint
PROPOSITION SPECIFICATION
A proposition P is one of:
⊥- atom
A ∧ BA ∨ BA → B
Associativity follows the parser/printer implementation:
∧,∨, and→are parsed right-associatively- parentheses may be used explicitly
PARSER SPECIFICATION
PropLogicKernel/Parser.lean uppercases proposition input before parsing.
After uppercasing, proposition input is rejected unless every character is one of:
- whitespace
(,)∧,∨,→,⊥- uppercase letters
A-Z - digits
0-9 - underscore
_
Atom names are maximal nonempty strings over:
- uppercase letters
A-Z - digits
0-9 - underscore
_
Examples of valid atom names:
AP1HELLO_WORLDX_2
GOAL/STATE MODEL
A goal consists of:
- a set of hypotheses
- a target proposition
The state tracks:
- a list of goals
varCountnewCountsorrCount
TACTIC
These are the kernel rules implemented by PropLogicKernel/Resolver.lean.
intro- If goal is
A → B, add a fresh hypothesisAand replace the goal withB.
- If goal is
apply n- If hypothesis
nisA → Band current goal isB, replace the goal withA.
- If hypothesis
exact n- If hypothesis
nexactly matches the current goal, solve the goal.
- If hypothesis
constructor- If goal is
A ∧ B, split it into two goals.
- If goal is
left- If goal is
A ∨ B, replace the goal withA.
- If goal is
right- If goal is
A ∨ B, replace the goal withB.
- If goal is
cases n- If hypothesis
nisA ∨ B, branch into two goals. - If hypothesis
nisA ∧ B, add both parts as fresh hypotheses. - If hypothesis
nis⊥, solve the goal immediately.
- If hypothesis
CLASSICAL LOGIC
lem P- Classical only.
- Adds hypothesis
(P → ⊥) ∨ P.
refine n- Classical only.
- If hypothesis
nisA1 → B1and goal isB, replace the current goal with goalsB1 → BandA1.
APPLICATION LEVEL COMMANDS
sorry- Solves the current goal unconditionally and increments
sorrCount.
- Solves the current goal unconditionally and increments
new P- Pushes a fresh goal
Pand incrementsnewCount.
- Pushes a fresh goal
FAILURE BEHAVIOR
- Parse failures return
parse error. - Resolution failures return an error message and keep the previous state.
lemandrefinefail if classical logic is disabled.- Any tactic other than
newfails on an empty goal stack.
REPL protocol
The executable built by lake build runs REPL.run from REPL/REPL.lean.
For each step:
- write zero or more status/error lines to
stderr - write zero or more output lines to
stdout - write the prompt
>tostderrwith no trailing newline - read exactly one newline-terminated line from
stdin - transition to the next state
Status lines are prefixed by -- .
Typical status line:
-- new_count 1 sorry_count 0 goals_remaining 2
Success marker:
-- all goals accomplished!
That success marker is emitted iff:
- at least one goal was successfully introduced via
new - no
sorrywas used - all goals are solved
EXIT CODE POLICY
At EOF, REPL.run returns the previous step's code.
PropLogicKernel/REPL.lean sets exit code 0 iff (same with all goals accomplished!):
- at least one goal was successfully introduced via
new - no
sorrywas used - all goals are solved
Otherwise exit code is 1.
Parse/resolution errors do not automatically force exit code 1; they preserve the previous state. So if the kernel is already in a success state, a later failing command can still leave final exit code 0.
DISCLAIMER: AI GENERATED CODE
The following files were written by Cursor:
README.md- All Python code in this repo (for example:
py_prop_logic_kernel/) PropLogicKernel/Parser.lean
Metadata
Release files for py-prop-logic-kernel 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| py_prop_logic_kernel-0.0.6.tar.gz | 16.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_prop_logic_kernel-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / py_prop_logic_kernel-0.0.6.tar.gz
| Download URL | py_prop_logic_kernel-0.0.6.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f65786980962621bd7d84dd77b94a8f25824901b760ff3d2833e9934e55d053
|
|
BLAKE2b-256 checksum How to use checksums |
518973f76e24d0b2adb39dbf979bcf61943e87eedc7ea32eac8dca0e8fe6aa7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / py_prop_logic_kernel-0.0.6-py3-none-any.whl
| Download URL | py_prop_logic_kernel-0.0.6-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4f68f6f73eebc5edd7a34e668d2162dada303e42fa05ddbfdce75ada5f974b6
|
|
BLAKE2b-256 checksum How to use checksums |
414a6946dea4f5dd2a59c058d3d0e51173ebc5036291520fddac96ca2710f87e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for py-prop-logic-kernel 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.