Zulip Chat Archive

Stream: new members

Topic: decidable on finset


Iocta (Aug 04 2020 at 08:51):

import data.setoid.partition
import data.finset

inductive thing : Type
| a : thing
| b : thing
| c : thing


def a_b_connected (p: set (set thing)) (hp: setoid.is_partition p)
[decidable ( (s : set thing) (H : s  p), thing.a  s  thing.b  s)]:
bool :=
 s  p, thing.a  s  thing.b  s

Can I use https://leanprover-community.github.io/mathlib_docs/data/finset/basic.html#finset.decidable_dexists_finset instead of [decidable (∃ (s : set thing) (H : s ∈ p), thing.a ∈ s ∧ thing.b ∈ s)] somehow?

Kenny Lau (Aug 04 2020 at 08:53):

Just use Prop instead of bool so that you don't need decidable

Kenny Lau (Aug 04 2020 at 08:53):

#xy

Iocta (Aug 04 2020 at 08:54):

When am I supposed to use bool?

Kenny Lau (Aug 04 2020 at 08:55):

next to never

Iocta (Aug 04 2020 at 08:56):

$ rg '\bbool\b' mathlib | wc -l
484

that's a pretty good-sized never :)

Kenny Lau (Aug 04 2020 at 08:57):

and what about Prop?

Iocta (Aug 04 2020 at 08:58):

2335

Kenny Lau (Aug 04 2020 at 08:59):

well those numbers tell you nothing

Kenny Lau (Aug 04 2020 at 08:59):

what I meant was that you don't use bool to state propositions

Kenny Lau (Aug 04 2020 at 09:00):

if you look into the actual use cases of bool you will find them being used as a fixed type with two elements or in tactics (metaprogramming)

Iocta (Aug 04 2020 at 09:02):

I'm not sure which one I mean here, but starting with Prop seems like a good bet. Thanks


Last updated: Dec 20 2023 at 11:08 UTC