Zulip Chat Archive

Stream: general

Topic: rfl not working, totally confused


Johan Commelin (Oct 08 2020 at 08:09):

import data.polynomial.degree.basic

noncomputable theory

namespace polynomial

variables {R : Type*} [semiring R] {f : polynomial R}

/-- erase_lead of a polynomial f is the polynomial obtained by
subtracting from f the leading term of f. -/
def erase_lead (f : polynomial R) : polynomial R :=
finsupp.erase f.nat_degree f

@[simp] lemma erase_lead_support (f : polynomial R) :
  f.erase_lead.support = f.support.erase f.nat_degree :=
rfl -- fails

end polynomial

Johan Commelin (Oct 08 2020 at 08:12):

@eq.{1} (finset.{0} nat)
 (@finset.erase.{0} nat (λ (a b : nat), classical.prop_decidable (@eq.{1} nat a b))
 (@finsupp.support.{0 u_1} nat R (@mul_zero_class.to_has_zero.{u_1} R (@monoid_with_zero.to_mul_zero_class.{u_1} R (@semiring.to_monoid_with_zero.{u_1} R _inst_1))) f) (@polynomial.nat_degree.{u_1} R _inst_1 f))
 (@finset.erase.{0} nat nat.decidable_eq
 (@finsupp.support.{0 u_1} nat R (@mul_zero_class.to_has_zero.{u_1} R (@monoid_with_zero.to_mul_zero_class.{u_1} R (@semiring.to_monoid_with_zero.{u_1} R _inst_1))) f) (@polynomial.nat_degree.{u_1} R _inst_1 f))

Johan Commelin (Oct 08 2020 at 08:13):

decidable eq issue on nat :angry_cat:

Chris Hughes (Oct 08 2020 at 08:13):

lhs is classical dec eq and rhs is honest dec eq on nat.

Johan Commelin (Oct 08 2020 at 08:14):

This is sad

Johan Commelin (Oct 08 2020 at 08:15):

I want

def tactic.interactive.RFL := `[by convert rfl]

Chris Hughes (Oct 08 2020 at 08:15):

convert might not even help when you have to unfold the lhs

Johan Commelin (Oct 08 2020 at 08:16):

It worked in this case :shrug:

Eric Wieser (Oct 08 2020 at 09:08):

Does changing finsupp to use less classical help with this type of thing?

Johan Commelin (Oct 08 2020 at 09:17):

I think we changed it to use more classical to help with this kind of thing :oops: :see_no_evil:

Chris Hughes (Oct 08 2020 at 09:22):

It's your fault for unfolding finsupp and not using the API.

Johan Commelin (Oct 08 2020 at 09:28):

ok, ok, I take the blame (-;

Johan Commelin (Oct 08 2020 at 09:28):

I view this as part of extending the API

Yury G. Kudryashov (Oct 08 2020 at 09:32):

In my experience, using very precise [decidable] assumptions in the best way to make lemmas that work both with classical and without it.

Yury G. Kudryashov (Oct 08 2020 at 09:33):

E.g., it's OK to add a [decidable] assumption that can be deduced from others if this assumption is used somewhere in the statement (not the proof).


Last updated: Dec 20 2023 at 11:08 UTC