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 a test case about overriding the prelude #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nomeata
Copy link

@nomeata nomeata commented Nov 15, 2023

This is well known, but but without further protection against the
prelude command, one can easily prove unsound things, as this test
demonstrates.

Until the kernel itself is guarded against this (tracked at
leanprover/lean4#188), I wonder if lean4checker should have
a defense, and warn if prelude is used, or something along these lines?

I had to restructure the tests into their own library with a glob, as
importing this file from another file that also imports the normal
prelude seems to fail with

./././Lean4CheckerTests.lean:1:0: error: import Lean4CheckerTests.OverridenPrelude failed, environment already contains 'Eq.refl' from Init.Prelude

@kim-em
Copy link
Collaborator

kim-em commented Nov 16, 2023

Thanks, @nomeata. This PR has revealed that CI wasn't set up properly for PRs from forks. I've pulled out your changes to the file layout, and fixed CI, and then rebased your PR back onto master.

All that remains here is the failing test.

Probably not unexpected but without further protection against the
`prelude` command, one can easily prove unsound things, as this test
demonstrates.

It seems that either `lean4checker` should somehow ensure that only an
official prelude is used, or else the kernel (which implements `Nat.add`
differently) should check that the definition is indeed as expected.

I had to restructure the tests into their own library with a `glob`, as
_importing_ this file from another file that also imports the normal
prelude seems to fail with
```
./././Lean4CheckerTests.lean:1:0: error: import Lean4CheckerTests.OverridenPrelude failed, environment already contains 'Eq.refl' from Init.Prelude
```
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