1. When preparing the challenge, I was wondering if I missed a bracket somewhere or forgot to put some brackets etc. Is there an easy way to check that a statement passes grammar checks? I think mmj2 could do that, but it is rather cumbersome to use as it is not really supported anymore.
Hi Savask,
For syntax check you also can use mm-lamp. You have to put each statement one by one into mm-lamp, so this is not very convenient, but it doesn’t require any installation.
Navigate to the mm-lamp web site https://expln.github.io/lamp/latest/index.html
In the “Source type” select “Web”
In the “Alias” select “set.mm:latest”
In the opened confirmation dialog click “Confirm”. This will start downloading the latest version of set.mm from us.metamath.org. Wait until the file is loaded (for me it takes about 20 seconds)
In “Scope” select “Stop before”
In “Label” type “box” and select “mathbox” from the dropdown
Click “Apply Changes”
Add all the statements you want to check by clicking “+” button. You may see letters G and P appear to the left of each statement. They don’t matter for syntax checking.
Click “Unify all” button. This button has shape of a few small connected circles. Make sure all the statements you’ve added are unselected before clicking this button (the checkbox to the left of each statement is empty).
If any of the statements have syntax error, you will see an error message in red color under such statement.
I checked all the statements from your challenge - all of them are syntactically correct. Nice challenge by the way, I will be happy to spend some time on it.
–
Igor
Very nice initiative!
Obviously Igor is on the right way with theorem cu3addd.
Concerning your question 3., one of the ideas behind my project "rumm" was to allow one to write tactics for Metamath in general and set.mm in particular.
Some tactics could be "expand" or "simplify", with a tactics being roughly "if the goal matches this expression, then try applying this theorem, or try (recursively) applying this tactics again".
I developed the tool to the point where some non-trivial theorems
could be proved automatically through such tactics, however I felt
my tactics language was not quite powerful enough to express what
I wanted.
BR,
_
Thierry
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/5e1c4b82-c6df-43b6-bd02-96a808e1a7abn%40googlegroups.com.
> Obviously Igor is on the right way with theorem cu3addd.
I was able to prove 3cubeslem1, 3cubeslem2 and a bit of 3cubeslem3 in “manual” mode using current capabilities of mm-lamp (I can share proofs if needed). To my surprise mm-lamp works with proofs containing 350 steps (not very fast though, but workable). I feel like I would be able to complete proving 3cubeslem3. But it starts feeling like a not proper use of time doing such proofs manually. So, I am going to start working on adding some automation capabilities to mm-lamp.
> I hope someone will find this little challenge interesting
For sure! Before that challenge I never created new proofs. I was only developing my proof assistant and testing it on proofs based on David’s tutorial for mmj2. But this challenge gave me a good starting point and new ideas of what I can add to my proof assistant.
> What do you think about having a separate file in the repository with "easier" unproved statements, which do not require new definitions to state or prove? These may serve as a guide on what to do for newcomers (or anyone else), or as a work in progress plan to formalize some big result.
I think this is a great idea. At least that’s what I needed to start doing my new proofs.
> Igor, congratulations! I hope you'll prepare a pull request to set.mm, in my opinion the result is interesting enough to have it, at least, in a mathbox.
> I looked over your proof file. I think some smaller lemmata (especially leading to the proofs of 3cubeslem1 and 3cubeslem2) can be joined into bigger chunks, that way proofs will be able to reuse same statements (for example, in syntax breakdown steps). Also I have a feeling that the metamath.exe minimization algo will be able to do more with bigger proofs. Similarly, many proofs share the same hypotheses (for instance, |- ( ph -> A e. RR ) ), and it can be reused if you put several statements into one block.
Thank you! Sure, I will add it into my mathbox after some enhancement.
> Also you seem to be jumping back and forth from the deduction style (like in _3cubeslem1_gtz_d) and "usual style" (like in _3cubeslem1_gtz_i). I don't know if that's necessary, but the idea is usually to carry the proof in deduction style where it's possible and maybe switch to the usual style near the end to state the main result.
At the beginning I didn’t know what approach to use. That’s why there are theorems in different forms in the beginning. Initially I created all three forms (inference, deduction and closed) for each theorem because I didn’t know what form I would need further in the proof. But somewhere in the middle of the proof I realized that I need only deduction. Before creating a pull request I will remove all redundant theorems.
> By the way, did you end up using some automation to finish the proof, or you did it all by hand after all?
The parts where I needed to compare or transform polynomials have been proved in semi-automatic mode. Everything else has been done manually. I heavily used the bottom-up prover of mm-lamp, but I count it as “manual mode” because it is able to find only very simple proofs. By the semi-automatic mode I mean a new automation functionality which I added to mm-lamp while working on this proof. It is currently not available on the mm-lamp web site, but I will release it in one of the next versions (hopefully in the next one).
Here are a few videos which show the automation I used to prove some parts of 3cubes (all videos are speechless):
Part 0 - initial setup to make this demo easier to reproduce
https://drive.google.com/file/d/1x-cV6dL3wqEeKalbXlaRP7AtZmxnFlWQ/view?usp=drive_link
Part 1 - converting a polynomial to the “base form”
https://drive.google.com/file/d/1IOk3QMteDB-IyV8OCWS56miyfcXksOFy/view?usp=drive_link
Part 2 - proving equality of two polynomials. This part also shows how to automatically create inference and closed forms from an existing deduction form (at the end of the video). Also, in this part, I cut a lot of time where the screen was blinking. So, macros work faster on the video than in reality.
https://drive.google.com/file/d/1hipxElyqrkuKYzEjH_AR4c0uap_3MYvu/view?usp=drive_link
Part 3 - creating a simple macro
https://drive.google.com/file/d/1qpFCZTXXVZ6TwJuuA_OPnAgfXzFiPrAZ/view?usp=drive_link
This automation is based on macros. A macro is a JavaScript function which automates one or few manual steps by calling special predefined API functions. Those API functions allow to interact with metamath-lamp functionality (everything works locally, there are no calls via the Internet). Those API functions do something which could be done manually. Only the proveBottomUp API has some additional capabilities not available via the UI. I am not providing more details because this is still a work in progress. This has not been released yet and it is available on dev version of metamath-lamp at the moment.
-
Igor
>In all fairness, it's pretty hard to understand what's going on in the videos, but it looks like your tactics use a lot of intermediate variables in the process (which get eliminated in the end, I guess). I think any intermediate variables can be avoided whatsoever.
You are right. Intermediate variables are used to make the statements more readable. Also a special naming convention for the variables is used, so that tactics can understand what to do with each variable. I also think that intermediate variables can be avoided. But this depends on personal preferences and tools used. For example, I cannot work with very long statements containing a lot of parenthesis. That’s why I prefer to use intermediate variables. Also, the special naming convention helps to improve performance a bit. Tactics can easily parse a variable name to get required information about that variable’s value instead of analyzing the value itself.
> Also I was expecting a lot less manual interaction for comparing two polynomials, but I probably don't understand some details.
I think it is possible to make a full automation for such types of proofs. Maybe I will do it in some time.
Thanks for the transformations.js script. I will review it.
-
Igor
> The first line is the proved statement, and the lines after it are the proof. If you insert it in metamath-lamp line by line (marking A e. CC and B e. CC as hypotheses), it would successfully unify.
The first line doesn’t look like a full expansion, because A gets multiplied by a sum of other variables. The right part of the last line seems to be the full expansion. But when I inserted all the lines to metamath-lamp (this link leads to my attempt to unify your proof), there was one not unified step, basically the first line in your proof was not unified. It could be a bug in metamath-lamp (I need more time to understand what’s going on). But also it looks like some steps are missing in your proof. For example, I would expect a line which proves “( A + B ) e. CC”, but it is missing in your proof. Anyway, I understand the idea of your approach, and it looks very reasonable.
> Of course your tactics are superior, but at least mine didn't require any intermediate variables or manual input
For this example, my tactics require only one intermediate variable and almost no manual input either. Here is a demo - https://drive.google.com/file/d/1ihCwiCyW0Ha_1qK6AY8xpa_BqsKlb51r/view?usp=drive_link
Intermediate variables become necessary for my tactics when there are also constants, for example, ( A x. ( ( 2 + 1 ) x. B ) ). If you try to apply the same tactic as shown on the demo above, you’ll end up with something like … ( 2 x. B ) … + … ( 1 x. B ) … , which is obviously not the desired result. Anyway, I am not insisting on any of the approaches. This is just what I came to during work on proof for 3cubes. However, I found usage of intermediate variables very convenient. Here is why I like this approach. The demos I showed run very smooth because I prepared by repeating those proofs several times before recording. But even there I made a few mistakes. When I was working on proofs for 3cubes, I made a lot more mistakes and encountered a lot of errors (due to both my inexperience and bugs in tactics). But thanks to usage of intermediate variables, which made all the statements short and readable, I was able to resolve errors sufficiently fast. So, intermediate variables may look awkward and negatively impact the quality of the resulting proof, but they may save a bit of mental health for such beginners as me :)
> I hope the usage of variables doesn't have a negative impact on the proof's length.
I don’t think the variables negatively impact the proof’s length. The tactics itself may produce long proofs.
> you will quickly notice that quite often the tactic simply tries to apply some theorem from a carefully chosen list when it is possible or when the expression matches some pattern. That seems to be enough to perform basic arithmetic (prove stuff like ; 1 2 + ; 3 9 = ; 5 1).
I noticed that. The bottom-up prover in metamath-lamp (this is the core of all my tactics) also uses a similar approach. However, from what I see, transformations.js uses trickier algorithms. Comparing to it my prover is more straightforward. I am not sure if my prover will be able to prove statements like ; 1 2 + ; 3 9 = ; 5 1, but I think it should be able (probably after some revision).
-
Igor