Eqthy
Version 0.2 | See also: Philomath ∘ LCF-style-ND
Eqthy is a formalized language for equational proofs. Its design attempts to reconcile simplicity of implementation on a machine with human usability (more on this below). It supports an elementary linear style, where each line gives a step which is derived from the step on the previous line, and may optionally state the justification for the derivation in that step. Here is an example:
axiom (idright) mul(A, e) = A
axiom (idleft) mul(e, A) = A
axiom (assoc) mul(A, mul(B, C)) = mul(mul(A, B), C)
theorem (idcomm)
mul(A, e) = mul(e, A)
proof
A = A
mul(A, e) = A [by idright]
mul(A, e) = mul(e, A) [by idleft]
qed
For improved human usability, Eqthy is usually embedded within Markdown documents. This allows proofs to be written in a more "literate" style, with interspersed explanatory prose and references in the form of hyperlinks.
For a fuller description of the language, including a set of Falderal tests, see doc/Eqthy.md.
A number of proofs have been written in Eqthy to date. These can be found in the eg/ directory. In particular, there are worked-out proofs:
- of the Socks and Shoes theorem in group theory;
- in Propositional Algebra;
- in Boolean Algebra, giving lemmas that could be used in a proof of De Morgan's laws;
- in Combinatory Logic,
with hopefully more to come in the future.
The Eqthy language is still at an early stage and is subject to change. However, since the idea is to accumulate a database of proofs which can be built upon, it is unlikely that the format of the language will change radically.
Design Principles
Probably the language that Eqthy most resembles, in spirit, is Metamath; but its underlying mechanics are rather different. Eqthy is based on equational logic, so each step is an equation.
Eqthy's design attempts to reconcile simplicity of implementation on a machine with human usability. It should be understood that this is a balancing act; adding features to the language which improve usability will generally be detrimental to simplicity, and vice versa.
It has been implemented in Python in about 550 lines of code; the core verifier module is less than 200 lines of code. For more details, see the Implementations section below.
It is also possible for a human to write Eqthy documents by hand, and to read them, without much specialized knowledge. The base logic is equational logic, which has only 5 rules of inference, and these rules are particularly widely understood; "replace equals with equals" is a standard part of the high-school algebra cirriculum.
(In comparison, mmverifier.py
, a Python implementation of a Metamath
checker, is 360 lines of code; and while it is undoubtedly simple, the
Metamath language is not widely regarded as being easy to write or read.)
Implementations
While the language does not prescribe any specific application for proofs written in Eqthy, it is reasonable to expect that one of the main reasons one would want a computer to read one would be for it to check it for validity.
This distribution contains such a proof checker, written in Python 3. The source code for it can be found in the src/ directory.
The core module that does proof checking, eqthy.verifier, is less than 200 lines in length, despite having many logging statements (which both act as comments, and provide a trace to help the user understand the execution of the verifier on any given document).
The desire is to make reading the code and understanding its behaviour as un-intimidating as possible.
TODO
- Handle "on LHS", "on RHS" in hints.
- Allow context accumulated when verifying one document to be carried over and used when verifying the next documnet.
- Allow the first line of a proof to be an axiom.
- Scanner should report correct line number in errors when Eqthy document is embedded in Markdown.
- Arity checking? Would prevent some silly errors in axioms.
Desired Examples
- Interior algebra (corresponding to the modal logic S4)
- Relation algebra
- Johnson's 1892 axiom system given in Meredith and Prior's 1967 paper Equational Logic
- The theorem of ring theory given in Equational Logic, Spring 2017 by McNulty (but it's a bit of a monster all right)
Commit History
@output-sexpr
git clone https://git.catseye.tc/Eqthy/
- Experiment in dumping the AST to a Scheme-readable S-expression. Chris Pressey 1 year, 5 months ago
- Merge pull request #2 from catseye/develop-0.2 Chris Pressey (commit: GitHub) 1 year, 8 months ago
- Fix typo. Chris Pressey 1 year, 8 months ago
- Add HISTORY.md file. Chris Pressey 1 year, 8 months ago
- Add Falderal test for variable renaming. Chris Pressey 1 year, 8 months ago
- Update README. Chris Pressey 1 year, 8 months ago
- Add an example proof in a Combinatory Logic. Chris Pressey 1 year, 8 months ago
- Rewrite some of the prose here to match what I've learned so far. Chris Pressey 1 year, 8 months ago
- Another maybe-useful preliminary. Beginning to have my doubts tho. Chris Pressey 1 year, 8 months ago
- Add some lemmas regarding group inverses. Chris Pressey 1 year, 8 months ago