Zulip Chat Archive
Stream: new members
Topic: powerset and subtypes
Bjørn Kjos-Hanssen (Sep 12 2021 at 06:16):
Is there a way to connect the subtype {B // B ⊆ A}
with the set A.powerset
so as to prove the following?
variables {V : Type*} [decidable_eq V]
theorem card_and_subtype_difficulty (F : finset (finset V)) (A : finset V)
(φ : {B // B ⊆ A} → {C : finset V // C ∈ F}) :
function.injective φ →
A.powerset.card ≤ F.card :=
sorry
Or would it be possible to just directly say {B // B ⊆ A}).card ≤ {C : finset V // C ∈ F}.card
somehow?
Kevin Buzzard (Sep 12 2021 at 07:24):
I'm not at lean right now but it seems to me that the result you want follows from more primitive results such as if f : X -> Y
is injective then card X <= card Y and so on. What you seem to need is a bijection between your subtype and A.powerset. This bijection will have an explicit two-sided inverse so you can use equiv
to do this. Is A.powerset
really a set?
Kevin Buzzard (Sep 12 2021 at 07:24):
Kevin Buzzard (Sep 12 2021 at 07:27):
It's a finset so it can be promoted to a type and you could write down an equiv between it and your type of subsets. Will probably be slightly fiddly
Bjørn Kjos-Hanssen (Sep 12 2021 at 07:32):
Thanks @Kevin Buzzard . Maybe there's a way to avoid powerset
altogether and just talk about cardinality of types?
Kevin Buzzard (Sep 12 2021 at 07:36):
Sure, there's something like docs#nat.card
Bjørn Kjos-Hanssen (Sep 12 2021 at 18:15):
Somehow I'm not able to import set_theory.fincard
even though I can import set_theory.cardinal
... and when I drop the set_theory.fincard
file into my directory then it has errors like invalid field notation, 'to_nat' is not a valid "field" because environment does not contain 'cardinal.to_nat'
mk α
which has type
cardinal
Adam Topaz (Sep 12 2021 at 20:10):
@Bjørn Kjos-Hanssen In case you're still stuck, here's a proof of your lemma:
This will also show you how to go between finset.card
and cardinality
, and the names of some lemmas that help proving that cardinals are equal.
Adam Topaz (Sep 12 2021 at 20:11):
This lemma can probably be golfed into just a few lines, but this proof is probably a bit more readable.
Bjørn Kjos-Hanssen (Sep 12 2021 at 20:23):
Oh my. I'll use this, and maybe with time start to understand it! For now I do get an error though, rewrite tactic failed, did not find instance of the pattern in the target expression ?m_2 ∈ powerset ?m_3
at the line rw finset.mem_powerset at hB, exact hB
Adam Topaz (Sep 12 2021 at 20:25):
Oh strange... Maybe I was using an old version of mathlib?
Adam Topaz (Sep 12 2021 at 20:26):
Let me double check...
Adam Topaz (Sep 12 2021 at 20:28):
No, it works for me just fine. Could be a namespace issue?
Adam Topaz (Sep 12 2021 at 20:28):
Are you using this in a large file with more imports perhaps?
Adam Topaz (Sep 12 2021 at 20:29):
E.g. there may be a conflict with docs#set.powerset and docs#finset.powerset if both the finset
and set
namespaces are open.
Bjørn Kjos-Hanssen (Sep 12 2021 at 20:31):
Actually I pasted your code in a blank file now and it has the same error. My installation of Lean, VS Code, mathlib etc. is from about a year ago if that helps.
Bjørn Kjos-Hanssen (Sep 12 2021 at 20:33):
But I see that your code works in the Lean Web Editor @Adam Topaz
Adam Topaz (Sep 12 2021 at 20:36):
Oh, you probably need to upgrade mathlib. Do you have mathlib-tools installed? If so, you can use the command leanproject upgrade-mathlib
(but be prepared for some code to break if your current mathlib is ~1 year old)
Adam Topaz (Sep 12 2021 at 21:23):
Here's a reasonably golfed proof of this:
import set_theory.cardinal
import data.finset.powerset
variables {V : Type*} [decidable_eq V]
theorem card_and_subtype_difficulty (F : finset (finset V)) (A : finset V)
(φ : {B // B ⊆ A} → {C : finset V // C ∈ F}) :
function.injective φ →
A.powerset.card ≤ F.card :=
begin
intro h,
rw ← cardinal.nat_cast_le,
convert cardinal.mk_le_of_injective h,
{ rw [cardinal.finset_card, cardinal.eq],
exact ⟨⟨λ B, ⟨B, by simpa [finset.mem_powerset] using B.2⟩,
λ B, ⟨B, by simpa [finset.mem_powerset] using B.2⟩, λ B, by simp, λ B, by simp⟩⟩ },
{ exact cardinal.finset_card },
end
Last updated: Dec 20 2023 at 11:08 UTC