-
Notifications
You must be signed in to change notification settings - Fork 25
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
Bug with self-inclusion (with probably easy fix) #81
Comments
I think this should be rejected. Cyclic inclusion patterns should always be rejected because they have unclear ordering. |
Rejecting cyclic inclusions is reasonable. But the fix would be less straightforward, it seems, since the program should detect cycles ? |
It shouldn't be an error, it should just be ignored. Metmath book section 4.1.2 "Preprocessing" (page 113) has the spec: "A file self-reference is ignored, as is any reference to the top-level file (to avoid loops)". This is easily addressed; every time an inclusion is seen, you ignore it if that file has already been requested, otherwise add that file to the list of files that have been requested. The key is that the initial load of the file needs to add that filename to the list of files being requested. |
Yes, that is exactly the fix that I mentioned above and that I implemented in my "faster" branch of mmverify.py mentioned above. |
If this is already in the spec, then so be it. As an aside, file self references and references to the top level file are not sufficient to avoid loops: If |
Yes, we agree that asserted cycles can be indirect. I believe the intent for processing |
If you try to
MM> read test.mm
wheretest.mm
contains$[ test.mm $]
, this raises "BUG 1765" instead of simply ignoring that inclusion statement as a recursive one.I found this while fixing the same bug in https://github.com/benjub/mmverify.py/blob/faster/mmverify.py. A straightforward fix there: when creating the "input stream", add the current file to the set of already read files (see the line
self.imported_files = set({pathlib.Path(file.name).resolve()})
, which works with the later lineif file not in self.imported_files:...
). A similar fix should be doable inmetamath.c
.The text was updated successfully, but these errors were encountered: