artifitical intelligence notes of unit four

adijadhav104 72 views 81 slides Jun 03, 2024
Slide 1
Slide 1 of 81
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81

About This Presentation

AI


Slide Content

Unit IV Knowledge Logical Agents, Knowledge-Based Agents, The Wumpus World, Logic, Propositional Logic: A Very Simple Logic, Propositional Theorem Proving, Effective Propositional Model Checking, Agents Based on Propositional Logic, First-Order Logic, Representation Revisited, Syntax and Semantics of First-Order Logic, Using First-Order Logic, Knowledge Engineering in First-Order Logic.

Logical Agents “ Logical AI: The idea is that an agent can represent knowledge of its world, its goals and the current situation by sentences in logic and decide what to do by inferring that a certain action or course of action is appropriate to achieve its goals.”

Logical agent A logical agent is an artificial intelligence (AI) system that is able to reason about complex problems and make decisions based on logical reasoning. Logical agents are often used in applications where  traditional AI techniques  such as rule-based systems or decision trees are not well suited. Advantages of Logical agents: They are able to handle complex problems that are difficult to represent using other approaches. In addition, logical agents can often provide justifications for their decisions, which can be important in applications where explain ability is important. Disadvantages of logical agents: They can be computationally expensive, and may require significant amounts of background knowledge in order to work properly. They can be susceptible to errors in their reasoning.

Knowledge-Based Agents The intelligence of humans is achieved not by purely reflex mechanisms but by processes of reasoning that operate on internal representations of knowledge. • In AI, this approach to intelligence is embodied in knowledge-based agents. • Logical agents (knowledge-based agents) can form representations of a complex world, use a process of inference to derive new representations about the world, and use these new representations to deduce what to do. Knowledge-based agents is supported by logic such as propositional logic or first-order predicate logic . A knowledge base (KB) is a set of sentences in a formal language. • Inference: Deriving new sentences from old sentences in KB.

Each time a knowledge-based agent does three things. TELLs the knowledge base what it perceives. TELL operations add new sentences (agent’s perceptions) to the knowledge base. ASKs the knowledge base what action it should perform. The agent TELLs the knowledge base which action was chosen, and the agent executes the action.

The Wumpus World in Artificial intelligence The Wumpus world is a simple world example to illustrate the worth of a knowledge-based agent and to represent knowledge representation. The Wumpus world is a cave which has 4/4 rooms connected with passageways. So there are total 16 rooms which are connected with each other. We have a knowledge-based agent who will go forward in this world. The cave has a room with a beast which is called Wumpus, who eats anyone who enters the room. The Wumpus can be shot by the agent, but the agent has a single arrow. In the Wumpus world, there are some Pits rooms which are bottomless, and if agent falls in Pits, then he will be stuck there forever. The exciting thing with this cave is that in one room there is a possibility of finding a heap of gold. So the agent goal is to find the gold and climb out the cave without fallen into Pits or eaten by Wumpus. The agent will get a reward if he comes out with gold, and he will get a penalty if eaten by Wumpus or falls in the pit.

Following is a sample diagram for representing the Wumpus world. It is showing some rooms with Pits, one room with Wumpus and one agent at (1, 1) square location of the world. There are also some components which can help the agent to navigate the cave. These components are given as follows: The rooms adjacent to the Wumpus room are smelly, so that it would have some stench. The room adjacent to PITs has a breeze, so if the agent reaches near to PIT, then he will perceive the breeze. There will be glitter in the room if and only if the room has gold. The Wumpus can be killed by the agent if the agent is facing to it, and Wumpus will emit a horrible scream which can be heard anywhere in the cave.

PEAS description of Wumpus world: To explain the Wumpus world we have given PEAS description as below: Performance measure: 1000 reward points if the agent comes out of the cave with the gold. -1000 points penalty for being eaten by the Wumpus or falling into the pit. -1 for each action, and -10 for using an arrow. The game ends if either agent dies or came out of the cave. Environment: A 4*4 grid of rooms. The agent initially in room square [1, 1], facing toward the right. Location of Wumpus and gold are chosen randomly except the first square [1,1]. Each square of the cave can be a pit with probability 0.2 except the first square.

Actuators: Left turn, Right turn Move forward Grab Release Shoot. Sensors: The agent will perceive the  stench  if he is in the room adjacent to the Wumpus. (Not diagonally). The agent will perceive  breeze  if he is in the room directly adjacent to the Pit. The agent will perceive the  glitter  in the room where the gold is present. The agent will perceive the  bump  if he walks into a wall. When the Wumpus is shot, it emits a horrible  scream  which can be perceived anywhere in the cave. These percepts can be represented as five element list, in which we will have different indicators for each sensor.

Example if agent perceives stench, breeze, but no glitter, no bump, and no scream then it can be represented as: [Stench, Breeze, None, None, None] . The Wumpus world Properties: Partially observable:  The Wumpus world is partially observable because the agent can only perceive the close environment such as an adjacent room. Deterministic:  It is deterministic, as the result and outcome of the world are already known. Sequential:  The order is important, so it is sequential. Static:  It is static as Wumpus and Pits are not moving. Discrete:  The environment is discrete. One agent:  The environment is a single agent as we have one agent only and Wumpus is not considered as an agent.

Agent's First step: Initially, the agent is in the first room or on the square [1,1], and we already know that this room is safe for the agent, so to represent on the below diagram (a) that room is safe we will add symbol OK. Symbol A is used to represent agent, symbol B for the breeze, G for Glitter or gold, V for the visited room, P for pits, W for Wumpus. At Room [1,1] agent does not feel any breeze or any Stench which means the adjacent squares are also OK. Exploring the Wumpus world: Now we will explore the Wumpus world and will determine how the agent will find its goal by applying logical reasoning.

Agent's second Step: Now agent needs to move forward, so it will either move to [1, 2], or [2,1]. Let's suppose agent moves to the room [2, 1], at this room agent perceives some breeze which means Pit is around this room. The pit can be in [3, 1], or [2,2], so we will add symbol P? to say that, is this Pit room? Now agent will stop and think and will not make any harmful move. The agent will go back to the [1, 1] room. The room [1,1], and [2,1] are visited by the agent, so we will use symbol V to represent the visited squares. Agent's third step: At the third step, now agent will move to the room [1,2] which is OK. In the room [1,2] agent perceives a stench which means there must be a Wumpus nearby. But Wumpus cannot be in the room [1,1] as by rules of the game, and also not in [2,2] (Agent had not detected any stench when he was at [2,1]). Therefore agent infers that Wumpus is in the room [1,3], and in current state, there is no breeze which means in [2,2] there is no Pit and no Wumpus. So it is safe, and we will mark it OK, and the agent moves further in [2,2].

