advertisement

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: It is Sunday. The Sun rises from the West (False proposition) 3 + 3 = 7 (False proposition) 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: Atomic Propositions. 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: 2+2 is 4, it is an atomic proposition as it is a true fact. "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: "It is raining today, and the street is wet." "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: 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. 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. Disjunction: A disjunction is a sentence with a connective ∨ , such as P ∨ Q, where P and Q are the propositions. 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 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 PVQ → 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: For Negation: P ¬P true false false true For Conjunction: P Q P∧Q true true true true false false false true false false false false P Q PVQ true true true true false true false true true false false false For Disjunction: For Implication: 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 For Biconditional: You can build a proposition composed of 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 PVQ 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 ensure the correct interpretations for a better understanding. For example: ¬R∨ Q, 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 the below truth table we can see that columns 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. Inference We need intelligent computers in artificial intelligence to construct new logic from old logic or evidence, therefore inference is the process of drawing conclusions from data and facts. Inference rules: The templates for creating valid arguments are known as inference rules. In artificial intelligence, inference rules are used to generate proofs, and a proof is a series of conclusions that leads to the intended outcome. The implication among all the connectives is vital in inference rules. Some terms relating to inference rules are as follows: 1. Implication: It's one of the logical connectives, denoted by the letters P → Q. It's a Boolean expression, to be precise. 2. Converse: The converse of implication is when the right-hand side statement is applied to the left-hand side, and vice versa. It is denoted by the letters Q → P. 3. Contrapositive: Contrapositive is the negation of converse, and it can be expressed as ¬ Q → ¬ P. 4. Inverse: Inverse is the antithesis of implication. ¬ P → ¬ Q can be used to symbolize it. Some of the compound statements in the above term are equivalent to each other, which we can verify using the truth table: P Q P→Q Q→P ¬Q→¬P ¬P→¬Q T T T T T T T F F T F T F T T F T F F F T T T T As a result of the above truth table, we can prove that P → Q is equivalent to ¬ Q → ¬ P, and Q→ P is equivalent to ¬ P → ¬ Q. Types of Inference rules: 1. Modus Ponens: One of the most essential laws of inference is the Modus Ponens rule, which asserts that if P and P → Q are both true, we can infer that Q will be true as well. It's written like this: Example: Statement-1: "If I am sleepy then I go to bed" ==> P → Q Statement-2: "I am sleepy" ==> P" Conclusion: "I go to bed." ==> Q. Hence, we can say that, if P → Q is true and P is true then Q will be true. Proof by Truth table: 2. Modus Tollens: According to the Modus Tollens rule if P→ Q is true and ¬ Q is true, then ¬ P will also be true. It can be represented as: Example: Statement 1: "If I am sleepy then I go to bed" ==> P→ Q Statement 2: "I do not go to bed."==> ~Q Statement 3: Which infers that "I am not sleepy" => ~P Proof by Truth table: 3. Hypothetical Syllogism: According to the Hypothetical Syllogism rule if P→R is true whenever P→Q is true, and Q→R is true. It can be represented as the following notation: Example: Statement-1: Statement-1: If you have my home key then you can unlock my home. P→Q Statement-2: Statement-2: If you can unlock my home then you can take my money. Q→R Statement-3: Conclusion: If you have my home key then you can take my money. P→R Proof by Truth table: 4. Disjunctive Syllogism: According to the Disjunctive syllogism rule if P∨Q is true, and ¬P is true, then Q will be true. It can be represented as: Example: Statement-1:Today is Sunday or Monday. ==>P∨Q Statement-2:Today is not Sunday. ==> ¬P Conclusion: Today is Monday. ==> Q Proof by Truth table: 5. Addition: According to the Addition rule which is one of the common inference rule, If P is true, then P∨Q will be true. Example: Statement-1: I have a vanilla ice-cream. ==> P Statement 2: I have Chocolate ice-cream. Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q) Proof by Truth table: 6. Simplification: According to the simplification rule if P∧ Q is true, then Q or P will also be true. It can be represented as: Proof by Truth table: 7. Resolution: According to the Resolution rule if P∨Q and ¬ P∧R is true, then Q∨R will also be true. It can be represented as Proof by Truth table: This is a free learning site FOLLOW US This is a free learning site .It is designed Specially for the student who are looking for a fre