Zulip Chat Archive

Stream: new members

Topic: How to prove n.succ \geq 1 for nat n?


Sara Fish (Jul 17 2020 at 21:03):

Originally I wanted to prove

theorem nonzero_gt_one (n :  ): ¬ n = 0  n  1

I tried library_search but couldn't find anything. So I started to try to prove this theorem by hand and got stuck here.

theorem nonzero_gt_one (n :  ): ¬ n = 0  n  1 :=
begin
    intro h,
    induction n,
    exfalso, apply h, refl,
    sorry -- how to prove n_n.succ ≥ 1 ?
end

Once again, these seems like something library_search should be able to handle but nothing was coming up. I also typed "nat." in VSCode and manually looked through proven results about natural numbers but nothing seemed particularly applicable.

How can I prove this (frustratingly simple) theorem?

Jalex Stark (Jul 17 2020 at 21:05):

omega?

Jalex Stark (Jul 17 2020 at 21:05):

I think if you replace n \ge 1 with 1 \le n you will have more library_search luck

Sara Fish (Jul 17 2020 at 21:06):

omega did the trick, thanks. Forgot it exists.

Jalex Stark (Jul 17 2020 at 21:07):

library_search doesn't try as hard as you might expect to unify the goal with each theorem it compares it to

Jalex Stark (Jul 17 2020 at 21:07):

so it's sensitive to syntactic equality

Sara Fish (Jul 17 2020 at 21:07):

Replacing with \le still didn't work...is there any way to find out what omega did?

Jalex Stark (Jul 17 2020 at 21:08):

I think the omega algorithm doesn't naturally produce readable certificates

Bryan Gin-ge Chen (Jul 17 2020 at 21:08):

You can write show_term { omega }, but it's not going to be very enlightening.

Jalex Stark (Jul 17 2020 at 21:08):

also replace \n n = 0 with n \ne 0

Jalex Stark (Jul 17 2020 at 21:09):

this is another syntactic choice; in mathlib we try to consistently use \ne and \le in order to make search work (or at least, work up to knowing which expressions are "idiomatic" or "normal form")

Bryan Gin-ge Chen (Jul 17 2020 at 21:10):

There's some info on omega here: tactic#omega

Bryan Gin-ge Chen (Jul 17 2020 at 21:11):

I am a little surprised this one isn't in the library. I tried changing to \ne and \le and library_search and suggest still couldn't find a proof.

Reid Barton (Jul 17 2020 at 21:12):

theorem nonzero_gt_one (n : ℕ ): ¬ n = 0 → n ≥ 1 := nat.pos_of_ne_zero

Jalex Stark (Jul 17 2020 at 21:12):

suggest works for me here

import tactic

theorem nonzero_gt_one (n :  ): ¬ n = 0  n  1 :=
begin
  intro h,
  induction n,
  contrapose! h, { refl },
  suggest,
  --exact inf_eq_left.mp rfl,
  sorry -- how to prove n_n.succ ≥ 1 ?
end

Sara Fish (Jul 17 2020 at 21:13):

OK, I've learned to always try suggest and hint before posting here! :)

Sara Fish (Jul 17 2020 at 21:14):

(hint just told me to use omega)

Bryan Gin-ge Chen (Jul 17 2020 at 21:45):

I opened an issue about library_search: #3432

Alex J. Best (Jul 17 2020 at 23:09):

library_search! works for me for the original goal here (with the !) giving exact inf_eq_left.mp rfl, , but not for Bryans ticket


Last updated: Dec 20 2023 at 11:08 UTC