Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA: Create an automated tool to regularly gather the equations from Equations.lean and AllEquations.lean and output them to a text file that is easy for machines to read #142

Closed
teorth opened this issue Sep 30, 2024 · 14 comments
Assignees

Comments

@teorth
Copy link
Owner

teorth commented Sep 30, 2024

This would presumably already be a byproduct of #29, but is worth isolating separately. The model here is that Equations.lean and AllEquations.lean represent the ground truth of the universe of equations/laws under consideration, so that new equations can be added to the universe by updating the lean files accordingly

@teorth teorth converted this from a draft issue Sep 30, 2024
@Command-Master
Copy link
Contributor

Currently #126 only considers equations that appear in some implications, so this will require some change

@teorth
Copy link
Owner Author

teorth commented Oct 1, 2024

It would also be nice to have a separate file that only lists the implications and anti implications on the equations defined just in Equations.lean

@vlad902
Copy link
Contributor

vlad902 commented Oct 6, 2024

Recently, Equations 28393, 374794, and 5105 have appeared in the output of lake exe extract_implications breaking some of my tools as they expected all equations to be in AllEquations.lean (I parse out the ones that are commented there as well.) That's probably a fault of my tooling, but also a good reason to do this to make it easier. Everyone can load a JSON.

@Command-Master
Copy link
Contributor

That also broke some of my tools. I could add a Lean script to extract the equations, what would be a good I/O for it?

@vlad902
Copy link
Contributor

vlad902 commented Oct 6, 2024

If you mean an output format, just a JSON hash seems easy for everyone to consume. Are you thinking of including it in extract_implications or somewhere else?

@Command-Master
Copy link
Contributor

I think extract_implications already does a lot of things, it's better to make another script.
By output format I meant how to describe the equations. Is something like {"Equation3": [0, [0, 0]], "Equation4": [0, [0, 1]]} good? Would it be better to have {"Equation3": "x = x ◇ x", "Equation4": "x = x ◇ y"}? Something else?

@teorth
Copy link
Owner Author

teorth commented Oct 6, 2024

As a short term fix one can of course add these equations in commented form to AllEquations.lean, and also add a note sonewhere in CONTRIBUTING.md requesting that one add the commented equation to AllEquations.lean whenever adding a novel equation to Equation.lean as a courtesy.

@vlad902
Copy link
Contributor

vlad902 commented Oct 6, 2024

I think extract_implications already does a lot of things, it's better to make another script. By output format I meant how to describe the equations. Is something like {"Equation3": [0, [0, 0]], "Equation4": [0, [0, 1]]} good? Would it be better to have {"Equation3": "x = x ◇ x", "Equation4": "x = x ◇ y"}? Something else?

Personally, I'd go for the simpler textual form since lots of tools just need to display them, but there's nothing stopping you from having it be "Equation3": { "text": "x = x", "ast": [0, [0, 0]] }

@Command-Master
Copy link
Contributor

claim

@Command-Master
Copy link
Contributor

disclaim

@teorth teorth moved this from Claimed Tasks to Unclaimed Outstanding Tasks in Equational Theories Project Oct 8, 2024
@0art0
Copy link
Contributor

0art0 commented Oct 8, 2024

claim

@teorth teorth moved this from Unclaimed Outstanding Tasks to Claimed Tasks in Equational Theories Project Oct 8, 2024
@0art0
Copy link
Contributor

0art0 commented Oct 8, 2024

propose PR #429

@teorth teorth moved this from Claimed Tasks to In Progress in Equational Theories Project Oct 8, 2024
@0art0
Copy link
Contributor

0art0 commented Oct 8, 2024

This PR depends on #427.

pitmonticone added a commit that referenced this issue Oct 9, 2024
This PR modifies the `equation` command to automatically generate the
corresponding law with variables over `Fin n` (in addition to the law
with variables over `Nat` that is already being generated).

This is used to show that the automatically generated laws are
equivalent to the original equation in terms of satisfiability.

Additionally, this PR introduces an environment extension to store all
the equational laws, which can be used to export laws as described in
#142.

This PR also modifies a result transporting laws from `Fin n` to `Nat`
to omit the `n != 0` hypothesis.

---------

Co-authored-by: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com>
@teorth teorth closed this as completed Oct 9, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Completed Tasks in Equational Theories Project Oct 9, 2024
@vlad902
Copy link
Contributor

vlad902 commented Oct 10, 2024

I get the following build error on lake exe export_equations on main:

error: ././././scripts/export_equations.lean:27:39: application type mismatch
  Json.arr fun h ↦ Subtype.map (fun x ↦ ?m.281 x) h laws
argument
  fun h ↦ Subtype.map (fun x ↦ ?m.281 x) h laws
has type
  (∀ (a : RBNode Name fun x ↦ Unit), RBNode.WellFormed Name.quickCmp a → ?m.273 ((fun x ↦ ?m.281 x) a)) →
    Subtype ?m.273 : Sort (max 1 ?u.261)
but is expected to have type
  Array Json : Type
error: ././././scripts/export_equations.lean:27:52: invalid constructor ⟨...⟩, expected type must be an inductive type with only one constructor
  RBNode Name fun x ↦ Unit
error: Lean exited with code 1
Some required builds logged failures:
- scripts.export_equations
error: build failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed Tasks
Development

No branches or pull requests

4 participants