Zulip Chat Archive

Stream: new members

Topic: Decidable predicates


Martin Dvořák (Apr 04 2022 at 16:17):

How can I say that pred has to be decidable in a way that is less awkward to write in Lean?

def f (pred :   Prop) [ x : , decidable (pred x)] (n : ) : list  :=
if pred n then [n] else []

Anne Baanen (Apr 04 2022 at 16:18):

You can use the docs#decidable_pred abbreviation:

def f (pred :   Prop) [decidable_pred pred] (n : ) : list  :=
if pred n then [n] else []

Last updated: Dec 20 2023 at 11:08 UTC