leanprover / lean3

Lean Theorem Prover
http://leanprover.github.io/
Apache License 2.0
2.15k stars 217 forks source link

[Question]: Proving false vs proving double negation #1993

Closed domfarolino closed 5 years ago

domfarolino commented 5 years ago

Prerequisites

Description

First off, sorry for filing this bug. I imagine this isn't the best place to ask questions, however it appears the (unofficial?) IRC channel is not really active, and I didn't know where else to ask.

So I know that given how negation (illustrated in chapter 3) works, to prove not A, we need to prove false from A:

image

In lean, a stupid example might look like:

example : ¬ B -> ¬ B :=
  assume h1 : ¬ B,
  assume h2: B,
  show false, from h1 h2

Basically, we get to assume two things:

...as long as we can prove false from one of the contributing assumptions, we can prove the original negation of the RHS (probably not the best explanation, but that is kind of how I see it). I was reading chapter 5 about proof by contradiction, and saw that we can prove some fancy things, with double negations, like A ↔ ¬ ¬ A, via proof by contradiction. We can proof this in two steps:

The book illustrated the first direction of the proof as:

image

...I figured that since this looked incredibly similar to the first example above, we can assume two things:

...to me it seems that by proving false, from these contributing assumptions, we get to prove the original negation of the RHS (¬ ¬ A) holds. The program I came up with is as follows:

example : B -> ¬¬ B :=
  assume h1 : B,
  assume h2: ¬B,
  show ¬¬B, from h2 h1

...however Lean doesn't seem to like this. The error basically says what I expect to be valid h2 h1 has type false, expected ¬¬ B. I don't really see why this wouldn't be valid though, since we are essentially using the pattern from the first (simpler) version. I guess the double negation breaks some assumption I made when learning Lean. The real confusion is that the following works (and is what the book uses in an example):

example : B -> ¬¬ B :=
  assume h1 : B,
  show ¬¬B, from assume h2: ¬B, h2 h1

...AFAICT, h2 h1 still evaluates to false, and there only seems to be a positional change between the programs. Could someone please explain why the second works while the first fails, when they seem nearly semantically identical?

Thank you!

Versions

3.4.2

digama0 commented 5 years ago

The best place to ask questions like this is the Zulip chat: https://leanprover.zulipchat.com/

domfarolino commented 5 years ago

Thank you for checking out the chat thread. Will close this and continue there.