lean4-htt/tests/lean/run/zetaUnused.lean
Joachim Breitner ba95dbc36b
feat: zetaUnused option (implementation) (#6755)
This PR implements the `zetaUnused` simp and reduction option (added in
#6754).

True by default, and implied by `zeta`, this can be turned off to make
simp even more careful about preserving the expression structure,
including unused let and have expressions.

Breaking change: The `split` tactic no longer removes unused let and
have expressions as a side-effect, in rare cases this may break proofs.
`dsimp only` can be used to remove unused have and let expressions.
2025-01-26 11:14:12 +00:00

80 lines
1.8 KiB
Text

/--
info: b : Bool
⊢ if b = true then
let_fun unused := ();
True
else False
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
trace_state; sorry
/--
info: b : Bool
⊢ b = true
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
simp; trace_state; sorry
/--
info: b : Bool
⊢ b = true ∧
let_fun unused := ();
True
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
simp (config := Lean.Meta.Simp.neutralConfig); trace_state; sorry
/-- error: simp made no progress -/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
simp (config := Lean.Meta.Simp.neutralConfig) only; trace_state; sorry
/--
info: b : Bool
⊢ if b = true then True else False
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
simp (config := Lean.Meta.Simp.neutralConfig) +zeta only; trace_state; sorry
/--
info: b : Bool
⊢ if b = true then True else False
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
simp (config := Lean.Meta.Simp.neutralConfig) +zetaUnused only; trace_state; sorry
-- Before the introduction of zetaUnused, split would do collateral damage to unused letFuns.
-- Now they are preserved:
/--
info: case isTrue
b : Bool
h✝ : b = true
⊢ let_fun unused := ();
True
---
warning: declaration uses 'sorry'
-/
#guard_msgs in
example (b : Bool) : if b then have unused := (); True else False := by
split
· trace_state; sorry
· sorry