Agent's fourth step: At room [2,2], here no stench and no breezes present so let's suppose agent decides to move to [2,3]. At room [2,3] agent perceives glitter, so it should grab the gold and climb out of the cave.

Logic A logic is a formal language that allows sound inference and has well defined syntax and semantics. There are various logics that allow you to represent various types of things and allow for more or less efficient interference. Different varieties of logic exist such as propositional logic, predicate logic, temporal logic, and description logic. However, expressing something in logic may not be natural, and conclusions may be ineffective. Example of logic Language of numerical constraints: • A sentence: x + 3 ≤ z x, z - variable symbols (primitives in the language) • An interpretation: I: x = 5, z = 2 Variables mapped to specific real numbers • Valuation (meaning) function \/: V (x + 3 ≤ z, I) is False for x = 5, z = 2 Is True for l: x = 5, z = 10

Entailment Entailment means a sentence follows logically from another : α |= β to mean that the sentence α entails the sentence β α |= β if and only if, in every model in which α is true, β is also true. α |= β if and only if M(α) ⊆ M(β) . Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true. Eg. the KB containing “the Phillies won” and “the Reds won” entail s “Either the Phillies won or the Reds won” Eg. x+y = 4 entails 4 = x+y Entailment is a relationship between sentences (i. e. , syntax) that is based on semantics. Inference and Entailment Inference is a procedure that allows new sentences to be derived from a knowledge base. Understanding inference and entailment: think of Set of all consequences of a KB as a haystack α as the needle Entailment is like the needle being in the haystack. Inference is like finding it if an inference algorithm i can derive α from KB, we write which is pronounced “α is derived from KB by i” or “i derives α from KB.”

Propositional Logic: A Very Simple Logic Propositional logic (PL) is the simplest form of logic where all the statements are made by propositions. A proposition is a declarative statement which is either true or false. It is a technique of knowledge representation in logical and mathematical form.  Example: a) It is Sunday. b) The Sun rises from West (False proposition) c) 3+3= 7 (False proposition) d) 5 is a prime number. Following are some basic facts about propositional logic: •Propositional logic is also called Boolean logic as it works on 0 and I. •In propositional logic, we use symbolic variables to represent the logic, and we can use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc. •Propositions can be either true or false., but it cannot be both.

•Propositional logic consists of an object, relations or function, and logical connectives. •These connectives are also called logical operators. •The propositions and connectives are the basic elements of the propositional logic. •Connectives can be said as a logical operator which connects two sentences. •A proposition formula which is always true is called tautology, and it is also called a valid sentence. •A proposition formula which is always false is called Contradiction. •A proposition formula which has both true and false values is called •Statements which are questions, commands, or opinions are not propositions such as "Where is Rohini", "How are you", "What is your name", are not propositions. Syntax of propositional logic: The syntax of propositional logic defines the allowable sentences for the knowledge representation. There are two types of Propositions:

I. Atomic Propositions 2. Compound propositions   1. Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single proposition symbol. These are the sentences which must be either true or false. Example: a) 2+2 is 4, it is an atomic proposition as it is a true fact. b) "The Sun is cold" is also a proposition as it is a false fact. 2. Compound proposition: Compound propositions are constructed by combining simpler or atomic propositions, using parenthesis and logical connectives. Example: a) "It is raining today, and street is wet." b) "Ankit is a doctor, and his clinic is in Mumbai."

Logical Connectives: Logical connectives are used to connect two simpler propositions or representing a sentence logically. We can create compound propositions with the help of logical connectives. There are mainly five connectives, which are given as follows: Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative literal. 2.Conjunction: A sentence which has /\connective such as, P /\ Q is called a conjunction. Example: Rohan is intelligent and hardworking. It can be written as, P = Rohan is intelligent, Q = Rohan is hardworking. → P/\ Q. 3.Disjunction: A sentence which has V connective, such as P V Q. Is called disjunction, where P and Q are the propositions. Example: "Ritika is a doctor or Engineer", Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P V Q.

4.Implication: A sentence such as P→ Q, is called an implication. Implications are also known as if-then rules. It can be represented as If it is raining, then the street is wet.  Let P= It is raining, and Q= Street is wet, so it is represented as P→ Q 5.Biconditional: A sentence such as P ↔ Q is a Biconditional sentence, example If I am breathing, then I am alive P= I am breathing, Q= I am alive, it can be represented as P ↔ Q.

Following is the summarized table for Propositional Logic Connectives:   Conne c t ive sy mb ols   W o r d   T ec hn i ca l t er m   Ex amp l e   /\   A N D   C o n j un ctio n   A/\B V   OR   D i s j un c t i o n AVB   →   Implies   I mpli c a tio n   A → B ↔   If and only if   B ico nd i t io na l   A↔ B   ¬ O r ~   N ot   Nega tio n   ¬A o r ~B

Truth Table:   p   ¬p   Tru e   Fal s e   Fa l se   T rue For negation   p   Q   P /\ Q   True   T ru e   True   True   Fal se   Fal se   Fa lse   T ru e   Fal se   Fa l se   Fal se   Fal se Fo r conj u nct io n   p   Q   P V Q   True   T rue   True   Fa lse   T rue   True   True   Fal se   True   False   Fal se   Fal se F o r d i s j un c t i o n     p   Q   P → Q   T rue   T rue   True   T rue   Fal se   Fal se   Fa lse   T rue   True   False   Fal se   True For i m p lica t i on

  p   Q   P ↔ Q   True   T rue   True   T rue   Fal se   Fal se   False   T rue   Fal se   Fa lse   Fal se   True F o r Bic o n d iti o n a l   p   Q   R   ¬R   P V Q   P V Q → ¬R   True   T ru e   True   Fa lse   True   F a l se   True   T ru e   Fal se   T rue   True   True   True   Fal se   True   Fa lse   True   F a l se   True   Fal se   Fal se   T rue   True   True   Fa l se   T ru e   True   Fa lse   True   F a l se   Fa l se   T ru e   Fal se   T rue   True   True   Fa lse   Fal se   True   Fa lse   Fa lse   True   Fa lse   Fal se   Fal se   T rue   Fa lse   True T ru t h t a bl e with t h r ee p r op o si tio n s : Note: For better understanding use parenthesis to make sure of the correct interpretations. Such as ¬ R V Q, It can be interpreted as ( ¬ R) V Q

