ChatGPT imitates logical reasoning surprisingly well.

Escape Velocity Labs
7 min readDec 23, 2022

--

A representation of ChatGPT as a virtual assistant.

Get a monthly compilation of the greatest advancements in AI straight to your inbox: https://www.evlabs.io/joinus

The way we interact with machines is about to change. You probably already know about ChatGPT, or maybe you have even tried it. A few weeks ago, OpenAI released an artificial intelligence with this name that surprised the world, and within five days it had more than a million users. This AI is capable of maintaining natural and coherent conversations as a person would. And not only that, it is capable of drafting rental agreements, writing code to design a website, having surprisingly deep philosophical debates, and performing a vast amount of tasks that leave Siri, Alexa, and company in the dust.

However, ChatGPT is not the first AI of this kind that exists, in fact, it is based on another one, called GPT-3, only it is trained differently. And for years, a new version of this type of model has been released every few months. So, why has this AI caused such a stir? Well, because its ability to understand very complex instructions, the depth of its reasoning, and its ability to understand so well the nuances of natural language represent a tremendous jump in quality compared to the previous version.

But in this article, I propose that we go further. Let’s test the limits of ChatGPT and see if it is capable of imitating the logical reasoning of a human being.

To do this, we will start a conversation with a series of premises to see the conclusion it draws:

Me: All men are mortal. Socrates is a man. Therefore…

ChatGPT: Therefore, Socrates is mortal. This is an example of syllogism, which is a kind of logical argument that applies deductive reasoning to arrive at a conclusion based on two premises that are asserted or assumed to be true. In this case, the first premise is “All men are mortal,” and the second premise is “Socrates is a man.” From these two premises, it logically follows that the conclusion “Socrates is mortal” must be true.

Me: Isn’t the logical conclusion: “All men are Socrates”?

ChatGPT: No, the logical conclusion of the syllogism “All men are mortal. Socrates is a man. Therefore…” is “Socrates is mortal.”

The first premise, “All men are mortal,” asserts that all members of the group “men” have a certain attribute, namely being mortal. The second premise, “Socrates is a man,” asserts that Socrates belongs to the group “men.” From these two premises, it logically follows that Socrates must also have the attribute that is shared by all members of the group “men,” which in this case is being mortal.

Therefore, the logical conclusion of the syllogism is that Socrates is mortal, not that “all men are Socrates.”

Me: I understand. Can you explain it to me using logic? You know, “p implies q”, that sort of thing.

ChatGPT: Sure! In logic, the symbol “⇒” is used to represent the logical connective “implies,” so that “p ⇒ q” means “if p, then q.”

In the syllogism “All men are mortal. Socrates is a man. Therefore, Socrates is mortal,” we can represent the first premise as “p: All men are mortal” and the second premise as “q: Socrates is a man.” The conclusion, “Socrates is mortal,” can be represented as “r: Socrates is mortal.”

Using this notation, we can restate the syllogism as follows:

p: All men are mortal

q: Socrates is a man

Therefore,

r: Socrates is mortal

This syllogism is valid because it follows the rule of modus ponens, which states that if p implies r and p is true, then r must also be true. In this case, the first premise “p: All men are mortal” implies the conclusion “r: Socrates is mortal,” and the second premise “q: Socrates is a man” establishes that p is true. Therefore, the conclusion “r: Socrates is mortal” must also be true.

Me: Okay. Can you explain it to me using first-order logic?

ChatGPT: Certainly! In first-order logic, we can use predicate logic to represent the syllogism “All men are mortal. Socrates is a man. Therefore, Socrates is mortal.”

First, we need to define the predicates and constants that we will use in our representation. In this case, let’s define the following:

  • M(x): x is a man
  • Mo(x): x is mortal

We can then represent the first premise, “All men are mortal,” as ∀x(M(x) ⇒ Mo(x)), which means “for all x, if x is a man, then x is mortal.”

We can represent the second premise, “Socrates is a man,” as M(s), where “s” is a constant that represents Socrates.

From these two premises, we can deduce the conclusion “Socrates is mortal” using modus ponens:

M(s) premise

∀x(M(x) ⇒ Mo(x)) premise

Mo(s) modus ponens

This means that if we assume the two premises to be true, then the conclusion “Socrates is mortal” must also be true.

In first-order logic, we can also use quantifiers to express the concept of “all” and “some.” In this case, the quantifier ∀ (pronounced “for all”) is used to express the concept of “all,” while the quantifier ∃ (pronounced “there exists”) is used to express the concept of “some.” For example, the statement ∀x(M(x) ⇒ Mo(x)) can be read as “for all x, if x is a man, then x is mortal,” while the statement ∃x(M(x) ∧ ¬Mo(x)) can be read as “there exists an x such that x is a man and x is not mortal.”

