diff --git a/src/Lean/Meta/Basic.lean b/src/Lean/Meta/Basic.lean index 2684c7b730..34a4ae7ee0 100644 --- a/src/Lean/Meta/Basic.lean +++ b/src/Lean/Meta/Basic.lean @@ -399,6 +399,9 @@ def elimMVarDeps (xs : Array Expr) (e : Expr) (preserveOrder : Bool := false) : @[inline] def withTransparency {α} (mode : TransparencyMode) : n α → n α := mapMetaM <| withConfig (fun config => { config with transparency := mode }) +@[inline] def withDefault {α} (x : n α) : n α := + withTransparency TransparencyMode.default x + @[inline] def withReducible {α} (x : n α) : n α := withTransparency TransparencyMode.reducible x diff --git a/src/Lean/Meta/Tactic/Apply.lean b/src/Lean/Meta/Tactic/Apply.lean index 75b96d0dd9..539bb1d9aa 100644 --- a/src/Lean/Meta/Tactic/Apply.lean +++ b/src/Lean/Meta/Tactic/Apply.lean @@ -16,7 +16,7 @@ namespace Lean.Meta (?m ...) where ?m is an unassigned metavariable. -/ private def getExpectedNumArgsAux (e : Expr) : MetaM (Nat × Bool) := - withReducible $ forallTelescopeReducing e fun xs body => + withDefault <| forallTelescopeReducing e fun xs body => pure (xs.size, body.getAppFn.isMVar) private def getExpectedNumArgs (e : Expr) : MetaM Nat := do diff --git a/tests/lean/run/applytransp.lean b/tests/lean/run/applytransp.lean new file mode 100644 index 0000000000..4bafb41f26 --- /dev/null +++ b/tests/lean/run/applytransp.lean @@ -0,0 +1,5 @@ +theorem ex1 (h₁ : ¬ p) (h₂ : q → p) : ¬ q := by + intro h + apply h₁ + apply h₂ + apply h