Zulip Chat Archive

Stream: new members

Topic: Access the fact patterns overlap in induction


ooovi (Nov 20 2024 at 10:00):

Hi! If my pattern match has overlapping patterns, is there a way to use my knowledge that the current case is none of the previous cases? For example:

import Mathlib.Data.Nat.Defs

def p (n : ) : Bool := sorry

lemma pos : 1 < n  (p n = true) := sorry
lemma zer : p 0 = true := sorry
lemma one : p 1 = true := sorry

lemma all : (n : )  (p n = true)
| 0 => zer
| 1 => one
| n + 1 => pos _

In the last line, I'd like to have a proof that 1 < n + 1. Is it hiding somewhere?

Henrik Böving (Nov 20 2024 at 10:39):

I would suggest to match on n + 2 instead


Last updated: May 02 2025 at 03:31 UTC