Zulip Chat Archive

Stream: mathlib4

Topic: missing Decidable instances


Yury G. Kudryashov (Jan 13 2023 at 08:39):

I've just noticed that we don't have Lean 4 versions of at least the following Decidable instances:

The easiest way to prove them is to use docs4#List.all_iff_forall_prop. Is this the right place or they should proved in a way that can be moved to Std?

Mario Carneiro (Jan 13 2023 at 08:39):

I thought these were in std already

Mario Carneiro (Jan 13 2023 at 08:40):

docs4#List.decidableBEx, docs4#List.decidableBAll

Mario Carneiro (Jan 13 2023 at 08:42):

The easiest way to prove them is to use docs4#List.all_iff_forall_prop. Is this the right place or they should proved in a way that can be moved to Std?

List.all_iff_forall_prop can definitely be moved to std

Yury G. Kudryashov (Jan 13 2023 at 08:43):

How do I make PRs to Std?

Yury G. Kudryashov (Jan 13 2023 at 08:44):

I want to add Decidable for Subset on Lists.

Mario Carneiro (Jan 13 2023 at 08:44):

it's a normal github project

Mario Carneiro (Jan 13 2023 at 08:44):

PR from a fork

Andrej Bauer (Oct 09 2023 at 06:57):

Is there already a way to convince the machine that ∀(k : Fin n), p k is decidable if p : Fin n → Prop is decidable? If not, what's the idiomatic way to go about it? Add an instance of Decidable (having instances for compound expressions looks scary to me)?

Eric Wieser (Oct 09 2023 at 07:03):

That instance should already be in mathlib

Eric Wieser (Oct 09 2023 at 07:03):

@loogle Decidable, Fintype, "forall"

Eric Wieser (Oct 09 2023 at 07:04):

@loogle Decidable, Fintype, "forall"

loogle (Oct 09 2023 at 07:04):

:search: Fintype.decidableForallFintype

Andrej Bauer (Oct 09 2023 at 07:20):

import Lean
theorem foo :  (k : Fin 6), k = k := by decide

gives me failed to synthesize Decidable (∀ (k : Fin 6), k = k). So I am doing something wrong, a missing import perhaps?

Sebastien Gouezel (Oct 09 2023 at 07:22):

As you can see in the link given by loogle, the instance you want to use is defined in Mathlib.Data.Fintype.Basic, so you should import this file.

Kevin Buzzard (Oct 09 2023 at 07:55):

If in doubt, import Mathlib

Eric Wieser (Oct 09 2023 at 07:59):

import Lean is fairly useless; this means roughly "I am going to augment the lean compiler/syntax in some way", not "I am going to write a program/proof in lean"

Eric Wieser (Oct 09 2023 at 07:59):

(for which import Std/import Mathlib are respectively reasonable choices)

Andrej Bauer (Oct 09 2023 at 09:21):

Kevin Buzzard said:

If in doubt, import Mathlib

Still getting used to the difference between import Lean and import Mathlib.

Antoine Chambert-Loir (Oct 09 2023 at 17:07):

Kevin Buzzard said:

If in doubt, import Mathlib

What does it cost (in terms of speed or energy) to do so?

Kevin Buzzard (Oct 09 2023 at 17:10):

In lean 3 -- a lot. In lean 4 very little.


Last updated: Dec 20 2023 at 11:08 UTC