Zulip Chat Archive

Stream: new members

Topic: None theorem


Ken Roe (Sep 01 2018 at 18:09):

Does someone know what tactic to use to prove the following:

theorem nonethm {t} : (none <|> none)=@none t:=
begin
    ...
end

Chris Hughes (Sep 01 2018 at 18:13):

theorem nonethm {t} : (none <|> none)=@none t:= rfl

Mario Carneiro (Sep 01 2018 at 18:23):

lol. by simp also works if you have import data.option

Patrick Massot (Sep 01 2018 at 19:27):

Chris, you lose: Ken asked for a tactic. The best answer was refl :yum:

Patrick Massot (Sep 01 2018 at 19:37):

A slightly more serious answer: I think stating the result as theorem nonethm {t} : (none <|> none)= (none : option t) makes it easier to read. I mention this because it's a general trick: you can often avoid using @ by adding a type ascription.

Ken Roe (Sep 01 2018 at 20:04):

Thanks. A couple more questions:
1) I found data/option.lean in mathlib. Where should I place the mathlib repository with respect to the Lean repository? How do I configure VSCode so that it starts Lean with the appropriate search path?

2) Next, how do I prove the theorem:

theorem nonethm {t} {x:option t} : (x <|> none)=x:= begin
    ...
end

Kenny Lau (Sep 01 2018 at 20:07):

theorem nonethm {t} {x : option t} : (x <|> none) = x :=
begin
  cases x; refl
end

Bryan Gin-ge Chen (Sep 01 2018 at 20:10):

For question 1 I recommend using leanpkg. The advice on the xena blog is a little old but still worked for me a month or so ago.


Last updated: Dec 20 2023 at 11:08 UTC