Zulip Chat Archive

Stream: lean4

Topic: Decidability of Prop-valued structure


Mitchell Lee (Dec 09 2024 at 19:55):

Hello, is there a clean way to prove that a Prop-valued structure is decidable, or to somehow use deriving to derive it? Here is a silly example:

structure IsBetweenThreeAndFive (n : Nat) : Prop where
  ge_three : 3  n
  le_five : n  5

instance : DecidablePred IsBetweenThreeAndFive := by
  sorry

Yaël Dillies (Dec 09 2024 at 19:57):

import Mathlib.Tactic.Common

@[mk_iff]
structure IsBetweenThreeAndFive (n : Nat) : Prop where
  ge_three : 3  n
  le_five : n  5

instance : DecidablePred IsBetweenThreeAndFive :=
  fun _  decidable_of_iff' _ (isBetweenThreeAndFive_iff _)

Mitchell Lee (Dec 09 2024 at 19:57):

Thanks!


Last updated: May 02 2025 at 03:31 UTC