lean4-htt/tests/lean/run/simp2.lean
Leonardo de Moura 27df5e968a
feat: Simp.Config.implicitDefEqProofs (#4595)
This PR implements `Simp.Config.implicitDefEqsProofs`. When `true`
(default: `true`), `simp` will **not** create a proof term for a
rewriting rule associated with an `rfl`-theorem. Rewriting rules are
provided by users by annotating theorems with the attribute `@[simp]`.
If the proof of the theorem is just `rfl` (reflexivity), and
`implicitDefEqProofs := true`, `simp` will **not** create a proof term
which is an application of the annotated theorem.

The default setting does change the existing behavior. Users can use
`simp -implicitDefEqProofs` to force `simp` to create a proof term for
`rfl`-theorems. This can positively impact proof checking time in the
kernel.

This PR also fixes an issue in the `split` tactic that has been exposed
by this feature. It was looking for `split` candidates in proofs and
implicit arguments. See new test for issue exposed by the previous
feature.

---------

Co-authored-by: Kim Morrison <kim@tqft.net>
2024-11-29 22:29:27 +00:00

37 lines
735 B
Text

def p (x : Prop) := x
@[simp] theorem lemma1 (x : Prop) : p x = x :=
rfl
theorem ex1 (x : Prop) (h : x) : p x := by
simp +implicitDefEqProofs
assumption
/--
info: theorem ex1 : ∀ (x : Prop), x → p x :=
fun x h => id h
-/
#guard_msgs in
#print ex1
theorem ex1' (x : Prop) (h : x) : p x := by
simp -implicitDefEqProofs
assumption
/--
info: theorem ex1' : ∀ (x : Prop), x → p x :=
fun x h => Eq.mpr (id (lemma1 x)) h
-/
#guard_msgs in
#print ex1'
theorem ex2 (x : Prop) (q : Prop → Prop) (h₁ : x) (h₂ : q x = x) : q x := by
simp [h₂]
assumption
/--
info: theorem ex2 : ∀ (x : Prop) (q : Prop → Prop), x → q x = x → q x :=
fun x q h₁ h₂ => Eq.mpr (id h₂) h₁
-/
#guard_msgs in
#print ex2