Skip to content

Commit d0c0a7f

Browse files
committed
Revert "fix: elaborate linarith arguments without errToSorry"
This reverts commit 383ec12.
1 parent 383ec12 commit d0c0a7f

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

Mathlib/Tactic/Linarith/Frontend.lean

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,6 @@ syntax (name := nlinarith) "nlinarith" "!"? linarithArgsRest : tactic
389389
@[inherit_doc nlinarith] macro "nlinarith!" rest:linarithArgsRest : tactic =>
390390
`(tactic| nlinarith ! $rest:linarithArgsRest)
391391

392-
/-- Elaborate `t` in a way that is suitable for linarith. -/
393-
def elabLinarithArg (tactic : String) (t : Term) : TacticM Expr := Term.withoutErrToSorry do
394-
let (e, mvars) ← elabTermWithHoles t none `linarith (allowNaturalHoles := true)
395-
unless mvars.isEmpty do
396-
throwErrorAt t "Argument passed to {tactic} has metavariables:{indentD e}"
397-
return e
398-
399392
/--
400393
Allow elaboration of `LinarithConfig` arguments to tactics.
401394
-/
@@ -406,7 +399,7 @@ elab_rules : tactic
406399
withMainContext do commitIfNoEx do
407400
liftMetaFinishingTactic <|
408401
Linarith.linarith o.isSome
409-
(← ((args.map (TSepArray.getElems)).getD {}).mapM (elabLinarithArg "linarith")).toList
402+
(← ((args.map (TSepArray.getElems)).getD {}).mapM (elabTerm ·.raw none)).toList
410403
((← elabLinarithConfig (mkOptionalNode cfg)).updateReducibility bang.isSome)
411404

412405
-- TODO restore this when `add_tactic_doc` is ported
@@ -427,7 +420,7 @@ elab_rules : tactic
427420
[(nlinarithExtras : GlobalBranchingPreprocessor)]) }
428421
liftMetaFinishingTactic <|
429422
Linarith.linarith o.isSome
430-
(← ((args.map (TSepArray.getElems)).getD {}).mapM (elabLinarithArg "nlinarith")).toList
423+
(← ((args.map (TSepArray.getElems)).getD {}).mapM (elabTerm ·.raw none)).toList
431424
(cfg.updateReducibility bang.isSome)
432425

433426
-- TODO restore this when `add_tactic_doc` is ported

test/linarith.lean

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -544,29 +544,3 @@ example (k : ℤ) (h : k < 1) (h₁ : -1 < k) : k = 0 := by
544544
-- linarith preprocessor to fail.
545545
change _ at h₁
546546
linarith
547-
548-
/-- error: unknown identifier 'garbage' -/
549-
#guard_msgs in
550-
example (q : Prop) (p : ∀ (x : ℤ), q → 1 = 2) : 1 = 2 := by
551-
linarith [p _ garbage]
552-
553-
/-- error: unknown identifier 'garbage' -/
554-
#guard_msgs in
555-
example (q : Prop) (p : ∀ (x : ℤ), q → 1 = 2) : 1 = 2 := by
556-
nlinarith [p _ garbage]
557-
558-
/--
559-
error: Argument passed to linarith has metavariables:
560-
p ?a
561-
-/
562-
#guard_msgs in
563-
example (q : Prop) (p : ∀ (x : ℤ), 1 = 2) : 1 = 2 := by
564-
linarith [p ?a]
565-
566-
/--
567-
error: Argument passed to nlinarith has metavariables:
568-
p ?a
569-
-/
570-
#guard_msgs in
571-
example (q : Prop) (p : ∀ (x : ℤ), 1 = 2) : 1 = 2 := by
572-
nlinarith [p ?a]

0 commit comments

Comments
 (0)