-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: don't ignore constructors and recursors, and add --fresh mode
- Loading branch information
Showing
8 changed files
with
148 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
on: | ||
push: | ||
|
||
name: continuous integration | ||
|
||
jobs: | ||
build: | ||
name: test | ||
steps: | ||
- name: install elan | ||
run: | | ||
set -o pipefail | ||
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz | ||
./elan-init -y --default-toolchain none | ||
echo "$HOME/.elan/bin" >> $GITHUB_PATH | ||
- uses: actions/checkout@v3 | ||
|
||
- name: test | ||
run: | | ||
./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
import Lean4Checker.Tests.AddFalse | ||
import Lean4Checker.Tests.AddFalseConstructor | ||
import Lean4Checker.Tests.UseFalseConstructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Lean | ||
|
||
open Lean in | ||
elab "add_false_constructor" : command => do | ||
modifyEnv fun env => | ||
let constants := env.constants.insert `False.intro $ ConstantInfo.ctorInfo | ||
{ name := `False.intro | ||
levelParams := [] | ||
type := .const ``False [] | ||
induct := `False | ||
cidx := 0 | ||
numParams := 0 | ||
numFields := 0 | ||
isUnsafe := false } | ||
{ env with constants } | ||
|
||
add_false_constructor | ||
|
||
example : False := | ||
False.intro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Lean4Checker.Tests.AddFalseConstructor | ||
|
||
theorem useEvilConstructor : False := | ||
False.intro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
check_command() { | ||
local cmd="$1" | ||
local expected="$2" | ||
|
||
output=$($cmd 2>&1) | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Error: The command '$cmd' succeeded but was expected to fail." | ||
exit 1 | ||
fi | ||
|
||
if [[ "$output" != "$expected" ]]; then | ||
echo "Error: The command '$cmd' did not produce the expected error." | ||
echo "Expected:" | ||
echo "$expected" | ||
echo "Got:" | ||
echo "$output" | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_command "lake exe lean4checker Lean4Checker.Tests.AddFalse" "uncaught exception: (kernel) declaration type mismatch, 'false' has type | ||
Prop | ||
but it is expected to have type | ||
False" | ||
|
||
check_command "lake exe lean4checker Lean4Checker.Tests.AddFalseConstructor" "uncaught exception: No such constructor False.intro" | ||
|
||
check_command "lake exe lean4checker --fresh Lean4Checker.Tests.UseFalseConstructor" "uncaught exception: (kernel) unknown constant 'False.intro'" | ||
|
||
echo "All commands produced the expected errors." |