Artificial Intelligence: Propositional Logic

Propositional Logic in Artificial Intelligence

Artificial intelligence (AI) uses propositional logic as one of the major methods of knowledge representation using logical propositions. Propositions are statements that are either true or false but not both. More complex expressions are created by combining statements with logical operators like AND, OR, NOT, and IMPLIES. This enables an AI system to make better decisions using logical reasoning.

Propositions, in artificial intelligence, are sentences that are considered to state facts, situations, or claims about the world to enable the logical reasoning of the machines. The propositional logic expression consists of symbols (for these truths) and logical operators, often represented with parenthesis.

Example

Following are few examples of propositions (declarative statements) −

  • The sun rises in the east.

  • A triangle has four sides. (False)

  • Water boils at 100C under normal atmospheric pressure.

  • 2 + 2 = 5. (False)

  • A self-driving car can operate without human intervention.

 

Facts about Propositional logic

Propositional logic is a formal system applied in mathematics, computer science, and artificial intelligence for reasoning about logical statements.

  • It pays no attention to the context and content, it just determines whether propositions are true or false based on their structure.

  • In propositional logic, operations are ordered according to precedence: Negation (¬) leads to conjunction (), then disjunction (), implication (→), and biconditional ().

  • Truth tables are applied to determine whether a logical expression is valid, satisfiable, or equivalent.

  • Propositional logic is limited because it can't express a relationship between the objects and quantifiers like "for all" or "there exists," where these are handled by First Order Logic.

  • A proposition must be a declarative statement that holds a truth value of true or false, like the sky is blue. Statements like "Where is Krish?" is not a proposition because it is not declarative statement.

Key Components of Propositional Logic

Propositional logic involves basic building blocks such as propositions, logical connectives, and truth tables to form logical expressions which simplifies knowledge representation that help AI to reason and make decisions based on facts.

Propositions (Statements)

Propositional logic deals with two kinds of propositions, atomic and compound propositions which form the base for logical expressions.

  • Atomic proposition: An atomic proposition is an basic statement which cannot be split into smaller units. It has a single proposition sign.

    For example, statement like "The car is parked in the garage".

  • Compound Proposition: A compound proposition is formed by combining two or more atomic propositions using logical connectives like AND, OR, NOT, Implies.

    For example, "She likes coffee OR she likes tea".

Logical Connectives

Logical connectives, also known as logical operators, are symbols that connect or alter propositions in propositional logic. They help to form complex propositions and determine the relationships between the components. Below are the main types −

Conjunction

The combination of two propositions is only true if both of the propositions are true.

Example

The sun is shining AND it is a warm day.

  • P = The sun is shining.

  • Q = It is a warm day. → P Q.

The combination of above two statements become P Q. The statement, ("The sun is shining AND it is a warm day") is TRUE only if both the statements is true, if either P or Q is FALSE the entire statement is FALSE.

Disjunction (OR, )

The disjunction of two propositions is true if at least one of the propositions is true.

Example

"It is raining OR it is snowing." True if either condition is true, or both.

  • P = It is raining.

  • Q = It is snowing. → P Q.

Negation (NOT, ¬)

The negation of a proposition reverses its truth value, if the proposition is true, the negation is false, and vice versa.

For example, "The car is NOT parked in the driveway."(True if the car is not parked in the driveway.)

Implication (IF-THEN, →)

An implication says that if the first proposition is true, then the second has to be true as well. It is only false when the first statement is right and the second statement is wrong. It is sometimes called if-then rules.

For example, "If it rains, then the ground gets wet." (False only if it rains and the ground does not get wet.)

Biconditional (IF AND ONLY IF, )

A biconditional statement is true whenever the two propositions have the same truth value-both true or both false.

For example, "She is happy IF AND ONLY IF she passed the exam." (True only if she passed the exam and is happy, or neither of them is true.)

Tautologies, Contradictions, and Contingencies

Tautologies: A tautology is a proposition that is true regardless of the truth values assigned to its component propositions. In other words, no matter what we assign to the components of this statement, the final result will always be true.

Example: P ¬P (P OR NOT P) is always true since either P is true or P is false, which means that one part of the OR conditions is always true.

Contradiction: A contradiction is a proposition that is always wrong, no matter which truth values are assigned to its components. It represents a statement that simply cannot be true.

