digama0 / mm0

Metamath Zero specification language
Creative Commons Zero v1.0 Universal
312 stars 40 forks source link

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

Open joliss opened 2 years ago

joliss commented 2 years ago

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
digama0 commented 2 years ago

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.