Logical equivalence:   Logical equ1valence is one of the features of propositional logic. Two propositions are said to be logically equivalent if and only if the columns in the truth table are identical to each other.  Let's take two propositions A and B, so for logical equivalence, we can write it as A↔ B. In below truth table we can see that column for ¬ Av B and A → B, are identical hence A is Equivalent to B   A   B   ¬A       ¬ A V B   A→ B 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 V Q = Q V P. Associativity: (P/\ Q) /\ R= P /\ (Q /\ R), (P v Q) v R= P v (Q v R)   Identity element: P /\True = P, P v True= True.   Distributive: P /\ (Q v R) = (P /\ Q) v (P /\ R). P v (Q /\ R) = (P v Q) /\ (P v R). DE Morgan's Law:  ¬ (P /\ Q) = ( ¬ P) v ( ¬ Q) ¬ (P v Q) = ( ¬ P) /\ ( ¬ Q). Double-negation elimination:  ¬ ( ¬ P) = P.

Various Inference Rules And elimination rule: If A ˄ B elimination A, ---------------------- B If A ˄ B elimination B, ---------------------- A Modus Ponen Rule: A→B, A ------------------ B Unit Resolution Rule: From the disjunction, if one of the disjuncts is false then we can infer the other one s true. α˅ β , ¬ β ------------ , In this case ¬ β means β is false and hence α is true. [α˅ β , ¬ β ] → α α

DNF and CNF DNF: Disjunctive Normal Form OR of ANDs (terms) e.g. (p∧¬q) ∨ (¬p∧¬r) CNF: Conjunctive Normal Form “every sentence of propositional logic is logically equivalent to a conjunction of clauses” AND of ORs (clauses) e.g. (p∨¬q) ∧ (¬p∨¬r) Procedure for converting to CNF Convert the sentence B1,1 ⇔ (P1,2 ∨ P2,1) into CNF Eliminate ↔ replacing α↔β with ( α→β ) ˄ ( β → α ): (B1,1 → (P1,2 ∨ P2,1)) ˄ ((P1,2 ∨ P2,1) → B1,1) Eliminate → replacing α → β with ¬ α˅β : (¬B1,1 ˅ (P1,2 ∨ P2,1)) ˄ (¬(P1,2 ∨ P2,1) ˅ B1,1) CNF requires ¬ with literals so move ¬ inwards and solve the parenthesis; (¬B1,1 ˅ P1,2 ∨ P2,1) ˄ ((¬P1,2 ˄ ¬P2,1) ˅ B1,1) (¬B1,1 ˅ P1,2 ∨ P2,1) ˄ (¬P1,2˅ B1,1) ˄ ( ¬P2,1 ˅ B1,1) -------by Distributive Law.

Limitations of Propositional logic:   We cannot represent relations like ALL, some, or none with propositional logic. Example: All the girls are intelligent. Some apples are sweet. 2. Propositional logic has limited expressive power. 3. In propositional logic, we cannot describe statements in terms of their properties or logical relationships.

Propositional Theorem proving Propositional Theorem proving is a branch of automated reasoning where computers and algorithms can prove mathematical theorems automatically, thereby making the process faster, more efficient, and less prone to errors than manual methods. Advantages of Theorem Proving Theorem proving is a powerful technology that has many advantages over traditional methods of proof. These benefits include the following: Automated Process:  Theorem proving is an automated process that is faster and more efficient than manual proof methods. Optimization:  By identifying and fixing errors automatically, theorem proving helps improve the effectiveness and efficiency of these complex systems. Correctness:  Theorem proving can prove the correctness of a system or algorithm and uncover errors that may be hard to identify through manual methods.

Examples of Propositional Theorem Proving Example1: For the given Wumpus word prove that there is no pit in room [1,2] & [2,1] with the given rules. R1 : ¬ P 1,1 in [1,1] there is no pit R2 : B 1,1 ↔ (P 1,2 ˅ P 2,1 ) if there is breeze in 1,1 then pit in either 1,2 or 2,1 R3 : B 1,1 ↔ (P 1,2 ˅ P 2,1 ˅ P 3 ,1 ) R4 : ¬ B 1,1 no breeze in [1,1] R5 : B 2,1 breeze in [2,1] We can prove that, PIT is neither in the room (1,2) nor in the room (2,1) using propositional rules which are given and using inference rule.