Example: P ¬P (P AND NOT P) is always false because P cannot be simultaneously true and false.

Contingency: A contingency is a proposition that may not be necessarily true or false. The truth value of the entire statement is determined by the truth value of the propositions. That is, it may be true in some situations but false in others.

Example: P Q (P AND Q) is true if both P and Q are true, but false otherwise.

Precedence of connectives

In propositional logic, the order of operations (precedence) is as follows −

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

Note: Operators with the same precedence are evaluated from left to right.

Example: Shopping Decision

Statement: "If the item is on sale AND I have a coupon, I will buy it OR I will wait for a better deal."

Propositions: A proposition is a declarative statement that might be true or false, but not both.

  • P = The item is on sale.

  • Q = I have a coupon.

  • R = I will buy it.

  • S = I will wait for a better deal.

Propositional Logic Expression: A propositional logic expression is the set of propositions joined together by logical connectives to form a meaningful statement. We write the logical expression using symbols and connectives.

(P Q) → (R S)

Step-by-Step Evaluation −

Here we follow the logical reasoning step by step.

  • Conjunction: Evaluate (P Q) and see whether the two conditions that have to be satisfied, sale and coupon, are met.

  • Disjunction: Consider (R S ) to determine whether the decision is to buy or wait.

  • Implication: If P and Q are true, then the conclusion must be R or S, so the AI system will make the right decision.

This is how we implement the precedence rules in propositional logic, first evaluating the parentheses, then conjunction, followed by disjunction, and finally implication (IF-THEN) to reach a logical decision.

Logical equivalence

Logical equivalence in propositional logic means that two statements, or propositions, always have the same truth value regardless of the truth values assigned to the individual components.

  • Symbols: "" or "" represents logical equivalence. P Q means "P is logically equivalent to Q".

  • It simplifies complex logical phrases, which makes the AI system understand and interpret more effectively.

  • Logical equivalence lets AI draw new conclusions from preceding knowledge. If two propositions are true and the AI knows one is true, then it can conclude that the other proposition is also true.

  • In some AI systems like expert systems, uses logical equivalence to reduce the complexity of search or reasoning by replacing complex phrases with simpler, equivalent phrases.

 

Syntax of Propositional Logic

The syntax of propositional logic specifies rules and symbols required to construct valid logical propositions. It consists of propositions, logical connectives, and parentheses that assist in representing knowledge in a structured way.

  • * Propositions (Atomic Statements): These are simple statements that may be either true or false. They are usually represented by capital letters like P, Q, R, etc.

  • * Logical Connectives (Operators): The symbols that can be used to connect or transform propositions in a way that combines or alters their truth values such as , , ¬, →,

  • * Parentheses: are used to group propositions and order operations properly e.g, (P Q) → R

  • * Compound Propositions: It is a logical statement which is obtained by combining several atomic propositions through logical connectives like , , ¬, →, and . For example, (P Q) (¬R).

Applications of Propositional Logic in AI

Following are the applications of propositional logic −

  • * Automated Reasoning: Automated reasoning uses propositional logic which enables machine to deduce new knowledge from existing facts. This helps in problem-solving and decision making.

    * For example, let the known facts be "The room is dark" and "The lights turn on". If AI detects darkness, it automatically turn on lights. This way it can use or infer the existing knowledge.

  • * Knowledge Representation: AI uses propositional logic to represent facts and relationships using propositions (statements that are either true or false) and logical connectivities such as , , ¬ and →. This logical representation helps AI to make decisions and answer queries quicker by simplifying complex representation into a structured form.

    * For example, let the statements be "The customer buys a smartphone." and "The system recommends a phone case". The logical representation for this would be P → Q meaning if the customer buys a smartphone, the AI system will recommend to buy a phone case.

  • * Decision Making: AI uses propositional logic to make decisions based on conditions.

    * For example, "If the car is low on fuel (P), and the fuel station is nearby (Q), then the car will stop for refueling" (P Q → Refuel).

  • * Planning and problem-solving: These are fundamental activities of AI, where machines process a situation, establish objectives, and decide a sequence of steps to achieve a desired outcome. Propositional logic helps the AI describe goals, constraints, and conditions in a structured way, so that systems can logically determine what actions to take next.

    * For example, "If a meeting room is available (P) and all the participants are free (Q), the AI schedules the meeting" (P Q) → R.