Zulip Chat Archive

Stream: mathlib4

Topic: empty type


Heather Macbeth (Oct 18 2022 at 16:05):

I am trying to port data.fin.fin2 and came up with the following tactic proof involving an empty type; what would be the term version?

open Nat

inductive Fin2 :   Type
  |
  /-- `0` as a member of `fin (succ n)` (`fin 0` is empty) -/
  fz {n} : Fin2 (succ n)
  |
  /-- `n` as a member of `fin (succ n)` -/
  fs {n} : Fin2 n  Fin2 (succ n)

def elim0 {C : Fin2 0  Sort u} :  i : Fin2 0, C i :=
  fun i => by cases i

In Lean 3 it is

def elim0 {C : fin2 0  Sort u} : Π (i : fin2 0), C i.

Jannis Limperg (Oct 18 2022 at 16:10):

def elim0 {C : Fin2 0  Sort u} :  i : Fin2 0, C i :=
  fun i => nomatch i

Mario Carneiro (Oct 18 2022 at 18:14):

import Std.Tactic.NoMatch

def elim0 {C : Fin2 0  Sort u} :  i : Fin2 0, C i := fun.

is the equivalent of the lean 3 syntax

Mario Carneiro (Oct 18 2022 at 18:16):

it acts similar to fun i => nomatch i, except it will introduce all arguments and look for empty pattern matches on all of them.

Heather Macbeth (Oct 18 2022 at 18:18):

Aha, thank you both. Mathport had correctly produced Mario's version, but it didn't have the import.

Heather Macbeth (Oct 18 2022 at 18:18):

So presumably this issue will go away as we move up the hierarchy.

Mario Carneiro (Oct 18 2022 at 18:20):

Yes, if mathport ever produces a syntax that doesn't work, try to find the import that makes it work rather than stubbing it out (unless that import is Mathlib.Mathport.Syntax since those syntaxes haven't been implemented yet)

Mario Carneiro (Oct 18 2022 at 18:21):

Mathport cheats by using import Mathlib itself


Last updated: Dec 20 2023 at 11:08 UTC