As we have to prove no pit in room [1,2] & [2,1], so we need to follow only those rules containing pit for only (1,2) and (2,1) and breeze for only (1,1), i.e. rule 2 and rule 4 only. R2 : B 1,1 ↔ (P 1,2 ˅ P 2,1 ), means if there is breeze in (1,1) then pit in either (1,2) or (2,1) and if pit in either 1,2 or 2,1 then breeze in (1,1) can be written in formal language as, B 1,1 → (P 1,2 ˅ P 2,1 ) & (P 1,2 ˅ P 2,1 ) → B 1,1 By And-Elimination rule to above logical representation by eliminating the term after &,we get B 1,1 → (P 1,2 ˅ P 2,1 ) R4 : ¬ B 1,1 no breeze in [1,1] Using above rule, B 1,1 → (P 1,2 ˅ P 2,1 ) can be represented as ¬ B 1,1 → ¬(P 1,2 ˅ P 2,1 ) By MP rule to above logical representation, can be represented as ¬(P 1,2 ˅ P 2,1 ) By applying De Morgan`s rule to the above logical representation, ¬(P 1,2 ˅ P 2,1 ) → ¬P 1,2 ˄ ¬ P 2,1 ¬P 1,2 ˄ ¬ P 2,1 ; Hence it is proved, no pit in [1,2] & [2,1],  

Example 2 : Prove that Wumpus is in the room (1, 3) of the Wumpus world. Some Propositional Rules for the Wumpus world: We can prove that Wumpus is in the room (1, 3) using propositional rules which we have derived for the Wumpus world and using inference rule.

Apply Modus Ponens with ¬S11 and R1: We will firstly apply MP rule with R1, which is ¬S 11  → ¬ W 11  ^ ¬ W 12  ^ ¬ W 21 , and  ¬S 11  which will give the output ¬ W 11  ^ W 12  ^ W 21 . Apply And-Elimination Rule: After applying And-elimination rule to ¬ W 11  ∧ ¬ W 12  ∧ ¬ W 21 , we will get three statements: ¬ W 11 , ¬ W 12 , and ¬W 21 . Apply Modus Ponens to ¬S 21 , and R2: Now we will apply Modus Ponens to ¬S 21  and R2 which is ¬S 21  → ¬ W 21  ∧¬ W 22  ∧ ¬ W 31 , which will give the Output as  ¬ W 21  ∧ ¬ W 22  ∧¬ W 31 Apply And -Elimination rule: Now again apply And-elimination rule to  ¬ W 21  ∧ ¬ W 22  ∧¬ W 31 , We will get three statements: ¬ W 21 , ¬ W 22 , and ¬ W 31 .

Apply MP to S 12  and R4: Apply Modus Ponens to  S 12  and  R 4  which is  S 12  → W 13 ∨ W 12 ∨ W 22 ∨ W 11 , we will get the output as  W 13 ∨ W 12  ∨ W 22  ∨ W 11 . Apply Unit resolution on W 13  ∨ W 12  ∨ W 22  ∨W 11  and ¬ W 11  : After applying Unit resolution formula on W 13  ∨ W 12  ∨ W 22  ∨W 11  and ¬ W 11  we will get W 13  ∨ W 12  ∨ W 22 . Apply Unit resolution on W13 ∨ W12 ∨ W22 and ¬ W22 : After applying Unit resolution on W13 ∨ W12 ∨ W22 , and ¬W22 , we get W13 ∨ W12 as output.

Apply Unit Resolution on W 13  ∨ W 12  and ¬ W 12  : After Applying Unit resolution on  W 13  ∨ W 12  and ¬ W 12 , we will get  W 13  as an output, hence it is proved that the Wumpus is in the room [1, 3] Challenges of Theorem Proving Theorem proving is not without its challenges. Here are some of the factors that make the task harder: Complexity:  When the statements involved are long and complex, theorem proving can be a complex process. Scalability:  Theorem proving is challenging to scale, especially if the number of axioms and lemmas increases, making it hard to maintain or even optimize its performance. Ambiguity:  The natural language used to state theorems can sometimes be ambiguous. This poses a challenge when translating the language into a formal language that the theorem prover can process and understand.

Example 3. If a triangle is equilateral then it is Isosceles. If a triangle is Isosceles the two sides AB and AC are equal. If AB and AC are equal then angle B and angle C are equal. ABC is an equilateral triangle. Prove “angle B is equal to C”. Soln:- So writing the fact 4. “ ABC is an equilateral triangle ”, into Propositional Logic, by following the first three facts to prove “angle B is equal to C”. 1.Equilateral(ABC) → Isosceles(ABC) 2.Isosceles(ABC) → Equal(AB,AC) 3.Equal(AB,AC) →Equal(B,C) Convert to Clausal form 1.¬Equilateral(ABC) ˅ Isosceles(ABC) 2.¬Isosceles(ABC) ˅ Equal(AB,AC) 3.¬Equal(AB,AC) ˅Equal(B,C) 4. Equilateral(ABC)

To prove “angle B is equal to C” To prove Equal(B,C) , disprove “not equal B and C, ¬Equal(B,C)” The above disprove can happen by applying Resolution rule for which the facts are written n the formal language using Propositional Logic and are converted into clausal form. The resolution can be carried out for each clausal statement to disprove “not equal B and C, ¬Equal(B,C)”. And hence we can prove Equal(B,C) , to prove “angle B is equal to C”. The Resolution process is shown in the next slide.

Effective propositional model-checking What is effective propositional model-checking? The set of possible models, given a fixed propositional vocabulary, is finite, so entailment can. be checked by enumerating models. Efficient model-checking inference algorithms for. propositional logic include backtracking and local search methods and can often solve large. problems quickly. Basics of model-checking: The model checking process consists of three different phases: modeling, running, and analysis phase . In the modeling phase, we model the system using the modelling language to express it as finite-state systems and formalize the property using the property specification language. Three phases of model checking The modeling stage, The execution stage, and The analysis phase.

Advantages of Model Checking over theorem proving: • In contrast to theorem proving, model checking is completely automatic and fast, frequently producing an answer in a matter of minutes. • It can be used to check partial specifications and can provide useful information about correctness even if the system has not been completely specified. • Above all, model checking’s tour de force is that it produces counterexamples, which usually uncover subtle errors in design that would be difficult to find otherwise

Model-checking algorithm in AI: Model checking, in the context of AI, refers to  a rigorous validation technique used to ensure that an AI model satisfies specified requirements, such as safety and correctness properties . It involves exhaustively exploring the state space of the model to verify if it meets the desired specifications. What is a propositional model? A model in propositional logic with respect to a set of propositions X = {X1,...,Xn} is simply  a truth assignments to the propositions in X . For example, if our set of propositions is {P, Q}, then a model might be 〈 P = true, Q = true 〉 Importance of model checking : (Various functions ) Model checking is an important tool It verifies the correctness of systems . It can be used to find errors in systems before they are deployed, and It can also be used to verify that a system is behaving as expected.

What is model checking problem? A simple model-checking problem consists of  verifying whether a formula in the propositional logic is satisfied by a given structure . Difference between model checking and testing: ▶   Testing is better at finding bugs than model checking . ▶ Testing is faster than model checking. ▶ Testing is more precise than model checking. Difference between model checking and theorem proving : Model checking is automatic; theorem proving is not . Theorem proving can handle com- plex formalisms; model checking cannot. The strengths and weaknesses of model checking and theorem proving are clearly complementary.

A MODEL CHECKING EXAMPLE – SOLVING SUDOKU USING SIMULINK DESIGN VERIFIER Sudoku is a logic-based number-placement puzzle. The objective is to populate a 9x9 grid so that each column, row, and 3x3 box contains a single instance of the digits 1-9.

The initial board is blended with the environment (the In1 port) to produce a resultant state—the test board . The resultant state is checked for valid rows, columns, and 3x3 boxes. If all three conditions are met, then the given state is a valid solution to the Sudoku. The P block is a formal property (or logical proposition) that claims the output of the AND block is false for all possible cases. F ORMALIZING THE R EQUIREMENTS( MODEL OF SUDOKU ) Our approach to the Sudoku example is to first formalize the requirements of the game as a graphical model in Simulink

FORMALLY DEFINING VALID ROWS, COLUMNS, AND BOXES Each row, column, and box is passed through a Valid Set subsystem that simply checks for a single instance of the digits 1-9 in a set. This is done by extracting a particular row, column, or box from the test board . FORMALLY DEFINING VALID ROWS. This process of formally defining system requirements is entirely different from that of traditional testing. Through propositional logic, one does not attempt to define specific input conditions and enumerate the expected output—but with model checkng , the objective is to define specific properties of the system output that must hold throughout all possible input conditions.

THE COUNTEREXAMPLE A counterexample is a frame-by-frame account of the values assigned to the specific variables responsible for falsifying a proof objective. In essence, it is a test case that is known to violate the requirement. The implementation of the counterexample in Simulink Design Verifier is through an HTML report. The counterexample for the Sudoku example is presented in Figure. Some interpretation is needed to fully understand the counterexample. In this instance, the In1 values must be blended with the initial board to produce a meaningful interpretation. With the known solution as an additional constraint, the property is now proven valid—meaning that no additional cases meet the constraints of the formal requirements. Therefore, the unique solution to this Sudoku is now formally documented in the model as hardware and software also. OUTPUT INTERPRETATION

First-Order Logic (FOL) It is an extension to propositional logic. FOL is sufficiently expressive to represent the natural language statements in a concise way. First-order logic is also known as Predicate logic or First-order predicate logic. DEPARTMENT First-order Logic First-order logic (FOL) models the world in terms of Objects, which are things with individual identities. Properties of objects that distinguish them from other objects. Relations that hold among sets of objects. Functions, which are a subset of relations where there is only one “value” for any given “input” Examples: Objects: Students, lectures… Relations: Brother-of, bigger than, outside.. Properties: blue, oval, even, large, ... Functions: father-of, best-friend, second-half, one-more-than ...

Also called as Predicate Logic It is a generalization of Propositional Logic that allows us to express and infer arguments in infinite models, Eg., Some birds can fly. All men are mortal. At least one student has course registered. Following are the basic elements of FOL syntax: Constant 1, 2, A, John, Mumbai, cat,.... Variables x, y, z, a, b,.... Predicates Brother, Father, >,.... Function sqrt, Left Leg Of, .... Connectives , ¬, , ∧ ∨ ⇒ ⇔ Equality == Quantifier , ∀ ∃

Atomic Sentences in FOL Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a predicate symbol followed by a parenthesis with a sequence of terms. Atomic sentences are represented as Predicate (term1, term2, ......, term n) . Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay). Chinky is a cat: => cat (Chinky) . Complex sentences in FOL Complex sentences are made by combining atomic sentences using connectives. We can use logical connectives to construct more complex sentences, with the same syntax and semantics as in propositional calculus. Here are four sentences that are true in the model of Figure 8.2 under our intended interpretation: ¬Brother (Left Leg(Richard), John) Brother (Richard, John) ∧ Brother (John, Richard) King(Richard) ∨ King(John) ¬King(Richard) ⇒ King(John)

First-order logic statements can be divided into two parts: Subject: Subject is the main part of the statement. Predicate: A predicate can be defined as a relation, which binds two atoms together in a statement. In English, the predicate is the part of the sentence that tells you something about the subject. Consider the statement: “ X is an integer.”, it consists of two parts, the first part X is the subject of the statement and second part "is an integer," is known as a predicate. Quantifiers in First Order Logic A quantifier is a language element which generates quantification, and quantification specifies the quantity of specimen in the universe of discourse. These are the symbols that permit to determine or identify the range and scope of the variable in the logical expression.

Quantifier in FOL In logic, quantifier is a language element that helps in the generation of a quantitative statement or quantitative variable. It is a word that usually goes before a noun to express the quantity of the object; for example, a little milk. Most quantifiers are followed by a noun, though it is also possible to use them without the noun when it is clear what we are referring to. The need for quantifiers Quantifiers help us in everyday language, engineering, logic problems, and many other areas. Without quantifiers, it would be essentially impossible to give a full picture of what is meant by a statement. Domain of discourse A domain of discourse is a collection of entities that the logic being used is making statements about. For example, if a statement is made using ∀ in relation to rivets, the quantifier does not likely extend to ice cream cones.

Key benefits of quantifiers: 1. Adds helpful information We include quantifiers when we want to give an idea of the number of something. 2. Necessary for a quantified formula In logic, you need a quantifier in order to present a quantified formula. A quantified formula must have both a bound variable as well as a sub formula that specifies a property of the referent related to that variable. 3. Compactness A benefit of quantifiers is that they can help large concepts feel more compact. 4.Versatility By understanding quantifiers, you are able to express a large variety of ideas in many contexts, including engineering and manufacturing. 5. Help to understand logic statements A logic statement can be true or false, but it cannot be both. Quantifiers tell us the elements that satisfy the logic statement.

Syntax and Semantics in FOL. Every language has two aspects: syntax and semantics. While syntax deals with the form or structure of the language, Semantics adds meaning to the form. An interpretation of a first-order language assigns a denotation to each non-logical symbol (predicate symbol, function symbol, or constant symbol) in that language. It also determines a domain of discourse that specifies the range of the quantifiers. The semantics of predicate logic determine whether a statement or formula is true or false. The truth value of a formula is evaluated based on the interpretation of the predicate symbols, constants, variables, and the logical connectives.

∀ Universal Quantifier Definition: It expresses the fact that, in a particular universe of discourse, all  objects have a particular property. ∀𝑥 Universal Quantifier along with variable assigned to the subject. Applicable for all the statements that starts with any one of the words given below; ▶ Every/All/Each/Any The main connective for universal quantifier ∀ is implication →. For example, “All kings are persons,” is written in first-order logic as ∀ x King(x) → Person(x) Some of the examples of Universal Quantifier by using words, “Every/All/Each/Any” are given in the next slide.

Propositional Expansion:- The universal quantifier can be considered as a repeated conjunction: Suppose our universe of discourse consists of the objects X1,X2,X3,… and so on. Let ∀ be the universal quantifier. What ∀x: P(x) means is: X1 has property P , and X2 has property P , and X3 has property P , and ... This translates into propositional logic as: P(X1)∧P(X2)∧P(X3)∧… This expression of ∀x as a conjunction is known as the propositional expansion of ∀x. The propositional expansion for the universal quantifier can exist in actuality only when the number of objects in the universe is finite. If the universe is infinite, then the propositional expansion can exist only conceptually, and the universal quantifier cannot be eliminated.

Universal Quantifier ‘ ∀ ’: • Itspecifies that the statement within its range is truefor everything of every instance of particular thing •“for all x” "for each x" "for every x" –  ∀ xA: A is True for every replacement of x  – "All man drink coffee" :  ∀ x(man(x) -->drink(x, coffee))  –“Every Gorilla is Black” : ∀ x(Gorilla(x) → Black(x))  –“Everyone at DJ is smart” : ∀ x At (x, DJ) → smart(x)  – "All birds fly" :  ∀ x(bird(x) -->fly(x))  – "Every man respects his parent" : ∀ xman(x) -->respects(x, parent)         Universal Quantifier ‘∀’: •It specifies that the statement within its range is true for everything of every instance of particular thing. “for all x”, “for every x”, “for each x”, “for Any” ∀xA: A is True for every replacement of x “All birds fly” : In this question the predicate is “fly(bird) = fly(x)” where x= bird And since there are all birds who fly so it will be represented as follows. ∀ x bird(x) →fly(x) . “All man drink coffee” : In this question the predicate is drink(x,y) where x= man, y = coffee And since there are all man who drink so it will be represented as follows. ∀x(man(x) → drink(x, coffee))

“Not all students like both Mathematics and Science”. In this question, the predicate is “like(x, y)” where x = student, and y = subject . Since there are not all students, so we will use ∀ with negation, so following representation for this: ¬ ∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)]. “Every Gorilla is Black” : In this question, the predicate is “Black(x)” where X = Gorilla . Since there is every Gorilla so will use ∀, and it will be represented as follows: ∀x(Gorilla(x) → Black(x)) “Every man respects his parent” : In this question, the predicate is “respect(x, y)” where x=man, and y= parent . Since there is every man so will use ∀, and it will be represented as follows: ∀xman(x) → respects(x, parent)

For each “Each country has its own capital”. In this question, the predicate is own capital(x) where x= country . Since there is Each so will use ∀, and it will be represented as follows: ∀x(country(x) →(capital ,x)) For any “If anyone cheats, everyone suffers”. In this question, the predicate is “suffer(y)” where y = everyone . Since there is anyone so will use ∀, and it will be represented as follows: ∀x (cheat(x) → ∀y suffer(y)) “Everyone at DJ is smart” : In this question, the predicate is “smart(x)” where X = Everyone . Since there is Everyone so will use ∀, and it will be represented as follows: ∀x At (x, DJ)→smart(x)

“ Every number is either negative or has a square root”: In this question, the predicate is “square root(x)” where X = Every number = N(X) . Since there is Every so will use ∀, and it will be represented as follows: ∀x (Negative(x) ˄ ¬ Sqroot(x)) ˅(¬Negative(x) ˄ Sqroot(x)) “Not every dragon is sleeping”: In this question, the predicate is “sleeping(x)” where X = Dragon . Since there is Not every so will use ¬ ∀ , and it will be represented as follows: ¬∀x (D(x) → S(x)) “ Every connected and circuit free- graph is a tree”: In this question, the predicate is “tree(x)” where X = Every connected and cf graph . Since there is Every so will use ∀ , and it will be represented as follows: ∀x[(connected(x) ˄ cf (x)) → Tree(x))]

We can get even more elaborate by adding the adjective, such as green, to the noun phrase. Simply let G = green. This is illustrated. “Every green dragon is sleeping”: In this question, the predicate is “sleeping(x)” where x= every green . Since there is every so will use ∀, and it will be represented as follows: ∀x ((G(x) ∧ D(x)) → S(x)) “Not every green dragon is sleeping”: In this question, the predicate is “sleeping(x)” where x= not every green . Since there is not every green so will use ∀, and it will be represented as follows: ¬∀x ((G(x) ∧ D(x)) → S(x)) Point to remember: The main connective for universal quantifier ∀ is implication →.

Property of Universal Quantifier: ( every-every) In universal quantifier, ∀x∀y is similar to ∀y∀x. Every girl cheated every boy. ∀x ∀y [ (GIRL(x) ∧ BOY(y)) → cheated(x,y) ] In other word, ∀y ∀x [ (BOY(y) ∧ GIRL(x)) → cheated(x,y) ] For every entity x and for every entity y, if x is a girl and y is a boy, then x cheated y; in other words, for every girl and for every boy, she cheated him.

∃ Existential Quantifier Definition: It expresses the fact that, in a particular universe of discourse, some  objects have a particular property. ∃𝑥 Existential Quantifier along with variable assigned to the subject. Applicable for all the statements that starts with any one of the words given below; ▶ Some /At least one/There exists a/There is a The main connective for existential quantifier ∃ is and ∧. For example, that King John has a crown on his head, we write ∃x Crown(x) ∧ OnHead(x, John) Some of the examples of Existential Quantifier by using words, Some /At least one/There exists a/There is a are given in the next slide.

Propositional Expansion: Suppose our universe of discourse consists of the objects X1,X2,X3,… and so on. Let ∃ be the existential quantifier. What ∃x: P(x) means is: At least one of X1,X2,X3,… has property P. This means: Either X1 has property P , or X2 has property P , or X3 has property P , or ... This translates into propositional logic as: P(X1)∨P(X2)∨P(X3)∨… This expression of ∃x as a disjunction is known as the propositional expansion of ∃x. The propositional expansion for the existential quantifier can exist in actuality only when the number of objects in the universe is finite. If the universe is infinite, then the propositional expansion can exist only conceptually, and the existential quantifier cannot be eliminated.

Existential Quantifier ‘∃’: It specifies that the statement within its range is true for something of every instance of particular thing. “for some x” “there exists x” “there is x” “for at least one x” – ∃xA: A is True for at least one replacement of x For Eg. “Some girls are intelligent” : In this question, the predicate is intelligent(x) where x= intelligent . Since there are some girls so we will use ∃ , and it will be represented as : ∃x(girls(x) ∧ Intelligent(x))

“Some boys play cricket”: In this question, the predicate is " play(x, y) ," where x= boys, and y= game. Since there are some boys so we will use ∃ , and it will be represented as : ∃x boys(x) ∧ play(x, cricket). “Someone killed the cat and is guilty” : In this question, the predicate is guilty(x) where x= someone, and y= game. Since there are some boys so we will use ∃ , and it will be represented as : ∃xkilled (x, cat ) ∧ guilty (x) There is a barber who shaves all men in the town who do not shave themselves. In this question, the predicate is “barber shaves all men” where x= barber, and y= men. Since there is a barber so we will use ∃ , and it will be represented as : ƎX barber(X) ^ (∀Y townman(Y) ^ ¬shaves(Y, Y) ) ⇒ shaves(X, Y))

“Some dragons are sleeping”: In this question, the predicate is sleeping(x) where x= Dragon . Since there is some, so we will use ∃ , and it will be represented as : ∃x (D(x) ∧ S(x)) “No dragon is sleeping”: In this question, the predicate is sleeping(x) where x= Dragon . Since there is No dragon some, so we will use ¬ ∃, and it will be represented as : ¬∃x (D(x) ∧ S(x)) We can get even more elaborate by adding the adjective, such as green, to the noun phrase. Simply let G = green. This is illustrated, “Some green dragon are sleeping”: In this question, the predicate is sleeping(x) where x= Green Dragon = G(x)D(x) . Since there is some, so we will use ∃, and it will be represented as : ∃x ((G(x) ∧ D(x)) ∧ S(x)) “No green dragon is sleeping”: In this question, the predicate is sleeping(x) where x= Green Dragon = G(x)D(x) . Since there is some, so we will use ∃, and it will be represented as : ¬∃x ((G(x) ∧ D(x)) ∧ S(x))

“Some people are either religious or pious” : In this question, the predicate is " either religious or pious”, where x= people. Since there are some people so we will use ∃ , and it will be represented as : ∃x(Person(x) ∨ (Religious(x) ∨ Pious(x))) “There is a white dog” : In this question, the predicate is white (x) where x= Dog . Since there is a, so we will use ∃ , and it will be represented as : ∃x(Dog(x) ^ White(x)) “ Only one student failed in Mathematics. In this question, the predicate is “ failed(x, y)” , where x= student , and y= subject . Since there is only one (analogous to At least one) student who failed in Mathematics, so we will use following representation for this: ∃ (x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)] . Point to remember: The main connective for existential quantifier ∃ is and ∧.

Property of Existential Quantifier: ( some-some) In Existential quantifier, ∃x∃y is similar to ∃y∃x. Some girls cheated some boys. ∃x ∃y [ (GIRL(x) ∧ BOY(y)) ∧ CHEAT(x,y) ] In other order, ∃y ∃x [ (BOY(y) ∧ GIRL(x)) ∧ CHEAT(x,y) ] There is an entity x and there is an entity y such that x is a girl and y is a boy and x cheated y; in other words, there is a boy and there is a girl such that she cheated him.

Properties of Quantifiers: ∃x∀y is not similar to ∀y∃x. Because the quantificational expressions are doing different things. So there interaction produces ambiguity. Every girl cheated some boy. Meaning 1: ∀x [ GIRL(x) → ∃y (BOY(y) ∧ CHEAT(x,y)) ] For every entity x, if x is a girl then there is some entity y, such that y is a boy and x cheated y; in other words, for every girl, there is a boy, such that she cheated him. Meaning 2: ∃y [ BOY(y) ∧ ∀x (GIRL(x) → CHEAT(x,y)) ] There is some entity y, such that y is a boy and for every entity x, if x is a girl then x cheated y; in other words, there is a boy, such that for every girl, she cheated him. Points to remember about, Properties of Quantifiers: In Universal quantifier, ∀x∀y is similar to ∀y∀x. In Existential quantifier, ∃x∃y is similar to ∃y∃x. ∃x∀y is not similar to ∀y∃x.

Special cases of Universal and Existential Quantifier ▶ None/No x ¬ (∃𝑥 …) ▶ Not every/Not all ¬ (∀𝑥 …) ▶ Every P- ish x has property Q ∀𝑥 𝑃 (𝑥) → (𝑥) ▶ Some P- ish x has property Q ∃𝑥 𝑃 (𝑥) ∧ (𝑥)

Free and Bound Variables The quantifiers interact with variables which appear in a suitable way. There are two types of variables in First order logic which are given below: • Free Variable: A variable is said to be a free variable in a formula if it occurs outside the scope of the quantifier. Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable. • Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the scope of the quantifier. Example: ∀x [A(x) B( y)], here x and y are the bound variables.

Emily is either a surgeon or a lawyer. Occupation (Emily, Surgeon) ∨ Occupation (Emily, Lawyer) or Occupation (Emily, Surgeon) ⇔ ¬ Occupation (Emily, Lawyer) Joe is an actor, but he holds another job. Occupation(Joe, Actor) ∧ ∃ o [Occupation(Joe, o) ∧ ¬ (o = Actor)] or Occupation(Joe, Actor) ∧ [ Occupation(Joe, Doctor) ∨ Occupation(Joe, Surgeon) ∨ Occupation(Joe, Lawyer) ] All surgeons are doctors. ∀ p [Occupation(p, Surgeon) ⇒ Occupation(p, Doctor )] Joe does not have a lawyer (i.e., Joe is not a customer of any lawyer). ∀ p [Occupation(p, Lawyer) ⇒ ¬ Customer(Joe, p)] or ¬ ∃ p [Occupation(p, Lawyer) ∧ Customer(Joe, p)] or ∀ p [Customer(Joe, p) ⇒ ¬ Occupation(p, Lawyer)]

Emily has a boss who is a lawyer. ∃ p [Boss(p, Emily) ∧ Occupation(p, Lawyer)] There exists a lawyer all of whose clients are doctors (i.e., all of whose customers are doctors). ∃ p1 ∀ p2 Occupation(p1, Lawyer) ∧ [Customer(p2, p1) ⇒ Occupation(p2, Doctor)] or ∃ p1 Occupation(p1, Lawyer) ∧ [∀ p2 Customer(p2, p1) ⇒ Occupation(p2, Doctor)] Every surgeon has a lawyer (i.e., every surgeon is a customer of a lawyer). ∀ p1 ∃ p2 Occupation(p1, Surgeon) ⇒ [Customer(p1, p2) ∧ Occupation(p2, Lawyer)] or ∀ p1 Occupation(p1, Surgeon) ⇒ [∃ p2 Customer(p1, p2) ∧ Occupation(p2, Lawyer)]

 Sr. No Propositional Logic Predicate Logic 1 Propositional logic is the logic that deals with a collection of declarative statements which have a truth value, true or false. Predicate logic is an expression consisting of variables with a specified domain. It consists of objects, relations and functions between the objects. 2 It is the basic and most widely used logic. Also known as Boolean logic. It is an extension of propositional logic covering predicates and quantification. 3 A proposition has a specific truth value, either true or false. A predicate’s truth value depends on the variables’ value. 4 Scope analysis is not done in propositional logic. Predicate logic helps analyze the scope of the subject over the predicate. There are three quantifiers: Universal Quantifier (∀) depicts for all, Existential Quantifier (∃) depicting there exists some and Uniqueness Quantifier (∃!) depicting exactly one. 5 Propositions are combined with Logical Operators or Logical Connectives like Negation(¬), Disjunction(∨), Conjunction(∧), Exclusive OR(⊕), Implication(⇒), Bi-Conditional or Double Implication(⇔).  Predicate Logic adds by introducing quantifiers to the existing proposition. 6 It is a more generalized representation. It is a more specialized representation. 7 It cannot deal with sets of entities.  It can deal with set of entities with the help of quantifiers. Propositional Logic versus First Order Logic ( Predicate Logic

Knowledge Engineering in First-order logic What is knowledge-engineering? The process of constructing a knowledge-base in first-order logic is called as knowledge- engineering. In  knowledge-engineering , someone who investigates a particular domain, learns important concept of that domain, and generates a formal representation of the objects, is known as  knowledge engineer . The knowledge-engineering process: Following are some main steps of the knowledge-engineering process. Using these steps, we will develop a knowledge base which will allow us to reason about digital circuit ( One-bit full adder ) which is given below

Identify the task: The first step of the process is to identify the task, and for the digital circuit, there are various reasoning tasks. At the first level or highest level, we will examine the functionality of the circuit: Does the circuit add properly? What will be the output of gate A2, if all the inputs are high? At the second level, we will examine the circuit structure details such as: Which gate is connected to the first input terminal? Does the circuit have feedback loops?

2. Assemble the relevant knowledge: Assemble the relevant knowledge which is required for digital circuits. So for digital circuits, we have the following required knowledge: Logic circuits are made up of wires and gates. Signal flows through wires to the input terminal of the gate, and each gate produces the corresponding output which flows further. In this logic circuit, there are four types of gates used:  AND, OR, XOR, and NOT . All these gates have one output terminal and two input terminals (except NOT gate, it has one input terminal). 3. Decide on vocabulary: The next step of the process is to select functions, predicate, and constants to represent the circuits, terminals, signals, and gates. The functionality of each gate is determined by its type, which is taken as constants such as  AND, OR, XOR, or NOT . Circuits will be identified by a predicate:  Circuit (C1) .

For the terminal, we will use predicate:  Terminal(x) . For gate input, we will use the function  In(1, X1)  for denoting the first input terminal of the gate, and for output terminal we will use  Out (1, X1) . The function  Arity(c, i, j)  is used to denote that circuit c has i input, j output. The connectivity between gates can be represented by predicate  Connect(Out(1, X1), In(1, X1)) . We use a unary predicate  On (t) , which is true if the signal at a terminal is on. Encode general knowledge about the domain: To encode the general knowledge about the logic circuit, we need some following rules: Few examples are given below: If two terminals are connected then they have the same input signal, it can be represented as: ∀  t1, t2 Terminal (t1) ∧ Terminal (t2) ∧ Connect (t1, t2) → Signal (t1) = Signal (2).     Signal at every terminal will have either value 0 or 1, it will be represented as: ∀  t Terminal (t) →Signal (t) = 1 ∨Signal (t) = 0.    All gates are logic circuits: ∀  g Gate(g) → Circuit (g). 

4. Encode general knowledge about the domain: To encode the general knowledge about the logic circuit, we need some following rules: Few examples are given below: If two terminals are connected then they have the same input signal, it can be represented as: ∀  t1, t2 Terminal (t1) ∧ Terminal (t2) ∧ Connect (t1, t2) → Signal (t1) = Signal (2).     Signal at every terminal will have either value 0 or 1, it will be represented as: ∀  t Terminal (t) →Signal (t) = 1 ∨Signal (t) = 0.    All gates are logic circuits: ∀  g Gate(g) → Circuit (g).  5.   Encode a description of the problem instance: For the given circuit C1, we can encode the problem instance in atomic sentences as below: Since in the circuit there are two XOR, two AND, and one OR gate so atomic sentences for these gates will be: For XOR gate: Type(x1)= XOR, Type(X2) = XOR   For AND gate: Type(A1) = AND, Type(A2)= AND   For OR gate: Type (O1) = OR.   

6. Pose queries to the inference procedure and get answers: In this step, we will find all the possible set of values of all the terminal for the adder circuit. The first query will be: What should be the combination of input which would generate the first output of circuit C1, as 0 and a second output to be 1? ∃ i1, i2, i3 Signal (In(1, C1))=i1  ∧  Signal (In(2, C1))=i2  ∧ Signal (In(3, C1))= i3∧ Signal (Out(1, C1)) =0 ∧ Signal (Out(2, C1))=1    7. Debug the knowledge base: Now we will debug the knowledge base, and this is the last step of the complete process. In this step, we will try to debug the issues of knowledge base. In the knowledge base, we may have omitted assertions like 1 ≠ 0.
Tags