0% found this document useful (0 votes)
12 views4 pages

Propositional Logic Model Checking Guide

The document outlines Experiment 7, which focuses on implementing a Propositional Logic Model Checking algorithm to verify entailment between a knowledge base (KB) and a query using truth-table model checking. It details the theory behind the method, the algorithm steps, and provides a Java program that demonstrates the checking process. The result confirms that the program successfully establishes whether the given KB entails the query, highlighting the method's completeness and computational expense.

Uploaded by

khushboobharke7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Propositional Logic Model Checking Guide

The document outlines Experiment 7, which focuses on implementing a Propositional Logic Model Checking algorithm to verify entailment between a knowledge base (KB) and a query using truth-table model checking. It details the theory behind the method, the algorithm steps, and provides a Java program that demonstrates the checking process. The result confirms that the program successfully establishes whether the given KB entails the query, highlighting the method's completeness and computational expense.

Uploaded by

khushboobharke7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EXPERT SYSTEMS CS3EA16

EXPERIMENT 7 – To implement propositional model checking


algorithm

7.1 Aim
To implement a Propositional Logic Model Checking algorithm that verifies
whether a given knowledge base (set of logical sentences) entails a specific
query using truth-table model checking.

7.2 Theory
Propositional Logic Model Checking is a reasoning technique used in Artificial
Intelligence to determine if a knowledge base (KB) logically entails a query (α).
It works by:
●​ Enumerating all possible truth assignments (models) for the
propositional variables.
●​ Checking in each model whether both KB and α are true.
●​ If KB ⇒ α in all models where KB is true, then KB ⊨ α (KB entails α).

Key Concepts
Knowledge Base (KB): Set of known facts and rules (propositional sentences).
Model: Assignment of truth values (True/False) to propositional variables.
Entailment (⊨): KB entails α if α is true in every model where KB is true.

Name - Ayushi Sharma Enrollment No. - EN23CS301252


EXPERT SYSTEMS CS3EA16

Types of Model Checking:

1.​ Truth Table Based Checking: Tests all possible truth assignments.
2.​ SAT Solving or Resolution Based Checking: Uses logical inference
techniques.
Example
If KB = (P → Q) ∧ P​
Query α = Q
Then in all models where KB is true, Q is also true → So KB ⊨ Q.

7.3 Algorithm (Truth Table Model Checking)


MODEL-CHECK(KB, α):
1. symbols ← extract all propositional symbols from KB and α
2. return CHECK-ALL(KB, α, symbols, {})
CHECK-ALL(KB, α, symbols, model):
3. if symbols is empty:
4. if model satisfies KB then
5. return model satisfies α
6. else
7. return true
8. P ← first symbol in symbols
9. rest ← remaining symbols
10. return (CHECK-ALL(KB, α, rest, model ∪ {P = true})
and

Name - Ayushi Sharma Enrollment No. - EN23CS301252


EXPERT SYSTEMS CS3EA16

CHECK-ALL(KB, α, rest, model ∪ {P = false}))

7.4 Program
import [Link].*;
public class ModelChecking {
static boolean implies(boolean p, boolean q) {
return !p || q;
}
public static void main(String[] args) {
boolean[] P = {true, false};
boolean[] Q = {true, false};
boolean entails = true;
[Link]("P\tQ\t(KB)\tAlpha(Q)");

for (boolean p : P) {
for (boolean q : Q) {
boolean kb = implies(p, q) && p; // KB = (P → Q) ∧ P
boolean alpha = q; // α = Q
[Link](p + "\t" + q + "\t" + kb + "\t" + alpha);
if (kb && !alpha)
entails = false;
}
}

Name - Ayushi Sharma Enrollment No. - EN23CS301252


EXPERT SYSTEMS CS3EA16

if (entails)
[Link]("\n KB entails Alpha (KB ⊨ α)");
else
[Link]("\n KB does not entail Alpha");
}
}

7.5 Output
P​ Q​ (KB)​ Alpha(Q)
true​ true​ true​ true
true​ false​ false​ false
false​ true​ true​ true
false​ false​ true​ true

KB entails Alpha (KB ⊨ α)

7.6 Result
The program successfully checks entailment using the truth table model checking
[Link] verifies that for the given KB = (P → Q) ∧ P, the query Q is logically
entailed by the knowledge base.
Model Checking systematically evaluates all possible truth assignments to determine if
knowledge base logically entails a query. It is a complete but computationally
expensive method for propositional reasoning.

Name - Ayushi Sharma Enrollment No. - EN23CS301252

Common questions

Powered by AI

The CHECK-ALL procedure is a recursive function that iteratively evaluates all possible truth assignments for propositional symbols extracted from the knowledge base (KB) and the query (α). It checks if these assignments satisfy both KB and α, determining if KB entails α. Its significance lies in systematically exhausting all possible models to verify entailment .

The strength of truth table based checking lies in its completeness, as it evaluates all possible truth assignments to ensure accuracy in determining entailment. However, its limitation is computational expense due to the exponential growth of possible models with the increase in the number of propositional variables, making it inefficient for large knowledge bases .

The truth table model checking algorithm determines if a knowledge base (KB) entails a query (α) by enumerating all possible truth assignments for the propositional variables involved. It checks whether both KB and α are true in each model. If the knowledge base implies the query in all models where KB is true, then it is concluded that KB entails α .

Truth table based checking involves exhaustive enumeration of truth assignments for all propositional variables, while SAT solving or resolution based checking uses logical inference techniques to deduce conclusions. SAT solving is generally more efficient as it avoids generating all possible models, especially useful for large knowledge bases .

The Java program code executes the model checking algorithm by defining and iterating over boolean arrays representing the possible truth values for P and Q. It evaluates the conditional KB and query α for each combination, printing results and confirming KB entails α if they are satisfied in all relevant models .

The algorithm uses truth value assignments by iteratively assigning true or false to each propositional variable extracted from the knowledge base (KB) and query (α). These assignments are checked against KB and α to verify satisfiability, with a model considered satisfying both if KB is true implying α is true. The entirety of different assignments ensures completeness in checking .

The key components for propositional logic model checking are the knowledge base (KB), the query (α), and a set of propositional symbols representing logical sentences. The algorithm extracts all propositional symbols from KB and α and iteratively checks all possible models to verify if in every model where KB is true, α is also true, determining entailment .

Model checking is considered complete because it exhaustively evaluates all possible truth assignments to ensure no possibility is missed in determining entailment. However, it is computationally expensive due to the exponential increase in the number of truth models with more propositional variables, leading to high resource consumption, especially in truth table based methods .

The entailment symbol (⊨) represents a logical relationship where the knowledge base (KB) entails the query (α). This is determined through model checking by verifying that in all models where KB is true, α must also be true. If this condition is satisfied for all such models, then it is concluded that KB ⊨ α .

The example illustrates the model checking process by iterating through all combinations of truth assignments for P and Q, evaluating the truth of KB = (P → Q) ∧ P and the query α = Q. The output demonstrates that in all models where KB is true, α is also true, thus confirming that KB entails α .

You might also like