Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all! Thank you for initiating this extremely exciting project.
This PR is my attempt to simplify & give more principled approach to maintain the implication graph.
[Syntactic data]
Each axiom (equation) is now has a concrete, syntactic term, named
Equation
type. A graph,Graph
type, is defined asEquation -> Equation -> Status
whereStatus
denotes the current state for the corresponding edge. For example, a concrete instance for the subgraph of our interest is given as a termsubgraph: Graph
.[Semantic interpretation]
The validity of this graph object is enforced with
Graph.valid
definition - e.g.,subgraph_valid
would be the final theorem for the subgraph. TheGraph.valid
requires corresponding semantic proof for each syntactic edges. Notably,Edge
is defined with typeclass and has few benefits below.Benefits are as follows:
subgraph_valid
ensures the correctness of the whole graph (that is to be extracted and processed by tools like image-generators later) inside Lean.(G: Type*) [Magma G]
for each theorem is now omitted, and (2) we don't have to give explicit names to theorems thanks to typeclass mechanism. (e.g.,instance : (Edge true .e2 .e4) where
instead oftheorem Equation2_implies_Equation4 (G: Type*) [Magma G] (h: Equation2 G) : Equation4 G :=
)Edge.trans_true
,Edge.abduct_false0
andEdge.abduct_false1
: the typeclass mechanism allows us to nicely derive some facts from existing facts. This is tested in the code.One caveat would be performance scalability issue, especially for the final theorem (like
subgraph_valid
). If typeclass resolution mechanism takesO(n)
(wheren
is the number of instances), it would take prohibitively long. If it takesO(log n)
, it should (I think) compile in time.If you find this useful, I can make it a mergeable state quickly.