You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 6, 2026. It is now read-only.
don’t know how to synthesize placeholder context: a b c : ℤ, hyp : a = b ⊢ Type ?
Code below extracted from the file tactic_writing.md is designed to reproduce the error. Other examples from the file work fine, or else have some narration explaining why they don't work.
open tactic.interactive («have»)
open tactic (get_local infer_type)
open interactive (parse)
open lean.parser (ident)
open lean.parser (tk)
open interactive (loc.ns)
open interactive.types (texpr location)
metadefmul_left (q : parse texpr) : parse location → tactic unit
| (loc.ns [some h]) := do
e ← tactic.i_to_expr q,
H ← get_local h,
`(%%l = %%r) ← infer_type H,
«have» h ``(%%e*%%l = %%e*%%r)
``(congr_arg (λ x, %%e*x) %%H),
tactic.clear H
| _ := tactic.fail "mul_left takes exactly one location"-- it gives me an error, why?example (a b c : ℤ) (hyp : a = b) : c*a = c*b :=
begin
mul_left c at hyp,
exact hyp
end
I can confirm #902 fixes the problem, but it would probably be good to include some commentary elaborating on why it is that
mul_left should be in the tactic.interactive namespace
and why the previous tactics defined in the file don't have to be.
Update: Oh wait, many of the previous tactics are in that namespace. And I guess that is explained with the somewhat confusing sentence near the top:
Such functions are either called by other tactics---those are
typically in the tactic namespace---or called interactively by users
inside tactic blocks---those must be in the tactic.interactive
namespace (this is not quite necessary for very simple tactics, but
weird things will happen in general when ignoring this rule).
I really don't understand what is confusing in this sentence. Do you have something clearer than "must be in the tactic.interactive namespace? I was really surprised by #902.
The facts in the sentence are reasonably clear. The grammar is wild. Here's an attempt that breaks it down into smaller bite-sized pieces.
Such functions are either called by other tactics, or called interactively by users inside tactic blocks. Tactics that are called non-interactively typically live in the tactic namespace. Tactics that are called interactively must be in the tactic.interactive namespace. (In fact, this is not quite necessary for very simple tactics, but weird things will happen in general when ignoring this rule.)
I'd be curious to know more about the edge cases described in the parenthetical comment but perhaps that's a discussion for Zulip.
Activity
minchaowu commentedon Apr 8, 2019
@holtzermann17 It's because the
mul_leftshould be in thetactic.interactivenamespace. See #902holtzermann17 commentedon Apr 10, 2019
I can confirm #902 fixes the problem, but it would probably be good to include some commentary elaborating on why it is that
and why the previous tactics defined in the file don't have to be.
Update: Oh wait, many of the previous tactics are in that namespace. And I guess that is explained with the somewhat confusing sentence near the top:
PatrickMassot commentedon Apr 11, 2019
I really don't understand what is confusing in this sentence. Do you have something clearer than "must be in the
tactic.interactivenamespace? I was really surprised by #902.holtzermann17 commentedon Apr 11, 2019
The facts in the sentence are reasonably clear. The grammar is wild. Here's an attempt that breaks it down into smaller bite-sized pieces.
Such functions are either called by other tactics, or called interactively by users inside tactic blocks. Tactics that are called non-interactively typically live in the
tacticnamespace. Tactics that are called interactively must be in thetactic.interactivenamespace. (In fact, this is not quite necessary for very simple tactics, but weird things will happen in general when ignoring this rule.)I'd be curious to know more about the edge cases described in the parenthetical comment but perhaps that's a discussion for Zulip.
PatrickMassot commentedon Apr 11, 2019
I'm not surprised my sentences are too long, this comes from the French language. Don't hesitate to PR this proposal, I'll merge it.