Zulip Chat Archive
Stream: general
Topic: Formalizing St. Anselm's ontological argument
Bulhwi Cha (Oct 26 2023 at 12:33):
This might be the first second attempt in the Lean community to formalize an ontological argument for the existence of God in Lean. It's a modified version of the formulation of St. Anselm's ontological argument by Alvin Plantinga. (See 9.1 Formulation 1 of the SEP entry "Ontological Arguments.")
- God exists in the understanding but not in reality. (Assumption for reductio)
- Existence in reality is greater than existence in the understanding alone. (Premise)
- There exists a being in reality that can be conceived. (Modified premise)
- A being that exists in reality and can be conceived is greater than God. (From (1) and (2).)
- There exists a being that can be conceived and is greater than God. (From (3) and (4).)
- No being greater than God can be conceived. (From the definition of “God”.)
- Hence, it is false that God exists in the understanding but not in reality. (From (1), (5), (6).)
- God exists in the understanding. (Premise, to which even the Fool agrees.)
- Hence God exists in reality. (From (7), (8).)
- Git repository: https://git.sr.ht/~chabulhwi/lean-notes
- Lean code: https://git.sr.ht/~chabulhwi/lean-notes/tree/master/item/Notes/Anselm.lean
- English documentation: https://git.sr.ht/~chabulhwi/lean-notes/tree/master/item/docs/en/Anselm.md
- Korean documentation: https://git.sr.ht/~chabulhwi/lean-notes/tree/master/item/docs/ko/Anselm.md
Lean code (flawed)
Reference
Oppy, Graham, "Ontological Arguments", The Stanford Encyclopedia of Philosophy (Fall 2023 Edition), Edward N. Zalta & Uri Nodelman (eds.), URL = <https://plato.stanford.edu/archives/fall2023/entries/ontological-arguments/>.
Bulhwi Cha (Oct 26 2023 at 12:35):
I'll write more messages later. I don't think St. Anselm's demonstrates shows God's existence.
Eric Wieser (Oct 26 2023 at 12:43):
Unfortunately this argument is contradictory as formalized:
example : False :=
letI : Conceivable Unit := ⟨fun _ => True⟩
letI : InUnderstanding Unit := ⟨fun _ => False⟩
isGod_inUnderstanding (x := ()) ⟨trivial, fun _ => trivial⟩
Damiano Testa (Oct 26 2023 at 12:48):
Rather than "unfortunately", I guess you meant "and hence the proof of existence of God is complete", right?
Eric Wieser (Oct 26 2023 at 12:51):
Of course, what I should have said is "here's a much shorter proof":
def key :=
letI : Conceivable Unit := ⟨fun _ => True⟩
letI : InUnderstanding Unit := ⟨fun _ => False⟩
isGod_inUnderstanding (x := ()) ⟨trivial, fun _ => trivial⟩
theorem isGod_inReality : ∀ {x : Being}, isGod x → inReality x := key.elim
theorem not_isGod_inReality : ∀ {x : Being}, isGod x → ¬inReality x := key.elim
Bulhwi Cha (Oct 26 2023 at 12:57):
@Eric Wieser What if I remove variable {Being : Type u}
and add the axiom axiom Being.{u} : Type u
?
Fixed code (still flawed)
Eric Wieser (Oct 26 2023 at 13:00):
Nope:
def key : False :=
letI : Conceivable Being.{0} := ⟨fun _ => False⟩
letI : InReality Being := ⟨fun _ => False⟩
let ⟨b, h⟩ := exists_conceivable_and_inReality
h.2.elim
theorem isGod_inReality : ∀ {x : Being}, isGod x → inReality x := key.elim
theorem not_isGod_inReality : ∀ {x : Being}, isGod x → ¬inReality x := key.elim
Bulhwi Cha (Oct 26 2023 at 13:02):
Hmm, I should understand how letI
works. After all, It's just an exercise. Thanks anyway.
Damiano Testa (Oct 26 2023 at 13:03):
Gödel also had a proof of existence of God: maybe we should have a God
folder in Mathlib.
Eric Wieser (Oct 26 2023 at 13:03):
letI
is irrelevant here, this works fine without it:
def key : False :=
let ⟨b, h⟩ := @exists_conceivable_and_inReality.{0} ⟨fun _ => False⟩ ⟨fun _ => False⟩
h.2.elim
Bulhwi Cha (Oct 26 2023 at 13:06):
I actually want to make a counterargument to St. Anselm's argument. But I guess I can't formalize the modified version of the proof correctly in Lean.
Bulhwi Cha (Oct 26 2023 at 13:10):
Will replacing type classes with axioms fix my formalization?
Eric Wieser (Oct 26 2023 at 13:11):
I think so, but it would probably be better to put the axioms in a typeclass instead
Eric Wieser (Oct 26 2023 at 13:12):
If you use axioms, then if they're false you can prove anything. If you use a typeclass and get something wrong, you can prove that the typeclass cannot exist but it doesn't break trust anywhere else
Bulhwi Cha (Oct 26 2023 at 13:12):
Eric Wieser said:
I think so, but it would probably be better to put the axioms in a typeclass instead
Okay, I'll try that!
Bulhwi Cha (Oct 26 2023 at 13:47):
I made a new type class, Anselm
:
class Anselm (Being : Type u) extends LinearOrder Being where
conceivable : Being → Prop
inUnderstanding : Being → Prop
inReality : Being → Prop
lt_of_inUnderstanding_not_inReality_inReality {x y : Being} : inUnderstanding x → ¬ inReality x →
inReality y → x < y
isMax_conceivable_inUnderstanding {x : Being} : isMax x conceivable → inUnderstanding x
exists_conceivable_and_inReality : ∃ (x : Being), conceivable x ∧ inReality x
Fixed code (final)
Bulhwi Cha (Oct 26 2023 at 14:44):
Bulhwi Cha said:
- There exists a being in reality that can be conceived. (Modified premise)
Step 3 of the original formulation by Alvin Plantinga is the following premise: "A being having all of God’s properties plus existence in reality can be conceived." This premise is redundant. Since God is the greatest being that can be conceived, God itself can be conceived. Therefore, a being having all of God's properties can be conceived.
theorem isGod_conceivable {x : Being} : isGod x → conceivable x := And.left
Bulhwi Cha (Oct 26 2023 at 15:09):
I think we can only conclude from St. Anselm's argument that the following statement is true:
theorem isGod_inReality {x : Being} : isGod x → inReality x
This theorem doesn't state that God exists in reality. It merely says that if a being is God, it exists in reality. In order to prove the existence of God in reality, you need to show that ∃ (x : Being), isGod x ∧ inReality x
.
For this reason, I think St. Anselm's argument doesn't show God's existence. Of course, I might have formalized it wrong.
Chris Hughes (Oct 26 2023 at 16:44):
The existence of god has been proven in Isabelle. Google shows me a couple of formalisations. But IIRC, there was some problem with the hypotheses being inconsistent, similar to what Eric found.
Bulhwi Cha (Oct 26 2023 at 17:29):
Thanks. I'll check those out when I have more time. I hope we see a future where more philosophers try out Lean and use it to formalize subdisciplines of philosophy.
Ruben Van de Velde (Oct 26 2023 at 17:35):
I have a feeling we already have plenty of doctors of philosophy here
Alistair Tucker (Oct 26 2023 at 19:33):
Bulhwi Cha said:
Step 3 of the original formulation by Alvin Plantinga is the following premise: "A being having all of God’s properties plus existence in reality can be conceived." This premise is redundant. Since God is the greatest being that can be conceived, God itself can be conceived. Therefore, a being having all of God's properties can be conceived.
The way I see it, we are being asked to conceive of beings with a separated property of existence/nonexistence in reality, for which we may use a Bool
. Then premise 3 does have content:
class Anselm (Being : Type u) extends LinearOrder (Being × Bool) where
Conceivable : Being × Bool → Prop
premise3 : ∀ x : Being × Bool, IsMax x Conceivable → Conceivable (x.1, true)
Alistair Tucker (Oct 26 2023 at 19:38):
The ordering on Being × Bool
also makes it possible to transcribe premise 2 more faithfully
premise2 : ∀ x : Being, (x, false) < (x, true)
Bulhwi Cha (Oct 27 2023 at 05:15):
@Alistair Tucker If we adopt your view, inReality
should also be a predicate on Being × Bool
, not Being
.
def inReality (x : Being × Bool) := x.2 = true
Then we can't say that "Bulhwi exists in reality," since I'm not a pair of a being and its existence property. I'm a being. So I think inReality
should be a predicate on Being
.
Alistair Tucker (Oct 27 2023 at 06:37):
Bulhwi Cha said:
Then we can't say that "Bulhwi exists in reality," since I'm not a pair of a being and its existence property. I'm a being. So I think
inReality
should be a predicate onBeing
.
I don't understand this point. You may well be a hallucination of mine i.e. (bulhwi, false)
. If not then (bulhwi, true)
.
Bulhwi Cha (Oct 27 2023 at 07:05):
My point is that Bulhwi
is neither ⟨Bulhwi, true⟩
nor ⟨Bulhwi, false⟩
. I'm a being, not a pair of a being and its existence property. Bulhwi
's type is and should be Being
, not Being × Bool
.
Alistair Tucker (Oct 27 2023 at 07:09):
Well you need some way to map between an object not having the existence property to one that does, which currently you don't have.
Bulhwi Cha (Oct 27 2023 at 07:11):
How would you do that?
Alistair Tucker (Oct 27 2023 at 07:11):
I have outlined one way. I'm sure there are others.
Bulhwi Cha (Oct 27 2023 at 07:30):
I don't feel like creating a type, say, BeingNoExist
, of "beings separated from their existence properties" and considering the type Being
to be equal to BeingNoExist × Bool
. It presupposes that ∃ (α : Type u), Being = α × Bool
.
Hypatia du Bois-Marie (Oct 27 2023 at 23:04):
I was thinking of something similar this week! https://github.com/analytic-bias/agora
Hypatia du Bois-Marie (Oct 27 2023 at 23:07):
Eric Wieser said:
Unfortunately this argument is contradictory as formalized:
example : False := letI : Conceivable Unit := ⟨fun _ => True⟩ letI : InUnderstanding Unit := ⟨fun _ => False⟩ isGod_inUnderstanding (x := ()) ⟨trivial, fun _ => trivial⟩
I think that's exactly the point: formal methods yielding fierce recognition of human fallacies.
Bulhwi Cha (Oct 28 2023 at 07:12):
Bulhwi Cha said:
I think we can only conclude from St. Anselm's argument that the following statement is true:
theorem isGod_inReality {x : Being} : isGod x → inReality x
A user of a Korean-speaking philosophy discussion forum said, "You didn't prove that ∃ (x : Being), isGod x ∧ inReality x
is not a theorem of a theory whose axioms are the premises of St. Anselm's argument (and the axioms of Lean's type theory)."
Bulhwi Cha (Oct 28 2023 at 07:15):
That's true. So I'll rephrase my opinion:
I think the conclusion of St. Anselm's argument is the following statement:
theorem isGod_inReality {x : Being} : isGod x → inReality x
Uranus Testing (Oct 28 2023 at 16:08):
Interesting to see another approach to the ontological proof. I tried once (original version was written in Lean 3, later ported to 4) “classical” modal version: https://github.com/forked-from-1kasper/ground_zero/blob/9f83f7c6224eee8905b16aeebc4c234b4b216031/GroundZero/Theorems/Ontological.lean#L520-L521
Uranus Testing (Oct 28 2023 at 16:12):
Chris Hughes said:
The existence of god has been proven in Isabelle. Google shows me a couple of formalisations. But IIRC, there was some problem with the hypotheses being inconsistent, similar to what Eric found.
There are actually several versions of original Gödel’s proof that correct this issue.
David Michael Roberts (Oct 30 2023 at 08:25):
Cf https://arxiv.org/abs/2202.06264
Last updated: Dec 20 2023 at 11:08 UTC