leanprover / lean4

Lean 4 programming language and theorem prover

Home Page:https://lean-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFC: Add `impossible` tactic to lean

lovely-error opened this issue · comments

Currently, when a user is posed with the goal to prove a goal represented by an empty type in an empty context, doing so proves impossible; meaning that when seeing this...

⊢ Empty

...the only option is to fall into agonizing rage.

Enter the impossible tactic.
The idea for it is to be able to close goals which are not constructible, e.i. they don't have constructors.

As an example, both example below would be accepted

def v : Empty := by impossible
def v'' : (m:Bool) -> match m with | true => Unit | false => Empty
| true => ()
| false => by impossible

This new tactic would simplify working in lean considerably!

What you ask does not make sense in the logic of Lean. I suspect people were already trying to tell you that in this discussion, which should be continued there and not in an issue tracker: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/What.20to.20do.20with.20empty.3F

What you ask does not make sense in the logic of Lean.

Well, I found a way to make what I ask in lean as it is.

def Empty2 : Type := Empty -> Unit
def impossible : Empty -> Unit := nofun
def n3 : (n:Nat) -> match n with | .zero => Empty2 | .succ _ => Nat
| n@(.succ _) => n
| .zero => impossible

#eval n3 1 -- works
-- #eval n3 0 -- doesnt