## Stream: general

### Topic: Subtype property

#### Floris van Doorn (May 14 2020 at 22:46):

Two related questions:
(1) Does the following lemma exist somewhere?

lemma subtype.property_coe {α} {p : α → Prop} (x : subtype p) : p x := x.2


It is important that this states p x, and not p x.1, so subtype.property doesn't work (I want to rewrite with this, and have ↑x instead of x.1 in my goal).

(2) Can I tell library_search to not work up to definitional equality (of semireducible definitions)? I am often trying to look for rewrite lemmas which are proven by rfl and then library_search is "too smart" and just tells me I can prove it by rfl or iff_refl _.

#### Reid Barton (May 14 2020 at 22:52):

How could you rewrite with it though?

#### Reid Barton (May 14 2020 at 22:53):

(2) also came up recently.

#### Reid Barton (May 14 2020 at 22:53):

https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there.20code.20for.20X.3F/topic/List.20lemmas/near/197053059

#### Reid Barton (May 14 2020 at 22:54):

For (1) something would need to beta-reduce p x, right? Does rw do that?

#### Yury G. Kudryashov (May 14 2020 at 22:57):

(1) If p x = x ∈ s, then we have subtype.mem.

If not, PR

#### Reid Barton (May 14 2020 at 23:01):

There's also

@[simp] lemma val_prop' {S : set α} (a : {a // a ∈ S}) : ↑a ∈ S := a.property


in data.subtype; are these duplicates?

#### Floris van Doorn (May 14 2020 at 23:02):

In my example I had something like this:

import linear_algebra.basic

universe variables v w
variables {R : Type v} {M : Type w} [comm_ring R] [add_comm_group M] [module R M] (π : M →ₗ[R] M)
example (x : π.ker) : π x = 0 :=
begin
rw [linear_map.mem_ker.mp x.2] -- error: did not find ⇑π x.val
end


#### Floris van Doorn (May 14 2020 at 23:03):

I realized I could have redefined something earlier to get the more convenient hypothesis x ∈ π.ker.

#### Reid Barton (May 14 2020 at 23:03):

Oh I see, there is something between rw and the property.

#### Floris van Doorn (May 14 2020 at 23:05):

And yes, rw beta-reduces:

lemma subtype.prop {α} {p : α → Prop} (x : subtype p) : p x := x.2

example (z : ℕ) (x : subtype (λ y, y = z)) : z = x :=
begin
rw [x.prop]
end


(using x.2 doesn't work)

#### Reid Barton (May 14 2020 at 23:06):

I guess otherwise nothing would ever have the right form.

#### Yury G. Kudryashov (May 14 2020 at 23:09):

I think that I wrote subtype.mem because I'd want it to have this name.

Sorry.

#### Yury G. Kudryashov (May 14 2020 at 23:09):

UPD: no, it is defined in set/basic

#### Reid Barton (May 14 2020 at 23:09):

Well that might be, but it really exists!

#### Yury G. Kudryashov (May 14 2020 at 23:11):

I think that it should be moved to data.subtype, val_prop' should be removed, and coe_prop should be added.

#### Yury G. Kudryashov (May 14 2020 at 23:29):

Who will volunteer to do this?

#### orlando (May 14 2020 at 23:53):

@Floris van Doorn :

import linear_algebra.basic

universe variables v w
variables {R : Type v} {M : Type w} [comm_ring R] [add_comm_group M] [module R M] (π : M →ₗ[R] M)
example (x : π.ker) : π x = 0 :=
begin
erw [linear_map.mem_ker.mp x.2] --  i think erw work in some case
end


#### Floris van Doorn (May 15 2020 at 16:25):

I tend to forget that erewrite is a thing. That is a good to remember as back-up plan.

#### Mario Carneiro (May 15 2020 at 16:25):

someday I will learn what it does

Last updated: May 12 2021 at 04:19 UTC