# Propositional logic in Artificial Intelligence (AI)

In this page, we will learn about Propositional logic in Artificial intelligence, Propositional logic in Artificial intelligence, Following are some basic facts about propositional logic, Syntax of propositional logic, Logical Connectives, Truth Table, Truth table with three propositions, Precedence of connectives, Logical equivalence, Properties of Operators, Limitations of Propositional logic Frame Representation.

## Propositional logic in Artificial intelligence

The simplest kind of logic is propositional logic (PL), in which all statements are made up of propositions. The term "Proposition"refers to a declarative statement that can be true or false. It's a method of expressing knowledge in logical and mathematical terms.

### Example:

1. It is Sunday.
2. The Sun rises from West (False proposition)
3. 3 + 3 = 7 (False proposition)
4. 5 is a prime number.

### Following are some basic facts about propositional logic:

• Because it operates with 0 and 1, propositional logic is also known as Boolean logic.
• In propositional logic, symbolic variables are used to express the logic, and any symbol can be used to represent a proposition, such as A, B, C, P, Q, R, and so on.
• Propositions can be true or untrue, but not both at the same time.
• An object, relations or functions, and logical connectives make up propositional logic.
• Logical operators are another name for these connectives.
• The essential parts of propositional logic are propositions and connectives.
• Connectives are logical operators that link two sentences together.
• Tautology, commonly known as a legitimate sentence, is a proposition formula that is always true.
• Contradiction is a proposition formula that is always false.
• Statements that are inquiries, demands, or opinions are not propositions, such as "Where is Rohini","How are you", and "What is your name" are not propositions.

### Syntax of propositional logic:

The allowed sentences for knowledge representation are defined by the syntax of propositional logic. Propositions are divided into two categories:

1. Atomic Propositions.
2. Compound propositions.
• Atomic propositions: Simple assertions are referred to as atomic propositions. It is made up of only one proposition sign. These are the sentences that must be true or untrue in order to pass.

Example:
1. 2+2 is 4, it is an atomic proposition as it is a true fact.
2. "The Sun is cold" is also a proposition as it is a false fact.
• Compound proposition: Simpler or atomic statements are combined with parenthesis and logical connectives to form compound propositions.

Example:
1. "It is raining today, and street is wet."
2. "Ankit is a doctor, and his clinic is in Mumbai."

### Logical Connectives:

Logical connectives are used to link two simpler ideas or to logically represent a statement. With the use of logical connectives, we can form compound assertions. There are five primary connectives, which are listed below:

1. Negation: A statement like ¬P is referred to as a negation of P. There are two types of literals: positive and negative literals.
Example: Rohan is intelligent and hardworking. It can be written as,
P = Rohan is intelligent,
Q = Rohan is hardworking. →P ∧ Q.
2. Conjunction:A conjunction is a sentence that contains connective such as, P ∧ Q.
Example: "Ritika is a doctor or Engineer",
Here P = Ritika is Doctor. Q = Ritika is Doctor, so we can write it as P ∨ Q.
3. Disjunction: A disjunction is a sentence with a connective ∨ , such as P ∨ Q, where P and Q are the propositions.
4. Implication: An implication is a statement such as P → Q. If-then rules are another name for implications. It can be expressed as follows: If it rains, the street is flooded.
Because P denotes rain and Q denotes a wet street, the situation is written as P and Q
5. Biconditional: A sentence like P Q, for example, is a biconditional sentence. I am alive if I am breathing.
P= I am breathing, Q = I am alive, it can be represented as P ⇔ Q.

### Following is the summarized table for Propositional Logic Connectives:

Connective Symbol Technical Term Word Example
Conjunction AND P ∧ Q
V Disjunction OR P V Q
Implication Implies P → Q
Biconditional If and only If P ⇔ Q
¬ or ~ Negation Not ¬P or ¬Q

### Truth Table:

We need to know the truth values of propositions in all feasible contexts in propositional logic. With logical connectives, we can combine all possible combinations, and the representation of these combinations in a tabular manner is known as a truth table. The truth table for all logical connectives is as follows:

P ¬P
true false
false true

#### For Conjunction:

P Q P ∧ Q
true true true
true false false
false true false
false false false

#### For Disjunction:

P Q P V Q
true true true
true false true
false true true
false false false

P Q P → Q
true true true
true false false
false true true
false false true

P Q P ⇔ Q
true true true
true false false
false true false
false false true

### Truth table with three propositions:

You can build a proposition composing three propositions P, Q, and R. The truth table is made up of 8Xn Tuples as we have taken three proposition symbols.

P Q R ¬R P V Q P V Q → ¬R
true true true false true false
true true false true true true
true false true false true false
true false false true true true
false true true false true false
false true false true true true
false false true false true true
false false false true true true

### Precedence of connectives:

Propositional connectors or logical operators, like arithmetic operators, have a precedence order. When evaluating a propositional problem, this order should be followed. The following is a list of the operator precedence order:

Precedence Operators
First Precedence Parenthesis
Second Precedence Negation
Third Precedence Conjunction(AND)
Forth Precedence Disjunction(OR)
Fifth Precedence Implication
Sixth Precedence Biconditional

Note: Use parenthesis to make sure of the correct interpretations for a better understanding. For example: ¬R∨ Q, It can be interpreted as (¬R) ∨ Q.

### Logical equivalence:

One of the characteristics of propositional logic is logical equivalence. If and only if the truth table's columns are equal, two assertions are said to be logically comparable. Let's take two propositions P and Q, so for logical equivalence, we can write it as P⇔Q. In below truth table we can see that column for ¬P ∨ Q and P→Q, are identical hence P is Equivalent to P

P Q ¬P ¬P V Q P → Q
T T F T T
T F F F F
F T T T T
F F T T T

### Properties of Operators:

• Commutativity:
• P ∧ Q= Q ∧ P, or
• P ∨ Q = Q ∨ P.
• Associativity:
• (P ∧ Q) ∧ R = P ∧ (Q ∧ R),
• (P ∨ Q) ∨ R= P ∨ (Q ∨ R).
• Identity element:
• P ∧ True = P,
• P ∨ True= True.
• Distributive:
• P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
• P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
• DE Morgan's Law:
• ¬(P ∧ Q) = (¬P) ∨ (¬Q),
• ¬(P ∨ Q) = (¬ P) ∧ (¬Q).
• Double-negation elimination:
• ¬(¬P) = P.

### Limitations of Propositional logic:

• This is not possible to represent relations like ALL, some, or none with propositional logic. Example:
• All the girls are intelligent.
• Some apples are sweet.
• The expressive power of propositional logic is restricted.
• We can't explain propositions in propositional logic in terms of their qualities or logical relationships.