Zulip Chat Archive
Stream: new members
Topic: How to simplify structure construction + field extraction
Golol (Oct 19 2020 at 11:06):
Quick question: If I have {my_field := expression}.my_field
,
then how can I simplify this to expression
? simp
works, but I'd like to know what function I would have to apply to perform this manually.
As always, thanks for all the help I'm getting here!
Kenny Lau (Oct 19 2020 at 11:10):
dsimp only
Mario Carneiro (Oct 19 2020 at 11:14):
In term mode, you don't have to apply anything at all to perform this reduction
Mario Carneiro (Oct 19 2020 at 11:14):
it will just naturally happen if you apply a theorem that wouldn't otherwise typecheck
Mario Carneiro (Oct 19 2020 at 11:15):
in fact, this is what refl
does - you apply a theorem that says a = a
but the two sides aren't obviously the same so lean performs reduction until they are
Golol (Oct 19 2020 at 14:33):
I have a proof of
h: ∀ (a : set α), (∃ (j : I) P j a) \iff p i a
how can I apply this to prove the following
{a : set \a | (∃ (j : I) P j a} = {a : set \a | Pi a}
I thought I could rw h or intro a but it doesn't work.
Reid Barton (Oct 19 2020 at 14:34):
Start with ext a
Patrick Massot (Oct 19 2020 at 14:38):
Also have a look at docs#set.ext
Mario Carneiro (Oct 19 2020 at 14:38):
which, by the way, is an application of set.ext
in term mode
Patrick Massot (Oct 19 2020 at 14:39):
Ha ha! I was faster!
Golol (Oct 19 2020 at 14:40):
omg thx guys :D
Patrick Massot (Oct 19 2020 at 14:40):
Golol, what we mean is you can have a look at:
example {α : Type*} {P Q : α → Prop} (h : ∀ x, P x ↔ Q x) : {x | P x} = {x | Q x} :=
set.ext h
--funext (λ x, propext $ h x)
Patrick Massot (Oct 19 2020 at 14:40):
where the commented line is the proof hidden under set.ext h
Golol (Oct 19 2020 at 14:43):
Aah, good old functional extensionality
Golol (Oct 19 2020 at 15:58):
Alright, I need this one extra thing. My situation is the following:
β: Type u
m: measurable_space β
x: set β
h: m.is_measurable' x
⊢ measurable_space.generate_measurable m.is_measurable' x
Here I know that the inductively generated type measurable_space.generate_measurable m.is_measurable'
must at least make every set measurable which is in m.is_measurable' due to the constructor basic.
I couldn't manage to do induction on measurable_space.generate_measurable m.is_measurable... how can I use that with the basic case I can finish my proof?
Reid Barton (Oct 19 2020 at 16:19):
There is nothing to induct on here, just use the constructor basic
as you said.
Reid Barton (Oct 19 2020 at 16:21):
Induction is the opposite process--"destructing" a value of type generate_measurable ...
. Here generate_measurable
is in the goal, so you want to construct a value, which is what the constructors do.
Golol (Oct 19 2020 at 16:24):
Oh of course, I was totally stuck on this. Finally done!
Last updated: Dec 20 2023 at 11:08 UTC