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

Add refutations for entries of most_wanted.md found by searching for small magmas #103

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

few
Copy link
Contributor

@few few commented Sep 29, 2024

This adds a number of refutations for entries in most_wanted.md found by searching for magmas over Fin N, with N=2..5.
The Lean proofs are generated by a Python script and use (several versions of) a template I came up with. Note that these were my first steps with Lean and certainly not ideal.

Also note that for some other entries, there are already proofs in other files of this repository.

@carlini
Copy link
Contributor

carlini commented Sep 29, 2024

Could you please follow the other steps here https://github.com/teorth/equational_theories/blob/main/CONTRIBUTING.md#automated-proofs, including adding your python source and a brief explanation of how these were generated?

@few
Copy link
Contributor Author

few commented Sep 29, 2024

Sorry for missing that. I have updated the branch accordingly.

@nomeata
Copy link
Collaborator

nomeata commented Sep 30, 2024

Is this subsumed by #111?

@nomeata
Copy link
Collaborator

nomeata commented Sep 30, 2024

Also, it’s not really efficient to prove and state each antiimplication separately. See https://github.com/teorth/equational_theories/blob/main/equational_theories/SmallMagmas.lean how to express all facts about a single magma in one theorem. And likely the decideFin! tactic used there helps in your case too!

@few
Copy link
Contributor Author

few commented Sep 30, 2024

Is this subsumed by #111?

Partially. Basically all theorems involving Fin 2, Fin 3 and Fin 4 should be redundant. But finsearch.py can go beyond 4 as can be seen by the theorems involving Fin 6. There should be no counter example with a smaller magma.

@few
Copy link
Contributor Author

few commented Sep 30, 2024

Also, it’s not really efficient to prove and state each antiimplication separately. See https://github.com/teorth/equational_theories/blob/main/equational_theories/SmallMagmas.lean how to express all facts about a single magma in one theorem. And likely the decideFin! tactic used there helps in your case too!

Thank you for the pointers, I'll see if I can make some progress on my own later.

@nomeata
Copy link
Collaborator

nomeata commented Sep 30, 2024

But finsearch.py can go beyond 4 as can be seen by the theorems involving Fin 6.

Good point. It would be good to see if they actually find new anti-implications that way, though.

@few
Copy link
Contributor Author

few commented Oct 2, 2024

I have updated the branch to only include theorems for equations that involve Fin 5. The theorems now use the same technique as SmallMagma.lean.

Modulo bugs in the program, the equations with theorems have no smaller magma that satisfies them. And there are no other equations that could be satisfied by a Fin 5 magma.
What is incomplete are the counterexamples, i.e., there are other Fin 5 magmas that refute some implications currently missing in the theorems.

Is there some easy way to check if any of the refutations in the theorems are already present somewhere else? Do we have a list of all known (non)implications?

Copy link
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be wise to split the script into two steps

  • one that does the search, and generates a list of interesting magmas and the equations it satisfies, and dumps that into a text file

  • one that takes that and produces the lean files.

The reasons are

In fact, if your script produces data in the same format, you can just use the same script.

In fact in fact, and maybe not yet in this PR, we’ll converge on a single data format for facts about small magmas, and convert them to Lean in one go, which will avoid duplication and help with pruning.

.gitattributes Outdated
equational_theories/Generated/FinitePoly/Refutation*.lean linguist-generated
equational_theories/Generated/FinitePoly.lean linguist-generated
equational_theories/Generated/All4x4Tables/Refutation*.lean linguist-generated
equational_theories/Generated/All4x4Tables.lean linguist-generated
equational_theories/Generated/FinSearch/theorems/FinSearch.lean linguist-generated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
equational_theories/Generated/FinSearch/theorems/FinSearch.lean linguist-generated
equational_theories/Generated/FinSearch/theorems/magmas*.lean linguist-generated
equational_theories/Generated/FinSearch/theorems/proofs*.lean linguist-generated
equational_theories/Generated/FinSearch/FinSearch.lean linguist-generated

@nomeata
Copy link
Collaborator

nomeata commented Oct 2, 2024

Is there some easy way to check if any of the refutations in the theorems are already present somewhere else? Do we have a list of all known (non)implications?

You can run lake exe extract_implications. But as mentioned above I suggest you produce your data as non-lean files first, and then convert to lean using essentially the same script that I linked above; this will prune the facts based on known implications and on non-implications from the same file.

@few
Copy link
Contributor Author

few commented Oct 2, 2024

Thanks for the feedback. I have updated the PR as requested.

I have copied generate_lean.py from All4x4Tables as I needed to make some modifications.

Copy link
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@few
Copy link
Contributor Author

few commented Oct 3, 2024

Anything that needs to happen for this to be merged?

@nomeata
Copy link
Collaborator

nomeata commented Oct 3, 2024

Sorry, maybe I should have just pressed the button. There is a small merge conflict now, though.

@few
Copy link
Contributor Author

few commented Oct 3, 2024

Sorry, maybe I should have just pressed the button. There is a small merge conflict now, though.

Fixed

@teorth teorth merged commit 7325974 into teorth:main Oct 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants