Zulip Chat Archive
Stream: new members
Topic: failed to synthesize DecidablePred
Ralf Stephan (Jul 13 2024 at 11:20):
Why do I get this error? set_option diagnostics true
makes no difference. Do I need to define PrimeBelow
differently?
import Mathlib
set_option autoImplicit false
set_option diagnostics true
open Nat
def PrimeBelow (n p : ℕ) :=
p ∈ (primesBelow n)
lemma count_PrimeBelow (n : ℕ) (hn : 2 < n) : count (PrimeBelow n) 2 = 0 := by
sorry
failed to synthesize
DecidablePred (PrimeBelow n)
use `set_option diagnostics true` to get diagnostic information
Rida Hamadani (Jul 13 2024 at 11:28):
Include this before your lemma
instance {n : ℕ} : DecidablePred (PrimeBelow n) := by
unfold PrimeBelow
infer_instance
Ralf Stephan (Jul 13 2024 at 11:30):
Thank you. So the definition needed the DecidablePred
interface, and proven. I need to think more object-oriented.
Eric Wieser (Jul 13 2024 at 11:54):
Or use abbrev
instead of def
Last updated: May 02 2025 at 03:31 UTC