Zulip Chat Archive
Stream: Berkeley Lean Seminar
Topic: natural number game
Kyle Miller (May 27 2020 at 07:47):
In the advanced multiplication world, I was trying to prove something by cases, and one of the goals was 0 = succ b
. Is there a way to tell it that this is a contradiction? I thought 0
and succ
were constructors.
Kevin Buzzard (May 27 2020 at 11:16):
If your goal is 0 = succ b
then you can't make any further progress -- you'll have to get a contradiction from your hypotheses.
Kyle Miller (May 27 2020 at 18:01):
Oh right, thanks. Not sure why I thought that should have been possible. (In any case, I passed this pons asinorum -- somehow even after carefully thinking through the induction argument, it took 100x longer than all the exercises to that point. Inequality world has been fine so far, but a \le b \or b \le a
gave me pause since it didn't seem constructive at first.)
Jalex Stark (May 27 2020 at 18:05):
you don't need things to be constructive
Kyle Miller (May 27 2020 at 18:07):
How do you set up "assume not(a \le b)"? With everything I tried, Lean complained about how the existential wasn't decidable.
Jalex Stark (May 27 2020 at 18:07):
(also what does "i pass this pons asinorum means?)
Jalex Stark (May 27 2020 at 18:07):
by_cases a \le b
?
Jalex Stark (May 27 2020 at 18:08):
should apply the law of excluded middle to split your proof in two, in on branch you have a ≤ b
and in the other you have ¬ a ≤ b
Kyle Miller (May 27 2020 at 18:09):
"pons asinorum" referred to an early theorem in Euclid's elements that many had a difficult time getting through. (I think it's the one about the base angles of an isosceles triangle being the same.)
Jalex Stark (May 27 2020 at 18:09):
hah okay, i was confused because google told me exactly what it was, but i still didn't understand your meaning
Jalex Stark (May 27 2020 at 18:09):
is by_cases
what you want? or by_contradiction
?
Jalex Stark (May 27 2020 at 18:10):
Jalex Stark (May 27 2020 at 18:10):
ugh the linkifier doesn't work because the title of the relevant section is "by_contra / by_contradiction"
Kyle Miller (May 27 2020 at 18:11):
by_cases a \le b
gives by_cases tactic failed, type of given expression is not decidable state
Patrick Lutz (May 27 2020 at 18:11):
what is "the linkifier" btw?
Kyle Miller (May 27 2020 at 18:12):
I think the issue is that a \le b
is actually an existential statement, but I don't appreciate why it's not decidable yet
Jalex Stark (May 27 2020 at 18:12):
try typing tactic#simp
Patrick Lutz (May 27 2020 at 18:12):
@Kyle Miller I think it should be something like by_cases h : a \leq b
Patrick Lutz (May 27 2020 at 18:13):
Patrick Lutz (May 27 2020 at 18:13):
oh cool
Jalex Stark (May 27 2020 at 18:13):
can you give me the URL of the level you're playing?
Jalex Stark (May 27 2020 at 18:13):
it shouldn't matter that it's not decidable, because we're mathematicians
Kyle Miller (May 27 2020 at 18:13):
I think I used it without the h :
in earlier exercises, but it gives the same error.
Kyle Miller (May 27 2020 at 18:13):
https://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/?world=10&level=9
Jalex Stark (May 27 2020 at 18:14):
maybe you can tell it to not worry by using the classical
tactic
Kyle Miller (May 27 2020 at 18:14):
Indeed you can
Jalex Stark (May 27 2020 at 18:16):
when i write a lean file locally, i start with the following after my imports
noncomputable theory
open_locale classical
Jalex Stark (May 27 2020 at 18:17):
and I haven't had to worry about declaring classical
Jalex Stark (May 27 2020 at 18:17):
but i guess for the NNG this is required
Jalex Stark (May 27 2020 at 18:18):
for anyone following along at home, we came up with this proof script as a way to start off this level
classical,
by_cases a ≤ b,
Kevin Buzzard (May 27 2020 at 18:19):
If you open an issue I will fix this so that you don't have to put classical
Kyle Miller (May 27 2020 at 18:20):
How do you convert a not-exists into a for-all-not?
Patrick Lutz (May 27 2020 at 18:20):
Kyle Miller (May 27 2020 at 18:24):
The next question would be how you import tactic.push_neg
from within the body of a proof.
Kevin Buzzard (May 27 2020 at 18:24):
aargh
Kevin Buzzard (May 27 2020 at 18:24):
You should just clone the repo and fill in the sorrys in VS Code, adding imports which you need :D
Kyle Miller (May 27 2020 at 18:25):
Anyway, I'm just trying the classical version as an exercise. I got a perfectly good induction argument.
Kyle Miller (May 27 2020 at 18:39):
I probably should have followed Kevin Buzzard's advice, but I pushed through and did push_neg
by hand, so now I have
a b : mynat,
_inst : Π (a : Prop), decidable a,
h : ¬a ≤ b,
f : ∀ (c : mynat), a + c ≠ b
⊢ b ≤ a
I'm not seeing how I would prove this from f
.
Patrick Lutz (May 27 2020 at 18:40):
well, at some point you'll probably have to use induction
Kevin Buzzard (May 27 2020 at 19:06):
Do you have le_total yet?
Kyle Miller (May 27 2020 at 19:10):
This would be for le_total
itself. (Just finished the natural number game. It was a nice way to get acquainted with Lean! I knew a bit of Agda coming into it, which was likely helpful.)
Last updated: Dec 20 2023 at 11:08 UTC