Zulip Chat Archive

Stream: new members

Topic: proof terms for "use" and "cases" tactics


Jia Ming Lim (Jul 19 2020 at 15:34):

Hello! I'm halfway through chapter 3 of mathematics_in_lean and was wondering how prove something like the example below in proof term mode. It is straightforward with tactics but I don't think the tutorials teaches you the proof term alternatives for these two tactics.

example {x : } (h : a, x < a) : b, x < b * 2 :=
begin
    cases h with a h,
    use a / 2,
    linarith,
end

Sebastien Gouezel (Jul 19 2020 at 15:36):

example {x : } (h : a, x < a) : b, x < b * 2 :=
let a, ha := h in a/2, by linarith

Jia Ming Lim (Jul 19 2020 at 15:37):

Thank you so much!

Johan Commelin (Jul 19 2020 at 15:41):

Jia Ming Lim said:

but I don't think the tutorials teaches you the proof term alternatives for these two tactics.

Note that this is by design.

Jia Ming Lim (Jul 19 2020 at 15:50):

ahh right, thanks

Kevin Buzzard (Jul 19 2020 at 15:54):

There's no term mode equivalent for linarith, it does hard work in general. You might well be able to find the lemma saying that if d isn't 0 then a/d*d=a using library_search and then you could use that -- but the whole linarith philosophy is that this gets pretty boring very quickly

Jia Ming Lim (Jul 19 2020 at 16:02):

yeah hahah it's fun to search for the lemmas at first but then linarith starts to look too good to avoid

Bryan Gin-ge Chen (Jul 19 2020 at 16:06):

For cases, 7.6 of #tpil gives a decent explanation of what's going on. (If you find yourself wondering how things work under the hood, TPIL is a good place to start looking).

Jia Ming Lim (Jul 19 2020 at 16:11):

Coool now I have something to look forward to in that book. Thank you!


Last updated: Dec 20 2023 at 11:08 UTC