Zulip Chat Archive

Stream: new members

Topic: Cast exercise


Nicolò Cavalleri (Jul 30 2021 at 11:43):

I am still very bad at proofs involving cast. Can I prove something like this?

example {α : Type*} {β : Type*} {γ : Type*} (h1 : (α × γ) = (β × γ)) (h2 : α = β) (a : α) (g : γ) :
  (cast h1 (a, g)).fst = cast h2 a := sorry

Eric Rodriguez (Jul 30 2021 at 11:46):

I'd really avoid type equality and focus on equivs if you can

Nicolò Cavalleri (Jul 30 2021 at 11:48):

What do you mean exactly?

Kevin Buzzard (Jul 30 2021 at 11:48):

h1 : (α × γ) = (β × γ) is an evil hypothesis.

Kevin Buzzard (Jul 30 2021 at 11:49):

Equality of types is like equality of objects in category theory -- it should be avoided if possible.

Nicolò Cavalleri (Jul 30 2021 at 11:51):

What does evil hypothesis mean? In my specific case I have a proof of both h1 and h2, so that should not be a problem

Nicolò Cavalleri (Jul 30 2021 at 11:51):

I am pretty sure I cannot avoid type equality

Eric Wieser (Jul 30 2021 at 11:52):

by { subst h2, refl }

Nicolò Cavalleri (Jul 30 2021 at 11:52):

Thank you very much!!

Eric Wieser (Jul 30 2021 at 11:55):

For someone more familiar with type equality - is this statement provable?

lemma prod_right_injective {α β γ} (h : (α × β) = (α × γ)) : β = γ :=
begin
  sorry
end

Kevin Buzzard (Jul 30 2021 at 12:58):

this is a pathological question

Kevin Buzzard (Jul 30 2021 at 12:59):

lol an interesting special case is \a = empty

Kevin Buzzard (Jul 30 2021 at 13:02):

@Nicolò Cavalleri here's some philosophy https://ncatlab.org/nlab/show/principle+of+equivalence but remember this: if you want to make your own mathlib in Lean 4 then you could make it so that nat = int was true, or you could make it so that it was unprovable, and all the proofs would still work, so there is something irrelevant about the question which as a mathematician you would not expect.

Eric Wieser (Jul 30 2021 at 13:06):

Which would look something like

def weird_int := nat

def weird_int.to_int (n : weird_int) : int : if nat.even n then n / 2 else -1 - n/2

instance : add_comm_group weird_int := equiv.add_comm_group sorry

Mario Carneiro (Jul 30 2021 at 13:08):

Eric Wieser said:

For someone more familiar with type equality - is this statement provable?

lemma prod_right_injective {α β γ} (h : (α × β) = (α × γ)) : β = γ :=
begin
  sorry
end

It's not disprovable, but the cardinality model falsifies it if you set α = β = empty and γ = unit

Eric Wieser (Jul 30 2021 at 13:10):

I don't really get what you mean by falsifies it. You mean it's false in a model where = iff equiv?

Mario Carneiro (Jul 30 2021 at 13:10):

yes

Kevin Buzzard (Jul 30 2021 at 13:11):

Set theory is the same -- you can ask if the quaternion 37π2+i+k37\pi^2+i+k equals the Riemann Sphere S1S^1 in set theory. The answer is "it's unlikely, but in theory it could happen".

Mario Carneiro (Jul 30 2021 at 13:11):

even if you assume alpha is nonempty it's still false in the cardinality model with α = β = nat and γ = unit

Mario Carneiro (Jul 30 2021 at 13:12):

Actually, in set theory the answer is usually answerable (and false)

Kevin Buzzard (Jul 30 2021 at 13:13):

but what about independent developments with their own tricks?

Mario Carneiro (Jul 30 2021 at 13:13):

the "in theory it could happen" is quantifying over possible concrete implementations of the concepts

Mario Carneiro (Jul 30 2021 at 13:13):

for any particular implementation the question is a well defined "junk theorem"

Kevin Buzzard (Jul 30 2021 at 13:13):

oh sure

Kevin Buzzard (Jul 30 2021 at 13:13):

you just make a type theory on top of your set theory

Mario Carneiro (Jul 30 2021 at 13:13):

lean just makes most junk statements either type incorrect or independent


Last updated: Dec 20 2023 at 11:08 UTC