Skip to content

Commit 2e2fe1e

Browse files
committed
fix: realizeValue should default to the private scope (#11748)
This PR fixes an edge case where some tactics did not allow access to private declarations inside private proofs under the module system Fixes #11747 (cherry picked from commit f317e28)
1 parent 18b3186 commit 2e2fe1e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Lean/Meta/Basic.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,11 @@ where
25832583
-- catch all exceptions
25842584
let _ : MonadExceptOf _ MetaM := MonadAlwaysExcept.except
25852585
observing do
2586-
realize)
2586+
-- The scope at which `enableRealizationsForConst forConst` was called is essentially
2587+
-- arbitrary, normalize here. As `realize` will not add new constants nor should it
2588+
-- directly be connected to user input to be checked, be permissive.
2589+
withoutExporting do
2590+
realize)
25872591
<* addTraceAsMessages
25882592
let res? ← act |>.run' |>.run coreCtx { env } |>.toBaseIO
25892593
let res ← match res? with

tests/lean/run/11747.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module
2+
3+
/-! `ext_iff.2` used to fail because `getFunInfo` was operating in the public scope. -/
4+
5+
public structure A where
6+
private a : Nat
7+
8+
theorem ext_iff {x y : A} : x = y ↔ x.a = y.a := by
9+
rw [A.mk.injEq]
10+
11+
theorem ext {x y : A} : x.a = y.a → x = y := by
12+
exact ext_iff.2

0 commit comments

Comments
 (0)