Knowledge - Represent Our knowledge using propositional logic and make Intelligent decision.

 Introduction: 

Artificial means Made or produced by a human being rather than occurring naturally, especially as a copy of some-thing nature. Intelligence means the ability to acquire and apply knowledge and skills. We are going to represent our knowledge using propositional logic in such a way that computers can understand and make intelligent decisions from there.

Suppose there are three sentences, we inferred two many sentences . Today we are going to implement this idea into the computer and we are going to make an intelligent decision from there. First, we need to represent these sentences by using propositional logic. Then we make a decision using knowledge base. The knowledge base is a set of sentences known by a knowledge-based agent 

This is an Artificial Intelligence course conducted in City Universit by Nuruzzaman Faruqui. This is the best course in Bangladesh. Because Sir explained all the necessary things to us well. The problem we are dealing with in the lab. First, sir gives us a very good idea of the problem by using many examples. After that sir explains about the solutions like how we can solve the problem, how they work. For that, we understand everything very easily. 


Problem : 

First, we have to know about the problem. The problem is :  

  •      If it didn't rain, Harry visited Hagrid today.
  •      Harry visited Hagrid or Dumbledore today, but not both. 
  •      Harry visited Dumbledore today.
We have these three sentences. From these three sentences we inferred two more sentences  they are :

  •      Harry did not visit Hagrid today
  •      It rained today.

The python code to represent knowledge using propositional and make an intelligent decision

First, we have to import the logic file. After that, we need to symbol the rain, hagrid, and dumbledore. Then we have to implement the sentences into logical sentences by using propositional logic. We need to use the knowledge base.

 

 Pseudocode :

# Here we import everything form logic.py
from logic import *

rain = Symbol("rain") # Rain is the symbol for rain
hagrid = Symbol("hagrid")
dumbledore = Symbol("dumpledore")

# we create here a logical sentence using logical connectives
logical_sentence = And(rain, hagrid)
# we can't directly print the logical sentence so we use a formula function
print(logical_sentence.formula())

# we create a implication logic here
implication_logic = Implication(Not(rain), hagrid)
print(implication_logic.formula())

# "We make decision from knowledge base " ,all of the statement will be true then knowlegde base will be true
knowledge_base = And(
Implication(Not(rain), hagrid),
Or(hagrid, dumbledore),
Not(And(hagrid, dumbledore)),
hagrid
)

print(knowledge_base.formula())
# Here we use model_check function and here two argument is knoledge_base and another
 is it rain today or not. Then we print it
print(model_check(knowledge_base, rain))


Result : 

In the pseudo code we are implementing these three sentences. If there find any errors then fixed it. After run the code then you will get the resultts.

In this picture we can see all of the logical sentences and the two-sentence also which is made by using the intelligent decision.

Conclusion : 
First, we introduced the problem. After that, we explain the problem and how we can solve the problem. then we explain the algorithm after that we write the code with comments.  Anyone can easily understand the code. we discuss the result. If anyone follows this article then he/she can easily understand everything, They can also do this very easily. 
we can say this is the only reflection of the way that Sir has taught us. So this is the best AI course in Bangladesh. 
 
You are free to copy the code from here or some other concluding remarks

 

 


No comments

Powered by Blogger.