Propositional Logic – Shishir Kant Singh https://shishirkant.com Jada Sir जाड़ा सर :) Thu, 28 May 2020 09:29:15 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 https://shishirkant.com/wp-content/uploads/2020/05/cropped-shishir-32x32.jpg Propositional Logic – Shishir Kant Singh https://shishirkant.com 32 32 187312365 Inference Rules in Proposition Logic https://shishirkant.com/inference-rules-in-proposition-logic/?utm_source=rss&utm_medium=rss&utm_campaign=inference-rules-in-proposition-logic Thu, 28 May 2020 09:29:12 +0000 http://shishirkant.com/?p=1140 Inference rules are those rules which are used to describe certain conclusions. The inferred conclusions lead to the desired goal state.

In propositional logic, there are various inference rules which can be applied to prove the given statements and conclude them.

There are following laws/rules used in propositional logic:

  • Modus Tollen: Let, P and Q be two propositional symbols:

Rule: Given, the negation of Q as (~Q).

If P→Q, then it will be (~P), i.e., the negation of P.

Example: If Aakash goes to the temple, then Aakash is a religious person. Aakash is not a religious person. Prove that Aakash doesn’t go to temple.

Solution: Let, P= Aakash goes to temple.

Q= Aakash is religious. Therefore, (~Q)= Aakash is not a religious person.

To prove: ~P→~Q

By using Modus Tollen rule, P→Q, i.e., ~P→~Q (because the value of Q is (~Q)).

Therefore, Aakash doesn’t go to the temple.

  • Modus Ponen: Let, P and Q be two propositional symbols:

Rule: If P→Q is given, where P is positive, then Q value will also be positive.

Example: If Sheero is intelligent, then Sheero is smart. Sheero is intelligent. Prove that Sheero is smart.

Solution: Let, A= Sheero is intelligent.

B= Sheero is smart.

To prove: A→B.

By using Modus Ponen rule, A→B where A is positive. Hence, the value of B will be true. Therefore, Sheero is smart.

  • Syllogism: It is a type of logical inference rule which concludes a result by using deducting reasoning approach.

Rule: If there are three variables say P, Q, and R where

P→Q and Q→R then P→R.

Example: Given a problem statement:

If Ram is the friend of Shyam and Shyam is the friend of Rahul, then Ram is the friend of Rahul.

Solution: Let, P= Ram is the friend of Shyam.

Q= Shyam is the friend of Rahul.

R= Ram is the friend of Rahul.

It can be represented as: If (P→Q) Ʌ (Q→R)= (P→R).

  • Disjunctive Syllogism

Rule: If (~P) is given and (P V Q), then the output is Q.

Example: Sita is not beautiful or she is obedient.

Solution: Let, (~P)= Sita is beautiful.

 Q= She is obedient.

 P= Sita is not beautiful.

It can be represented as (P V Q) which results Sita is obedient.

Note: Logical equivalence rules can also be used as Inference rules in Proposition logic.

We can also apply the inference rules to the logical equivalence rules as well.

  • Biconditional Elimination: If Aó B then (A→B) Ʌ (B→A) or

If (A→B) Ʌ (B→A) then A óB. (using one side implication rule).

  • Contrapositive: If ¬(A óB) then ¬((A→B) Ʌ (B→A))

We can re-obtain it using De Morgan’s and Modus Ponen rule. 

Using inference rules, we can also define a proof problem as follows:

  • Initial State: It is the initial  knowledge base.
  • Actions: It is the set of actions which contains all the inference rules applied over all the sentences that match the top half of the inference rule.
  • Result: When we add the sentence at the bottom of the inference rule, it gives the result of the applied action.
  • Goal: It is the state which contains that sentence we are trying to prove.

Note: It is more efficient to find a proof, as it removes irrelevant prepositions.

]]>
1140
Propositional Logic in AI https://shishirkant.com/propositional-logic-in-ai/?utm_source=rss&utm_medium=rss&utm_campaign=propositional-logic-in-ai Thu, 28 May 2020 09:27:13 +0000 http://shishirkant.com/?p=1137 It is a branch of logic which is also known as statement logic, sentential logic, zeroth-order logic, and many more. It works with the propositions and its logical connectivities. It deals with the propositions or statements whose values are true, false, or maybe unknown.

Syntax and Semantics of Propositional Logic

Syntax and semantics define a way to determine the truth value of the sentence.

Syntax: The statements given in a problem are represented via propositional symbols. Each sentence consists of a single propositional symbol. The propositional symbol begins with an uppercase letter and may be followed by some other subscripts or letters. We have two fixed propositional symbols, i.e., True and False.

