Zulip Chat Archive

Stream: lean4

Topic: Overload notation


Marcus Rossel (Aug 12 2022 at 13:39):

The following snippet fails:

axiom add : Nat  Nat  Nat
variable (x y : Nat)
infixl:65 " + " => add
#check x + y

/- ambiguous, possible interpretations
  x + y : Nat

  x + y : ?m.1776
-/

How can I force Lean to use my overload?

Leonardo de Moura (Aug 12 2022 at 14:09):

You can increase the parser priority

infixl:65 (priority := high) " + " => add

or

infixl:65 (priority := default+1) " + " => add

since the builtin notation uses the default priority


Last updated: Dec 20 2023 at 11:08 UTC