Zulip Chat Archive
Stream: general
Topic: set exponentiation in mathlib
ZHAO Jinxiang (Jul 09 2022 at 09:20):
Is there any definition standing for set exponentiation in lean's mathlib?
https://en.wikipedia.org/wiki/Function_(mathematics)#Set_exponentiation
Eric Rodriguez (Jul 09 2022 at 09:22):
X → Y
ZHAO Jinxiang (Jul 09 2022 at 09:26):
I'm asking this, because I want to prove Y ^ ∅ = { ∅ }
and ∅ ^ X = ∅
.
Eric Wieser (Jul 09 2022 at 09:30):
Or maybe docs#set.pi
Eric Wieser (Jul 09 2022 at 09:32):
Your second lemma is docs#set.pi_eq_empty, but your first lemma isn't true for that definition
Eric Rodriguez (Jul 09 2022 at 09:32):
docs#function.is_empty is one way you could state the second one. docs#pi.unique_of_is_empty is also a way to state the second one, although a bit harder to understand why
Kevin Buzzard (Jul 09 2022 at 10:02):
ZHAO Jinxiang said:
I'm asking this, because I want to prove
Y ^ ∅ = { ∅ }
and∅ ^ X = ∅
.
They can't both be true :-)
Kevin Buzzard (Jul 09 2022 at 10:02):
Lean uses type theory, not set theory: for example, the empty function is not equal to the empty type.
Patrick Johnson (Jul 09 2022 at 10:40):
What you probably want is docs#Set.funs. You can define set exponentiation as
local infixr ` ^ `:80 := λ a b, Set.funs b a
and you can prove your theorems:
Y ^ ∅ = {∅}
∅ ^ X = ∅
Eric Rodriguez (Jul 09 2022 at 11:57):
should you not instead do it by giving Set
a has_pow
instance? (also, Zhao, note that docs#Set is what you do _solely_ for set theory - for normal mathematics, you'd use a type)
Patrick Johnson (Jul 09 2022 at 12:21):
Eric Rodriguez said:
should you not instead do it by giving
Set
ahas_pow
instance?
Of course, has_pow
instance would be better, but I can't make it work for some reason.
instance : has_pow Set Set := ⟨λ a b, Set.funs b a⟩
variables {X Y : Set}
#check X ^ Y -- failed to synthesize type class instance for `has_pow Set Set`
Maybe I made some silly mistake?
Eric Rodriguez (Jul 09 2022 at 12:25):
it's a universe issue, funs
is only defined on the same universe so Lean gets confused unless you specify everything:
import set_theory.zfc
universes u
instance : has_pow Set.{u} Set.{u} := ⟨λ a b, Set.funs b a⟩
variables {X Y : Set.{u}}
#check X ^ Y
Eric Rodriguez (Jul 09 2022 at 12:25):
(the .{u}
s are a bit redundant on the first one, but they're there to show a point)
Patrick Johnson (Jul 09 2022 at 12:34):
Thinking about it, maybe this is a special case when local notation is better. Defining a has_pow
instance would require type annotations for ∅
and {...}
whenever Lean can't unambiguously infer the Set
type for has_pow
and it will make theorem statements uglier. And besides that, ZFC theory is pretty much exclusive regarding the rest of mathlib, so when working in set theory we usually don't need other has_pow
instances anyway.
Violeta Hernández (Jul 09 2022 at 15:58):
Eric Rodriguez said:
should you not instead do it by giving
Set
ahas_pow
instance? (also, Zhao, note that docs#Set is what you do _solely_ for set theory - for normal mathematics, you'd use a type)
More specifically, it's what you use solely for ZFC set theory. I don't think it's even used in mathlib outside of the file it's defined in.
Violeta Hernández (Jul 09 2022 at 16:01):
Yeah haha, set_theory/zfc.lean
is a leaf file
Last updated: Dec 20 2023 at 11:08 UTC