To convert simple sentences into complex one, following connectives (a connective is used to combine two or more sentences) are used:

  • not(¬): It is known as the negation of a sentence. A literal can be a positive literal or a negative literal.
  • and(Ʌ): When a sentence is having (Ʌ) as the main connective. It is known as Conjunction, and its parts are known as Conjuncts. For example, (Y1Y2Ʌ (Y3 V Y4Ʌ…(Yn V Ym), such type of sentences are known as Conjunctive sentences.
  • or(V): When a sentence is having (V) as the main connective. It is known as Disjunction, and its parts are known as Disjuncts. For example, (Y1Ʌ Y2V (Y3Ʌ Y4V …(YnɅ Ym), such type of sentences are known as Disjunctive sentences.  
  • implies(=>): When (Y1 V Y2) => Yis given, it is known as the Implication of a sentence. It is like if->then clause, where if this implies then it will happen. Implication is sometimes referred to as Rules or if-then statement. It can also be denoted as (      ) or (       ).
  • if and only if (ó): It represents implication at both sides where the expression is (a1 V a2)a3,. Such type of connective is called biconditional implication. It returns true if both sides satisfy one another, else returns false.This can also be denoted as (≡).

Precedence Order of the Connectives

Below table shows the precedence order of the connectives in their decreasing order:

NameSymbol
Parenthesis/ Brackets()
Negation/not¬ or ~
Conjuction/andɅ
Disjunction/orV
Implication
Biconditional/ if and only ifó

Semantics: It defines the rules to determine the truth of a sentence with respect to a specific model. A semantic should be able to compute the truth value of any given sentence.

There are following five rules regarding the semantics of the complex sentences P and Q in a given model m :

¬P: Its value will be false, iff it is true in the model m.

(P Ʌ Q): Its value is true, iff both P and Q are true in m.

(P v Q): Its value is true, iff either P is true, or Q is true in m.

(P=> Q): Its value is true, iff the value of P is false, and that of Q is true in m.

(P ⇔ Q): The value will be true, iff P and Q value is either true or false in the given model m.

Note: Here, iff means if and only if.                    

These five connectives can also be understood with the help of the below described truth table:

Examples of Propositional Logic

Example 1: Consider the given statement:

If it is humid, then it is raining.

Solution: Let, P and Q be two propositions.

P=It is humid.

Q=It is raining.

It is represented as (P→Q).

Example 2:  It is noon and Ram is sleeping.

Solution: A= It is noon.

B= Ram is sleeping.

It is represented as (A V B).

Example 3: If it is raining, then it is not sunny.

Solution: P= It is raining.

Q= It is sunny.

It is represented as P → ( ~Q)

Example 4: Ram is a man or a boy.

Solution: X= Ram is a man.

Y= Ram is a boy.

It is represented as (X Ʌ Y).

Example 5: I will go to Delhi if and only if it is not humid.

Solution: A= I will go to Delhi.

B= It is humid.

It is represented as (A  B).

There can be many examples of Propositional logic.

Propositional Theorem Proving

Theorem proving means to apply rules of inference directly to the sentences.

There are following concepts which are used for theorem proving:

  • Logical Equivalence: If the value of P and Q is true in the same set of models, then they are said to be logically equivalence.
Rule NameRule
Idempotency Law  (A Ʌ A) = A(AV A) = A  
Commutative Law  (A Ʌ B) = (B Ʌ A)(AV B) = (B V A)      
De morgan’s Law  ~(A Ʌ B) =( ~A V ~B)~(A V B) = (~A Ʌ ~B)  
Associative Law  AV(B V C) = (A V B) V CA Ʌ(B Ʌ C) = (A ɅB) Ʌ C  
Distributive LawA Ʌ(B V C) = (A Ʌ B) V (A Ʌ C)A V (B Ʌ C) = (A V B) Ʌ (A V C)  
Contrapositive Law   A   → B = ~A    →   ~B
~A  →       ~B (Converse of Inverse)  
Implication Removal  A    →   B = ~A V B
Biconditional Removal B = (A → B) Ʌ (B  → A)  
Absorption LawA Ʌ (A V B) ≡ AAV (A Ʌ B) ≡A
Double-negation elimination~(~A)=A

Table defining the rules used in Propositional logic where A, B, and C represents some arbitrary sentences.

  • Validity: If a sentence is valid in all set of models, then it is a valid sentence. Validity is also known as tautology, where it is necessary to have true value for each set of model.
  • Satisfiability: If a sentence is true atleast for some set of values, it is a satisfiable sentence.

Let’s understand validity and satisfiability with the help of examples:

Example 1:

(P V Q)    →   (P Ʌ Q)

PQP V QɅ Q(P Q)        (P Ʌ Q) 
FalseFalseFalseFalseTrue
FalseTrueTrueFalseFalse
TrueFalseTrueFalseFalse
TrueTrueTrueTrueTrue

So, from the above truth table, it is clear that the given expression is satisfiable but not valid.

Example 2:

ABA → B(A  → B) Ʌ A((A → B) Ʌ A) → B 
FalseFalseTrueFalseTrue
FalseTrueTrueFalseTrue
TrueFalseFalseFalseTrue
TrueTrueTrueTrueTrue

((A  → B) Ʌ A)  → B

So, it is clear from the truth table that the given expression is valid as well as satisfiable.

Note: If the given expression is valid, it is by default satisfiable.

]]>
1137