fix: simp should not pick up inaccessible definitional equations (#10696)

Fixes #10671
This commit is contained in:
Sebastian Ullrich 2025-10-08 14:48:35 +02:00 committed by GitHub
parent 3b061a0996
commit 1d989523d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View file

@ -670,6 +670,16 @@ def mkSimpExt (name : Name := by exact decl_name%) : IO SimpExtension :=
name := name
initial := {}
addEntry := fun d e => d.addSimpEntry e
exportEntry? := fun lvl e => do
-- export only annotations on public decls
let declName := match e with
| .thm t => match t.origin with
| .decl n _ _ => n
| _ => unreachable!
| .toUnfold n => n
| .toUnfoldThms n _ => n
guard (lvl == .private || !isPrivateName declName)
return e
}
abbrev SimpExtensionMap := Std.HashMap Name SimpExtension

View file

@ -457,3 +457,5 @@ info: @[expose] meta def msecexp : Nat :=
#guard_msgs in
#with_exporting
#print msecexp
attribute [simp] f_struct

View file

@ -153,3 +153,10 @@ info: f_exp_wfrec.induct_unfolding (motive : Nat → Nat → Nat → Prop) (case
/-- error: Invalid definition `nonMeta`, may not access declaration `pubMeta` marked as `meta` -/
#guard_msgs in
def nonMeta := pubMeta
/-! `simp` should not pick up inaccessible definitional equations. -/
/-- error: `simp` made no progress -/
#guard_msgs in
theorem f_struct_eq : f_struct 0 = 0 := by
simp