Skip to content

Commit

Permalink
fix(tactic/linarith): use refine instead of apply to avoid apply bug (#…
Browse files Browse the repository at this point in the history
…3199)

closes #3142




Co-authored-by: Rob Lewis <rob.y.lewis@gmail.com>
  • Loading branch information
robertylewis and robertylewis committed Jun 28, 2020
1 parent da210bf commit 35fbfe0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tactic/linarith/frontend.lean
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Otherwise returns `none`.
meta def apply_contr_lemma : tactic (option (expr × expr)) :=
do t ← target,
match get_contr_lemma_name_and_type t with
| some (nm, tp) := do applyc nm, v ← intro1, return $ some (tp, v)
| some (nm, tp) := do refine ((expr.const nm []) pexpr.mk_placeholder), v ← intro1, return $ some (tp, v)
| none := return none
end

Expand Down
11 changes: 11 additions & 0 deletions test/linarith.lean
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,14 @@ by nlinarith
variables {E : Type*} [add_group E]
example (f : ℤ → E) (h : 0 = f 0) : 12 := by nlinarith
example (a : E) (h : a = a) : 12 := by nlinarith

-- test that the apply bug doesn't affect linarith preprocessing

constant α : Type
def leα : α → α → Prop := λ a b, ∀ c : α, true

noncomputable instance : discrete_linear_ordered_field α :=
by refine_struct { le := leα }; admit

example (a : α) (ha : a < 2) : a ≤ a :=
by linarith

0 comments on commit 35fbfe0

Please sign in to comment.