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

Some examples can't be compiled by mm0-rs #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joliss
Copy link
Contributor

@joliss joliss commented Oct 12, 2022

While browsing the examples, I noticed that some of them don't seem to compile with mm0-rs:

$ cd mm0-rs; for i in ../examples/*.mm[01]; do cargo run compile "$i" &> /dev/null && echo "    $i" || echo "ERR $i"; done
    ../examples/assembler-new.mm1
    ../examples/assembler-old.mm1
    ../examples/big_unifier.mm1
    ../examples/compiler-new.mm1
    ../examples/compiler-old.mm1
    ../examples/compiler.mm0
    ../examples/compiler.mm1
    ../examples/demo.mm1
    ../examples/do-block.mm1
    ../examples/goldbach.mm0
    ../examples/hello.mm0
    ../examples/hello_assembler.mm0
ERR ../examples/hello_assembler.mm1
    ../examples/hello_mmc.mm1
    ../examples/hol.mm0
    ../examples/hol.mm1
ERR ../examples/lean.mm1
    ../examples/miu.mm0
    ../examples/mm0.mm0
    ../examples/mm0.mm1
    ../examples/peano.mm0
    ../examples/peano.mm1
    ../examples/peano_hex.mm0
    ../examples/peano_hex.mm1
    ../examples/separation_logic.mm1
    ../examples/set.mm0
ERR ../examples/string.mm0
    ../examples/unprovable.mm0
    ../examples/verifier.mm0
ERR ../examples/verifier.mm1
    ../examples/x86.mm0
    ../examples/x86.mm1
    ../examples/x86_determ.mm1

I'm attaching a failing integration test for mm0-rs, which tries to elaborate all of the example files. I'm not sure if this is the best way to go about it, or even a good idea at all, but perhaps you find it useful.

Here's the errors I'm getting:

examples/hello_assembler.mm1

thread 'main' panicked at 'SourceAnnotation range `(21432, 21479)` is bigger than source length `0`', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/annotate-snippets-0.9.1/src/display_list/from_snippet.rs:286:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

examples/lean.mm1

error: regular variables cannot depend on other regular variables
   --> ../examples/lean.mm1:362:53
    |
362 | term iota_epsilon2 (G: ctx) (t F: expr) (L: indspec t)
    |                                                     ^
    |

...

examples/string.mm0

error: unsupported input kind
  --> ../examples/string.mm0:28:7
   |
28 | input string: input;
   |       ^^^^^^
   |

examples/verifier.mm1

thread 'main' panicked at 'no entry found for key', components/mmcc/src/infer.rs:1002:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@@ -469,7 +469,7 @@ fn elaborate_and_send(path: FileRef, send: FSender<ElabResult<()>>, rd: ArcList<

/// Elaborate a file, and return the completed [`FrozenEnv`] result, along with the
/// file contents.
pub(crate) fn elab_for_result(path: FileRef) -> io::Result<(FileContents, Option<FrozenEnv>)> {
pub fn elab_for_result(path: FileRef) -> io::Result<(FileContents, Option<FrozenEnv>)> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to make this pub in order to make it accessible from the test. Unfortunately this results in a bunch of warnings about missing documentation.

@digama0
Copy link
Owner

digama0 commented Oct 12, 2022

Hm, not sure exactly how to handle this. Some of the examples are known to fail, but I agree it's not a good look. (The list of files in the CI are the only ones which are really important, but of course the others can function as test cases.) It's closer to a playground folder than a curated collection of test cases. Some of these do appear to be actual bugs though.

  • examples/hello_assembler.mm1: This appears to be an issue in which a span from one file is reported as if it was in another file. When you open the file in the editor there is a highlight at the very end of the file which is caused by the call to (assemble) at the top of the file (the error goes away if you comment it out).
  • examples/lean.mm1: the error message is correct here, that is not legal syntax. I think the check for this didn't exist when I wrote the original file.
  • examples/string.mm0: this is a feature of mm0-hs that was not ported to mm0-rs. The input command exists in mm0-rs but there are no supported input kinds so you basically can't use it at all. (This is conforming in that the set of legal input and output kinds is verifier specific - it's intended to be an extension point.) The feature is of limited usefulness and I was thinking of removing it entirely.
  • examples/verifier.mm1: The panic is certainly a bug, but MMC is still quite raw and I don't really expect this file to compile. I have some more MMC files locally that could be used as test cases and a list of unresolved issues in the MMC compiler, but I don't have much time to work on it these days.

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.

2 participants