Zulip Chat Archive

Stream: general

Topic: finset.induction_on


Kenny Lau (May 24 2020 at 10:27):

https://github.com/leanprover-community/mathlib/blob/2ef444afbbdcae10682b2d46479c3f267caca0b6/src/data/finset.lean#L309-L310

@[elab_as_eliminator] protected theorem induction_on {α : Type*} {p : finset α  Prop} [decidable_eq α]
  (s : finset α) (h₁ : p ) (h₂ :  a : α {s : finset α}, a  s  p s  p (insert a s)) : p s :=

Kenny Lau (May 24 2020 at 10:28):

should we have a classical version that removes decidable_eq?

Yury G. Kudryashov (May 24 2020 at 10:29):

Inside open_locale classical you already have this decidable_eq.

Kenny Lau (May 24 2020 at 10:32):

sometimes it's slow to infer the classical instance of decidable_eq

Reid Barton (May 24 2020 at 10:38):

I was vaguely under the impression that we had a linter about decidable_eq hypotheses of theorems

Kenny Lau (May 24 2020 at 10:39):

what does it do?

Johan Commelin (May 24 2020 at 10:42):

It checks that you didn't accidentally prove a constructive theorem if you might as well have proven it classically.

Bhavik Mehta (May 24 2020 at 11:50):

I think the insert here means you need a decidable eq in the statement

Reid Barton (May 24 2020 at 11:51):

Oh right we were just discussing this example last week.

Reid Barton (May 24 2020 at 11:51):

Maybe we should have a version that uses whatever the insert alternative was that didn't need decidable equality.

Mario Carneiro (May 24 2020 at 11:55):

I could have sworn I made this definition:

import data.finset

def finset.cons {α} (a : α) (s : finset α) (h : a  s) : finset α :=
a :: s.1, multiset.nodup_cons_of_nodup h s.2

Last updated: Dec 20 2023 at 11:08 UTC