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

feat: add a test replacing an axiom #31

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Lean4CheckerTests/ReplaceAxiom.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Lean4CheckerTests.OpenPrivate

/- Redefine `propext : False`. -/
open Lean Elab Meta in
open private Environment.mk from Lean.Environment in
#eval modifyEnv (m := MetaM) fun env =>
let consts :=
{ env.constants with
map₁ := env.constants.map₁.insert ``propext (.axiomInfo {
name := ``propext
type := .const ``False []
levelParams := []
isUnsafe := false
})
}
Environment.mk env.const2ModIdx consts env.extensions env.extraConstNames env.header

theorem efsq : ∀ (x y z n : Nat),
0 < x → 0 < y → 0 < z → 2 < n →
x^n + y^n ≠ z^n := by
exfalso
exact propext

/-- info: 'efsq' depends on axioms: [propext] -/
#guard_msgs in
-- 'efsq' depends on axioms: [propext]
#print axioms efsq
8 changes: 8 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ but it is expected to have type
check_command "lake -q exe lean4checker Lean4CheckerTests.AddFalseConstructor" "lean4checker found a problem in Lean4CheckerTests.AddFalseConstructor
uncaught exception: No such constructor False.intro"

check_command "lake -q exe lean4checker Lean4CheckerTests.ReplaceAxiom" "lean4checker found a problem in Lean4CheckerTests.ReplaceAxiom
uncaught exception: application type mismatch
False.elim @propext
argument has type
∀ {a b : Prop}, (a ↔ b) → a = b
but function has type
False → ∀ (x y z n : Nat), 0 < x → 0 < y → 0 < z → 2 < n → x ^ n + y ^ n ≠ z ^ n"

check_command "lake -q exe lean4checker --fresh Lean4CheckerTests.UseFalseConstructor" "uncaught exception: (kernel) unknown constant 'False.intro'"

# The 'ReduceBool' test writes to a temporary file.
Expand Down
Loading