Me: I understand. According to my premises, is Zeus mortal?

ChatGPT: It is not possible for me to determine whether Zeus is mortal based on the information you have provided. In order to assess whether Zeus is mortal, we would need to know whether Zeus belongs to the group of beings described in the first premise of your syllogism as “men” and whether the attribute of being mortal is applicable to that group.

Without knowing more about the context and definitions of the predicates and constants used in your syllogism, it is not possible for me to draw any conclusions about Zeus’ mortality.

Me: What if I tell you that Zeus is a god and no god is mortal? Could we then conclude that Zeus is mortal? Tell me using first-order logic.

ChatGPT: If you tell me that “Zeus is a god” and “no god is mortal,” then we can use first-order logic to represent these statements as follows:

G(z): Zeus is a god

¬∃x(G(x) ∧ Mo(x)): No god is mortal

Using these representations, we can conclude that Zeus is not mortal as follows:

G(z) premise

¬∃x(G(x) ∧ Mo(x)) premise

¬Mo(z) modus tollens

This means that if we assume the two premises to be true, then the conclusion “Zeus is not mortal” must also be true.

In this case, the first premise “G(z): Zeus is a god” establishes that Zeus belongs to the group of beings described as “gods,” while the second premise “¬∃x(G(x) ∧ Mo(x)): No god is mortal” asserts that no member of the group “gods” is mortal. From these two premises, it logically follows that Zeus, being a member of the group “gods,” must not be mortal.

I hope this helps! Let me know if you have any other questions.

Me: What if I tell you that Hercules is a man and a god? Can we then decide if he’s mortal or immortal?

ChatGPT: It is not possible to determine whether Hercules is mortal or immortal based on the information you have provided. In order to assess Hercules’ mortality, we would need to know whether the attribute of being mortal or immortal is applicable to the group of beings to which Hercules belongs.

If you tell me that “Hercules is a man and a god,” we can represent these statements in first-order logic as follows:

M(h): Hercules is a man

G(h): Hercules is a god

These statements do not provide sufficient information to determine whether Hercules is mortal or immortal, because they do not specify the attributes that apply to the groups “men” and “gods,” or whether these attributes are mutually exclusive.

For example, it is possible that both “men” and “gods” are mortal, in which case Hercules would be mortal as both a man and a god. On the other hand, it is also possible that “men” are mortal and “gods” are immortal, in which case Hercules would be immortal as a god but mortal as a man.

Without knowing more about the context and definitions of the predicates and constants used in your syllogism, it is not possible to draw any conclusions about Hercules’ mortality.

Me: Thank you. I don’t think I’ll be able to sleep tonight.

ChatGPT: I’m sorry if my responses have caused you any difficulty sleeping. Please remember that logic and syllogisms are just tools for analyzing and evaluating arguments and that it is important to carefully consider the premises and definitions used in any argument before accepting its conclusion as true.

If you are having trouble sleeping, I recommend practicing good sleep hygiene, which includes establishing a consistent sleep schedule, creating a relaxing bedtime routine, and creating a sleep-friendly environment. Avoiding caffeine and screens close to bedtime, and engaging in relaxation techniques such as deep breathing or meditation can also help promote better sleep.

If you continue to have difficulty sleeping or have other concerns about your sleep, it may be helpful to speak with a healthcare provider or a mental health professional for further guidance and support.

Honestly, I wasn’t expecting such good results. Nevertheless, ChatGPT is not free from errors. In fact, when I tried to repeat the conversation, it responded that being mortal implies being a man, or ∀x(Mo(x) ⇒ M(x)), which is wrong. However, when I pointed out that there was an error in its reasoning, it was able to find and correct it, and even apologized for it. Also, sometimes the arguments it gives are a little repetitive and even circular.

Despite what may seem, this AI is not capable of symbolic reasoning, but rather uses all the knowledge of the internet that has been involved in its training to identify how a human would have responded to our questions.

However, that does not make it any less impressive. Look at the last questions. When we talked to it about Zeus, it knew from the context that we were doing logic exercises, and treated it as a new object, recognizing that it did not have enough information about it to reach a conclusion. Or when we talked to it about Hercules, and it told us that it cannot decide anything about his mortality.

Get a monthly compilation of the greatest advancements in AI straight to your inbox: https://www.evlabs.io/joinus

--

--

Escape Velocity Labs

Escape Velocity Labs is an online learning platform focused on data science and artificial intelligence.