Zulip Chat Archive

Stream: new members

Topic: How to get rid of decidable clause in a polymorphic function


Colin Jones ⚛️ (Mar 27 2025 at 13:01):

There is an error in the if then statement because the 1 le to x is undecidable. How do put that as a requirement to run the function?

def function1 {α : Type} [LE α] [One α] [Zero α] [HMul  α α] (x : α) : α :=
  if 1  x then
    4 * x
  else
    0

Edward van de Meent (Mar 27 2025 at 13:13):

[Decidable (1 <= x)]

Aaron Liu (Mar 27 2025 at 14:29):

Alternatively, [DecidableLE α]


Last updated: May 02 2025 at 03:31 UTC