DEV Community

Cover image for Week 2:Artificial Intelligence class experience in cs50(Knowledge)- Part 1
Debojyoti Chakraborty
Debojyoti Chakraborty

Posted on

Week 2:Artificial Intelligence class experience in cs50(Knowledge)- Part 1

In this class learned about the knowledge,knowledge based reasoning,Propositional logic,inference,inference rule,first order logic,knowledge engineering.

We humans can make conclusions from the our existing knowledge like we know that computer can compute something and it's need some input.From that we can conclude that it can give some output.

The concept of representing knowledge and drawing conclusions from it is also used in AI, and in this lecture we will explore how we can achieve this behaviour.

Now there are the agents which we know from previous class that agents are the things which can interact with the enviourment.

Knowledge based Agents

The agents which are give reasons by operating on internal representation of knowledge.

Took the example used in class:

What does “reasoning based on knowledge to draw a conclusion” mean?

Let’s start answering this with a Harry Potter example. Consider the following sentences:

If it didn’t rain, Harry visited Hagrid today.
Harry visited Hagrid or Dumbledore today, but not both.
Harry visited Dumbledore today.

Based on these three sentences, we can answer the question “did it rain today?”, even though none of the individual sentences tells us anything about whether it is raining today. Here is how we can go about it: looking at sentence 3, we know that Harry visited Dumbledore. Looking at sentence 2, we know that Harry visited either Dumbledore or Hagrid, and thus we can conclude

Harry did not visit Hagrid.

Now, looking at sentence 1, we understand that if it didn’t rain, Harry would have visited Hagrid. However, knowing sentence 4, we know that this is not the case. Therefore, we can conclude

It rained today.
To come to this conclusion, we used logic, and today’s lecture explores how AI can use logic to reach to new conclusions based on existing information.

Sentence

A sentence is an assertion about the world in a knowledge representation language. A sentence is how AI stores knowledge and uses it to infer new information.




                      ___________ PROPOSITIONAL lOGIC
                    /
                  /
                /
Logic --------/
              \
               \ 
                \
                 \________________ fIRST oRDER lOGIC


Enter fullscreen mode Exit fullscreen mode

Now Propositional logic have the following components
I try to give a diagram representation instead of a text version:

Propostional Logic
propositional logic is based on the statements told by us about the world that can be either true or false.
|
|
-----LOGICAL CONNECTIVES
     |These are the logical symbols that connect 
     |propositional  symbols in order to reason in a 
     |more complex way about the world.
     ----------------------------------
     - Not (¬) inverses the truth value of the 
       proposition.So the example if P:"it is raining" 
       then ¬P means not raining.
       --------
       P | false
      ¬P | true
       --------
       P | true
      ¬P | false
       ---------
    - And(^)  connects two different propositions. When 
      these two proposition, P and Q, are connected by 
      ∧, the resulting proposition P ∧ Q is true only in 
      the case that both P and Q are true.
      ------------------------------------
      P    |     false
      Q    |     false
      p^Q  |     false
      ------------------------------------
      P    |     true
      Q    |     false
      p^Q  |     false
      ------------------------------------
      P    |     false
      Q    |     true
      p^Q  |     false
      ------------------------------------
      P    |     true
      Q    |     true
      p^Q  |     true
     ------------------------------------
    - Or (∨) is true as as long as either of its 
      arguments is true. This means that for P ∨ Q to be 
      true, at least one of P or Q has to be true.
      ------------------------------------
      P    |     false
      Q    |     false
      pvQ  |     false
      ------------------------------------
      P    |     true
      Q    |     false
      pvQ  |     true
      ------------------------------------
      P    |     false
      Q    |     true
      pvQ  |     true
      ------------------------------------
      P    |     true
      Q    |     true
      p^Q  |     true
     ------------------------------------
     It is worthwhile to mention that there are two 
     types of Or: an inclusive Or and an exclusive Or. 
     In an exclusive Or, P ∨ Q is false if P ∧ Q is 
     true. That is, an exclusive Or requires only one of 
     its arguments to be true and not both. An inclusive 
     Or is true if any of P, Q, or P ∧ Q is true. In the 
     case of Or (∨), the intention is an inclusive Or.
     -------------------------------------------------
     -------------------------------------------------
     - Implication (→) represents a structure of “if P 
       then Q.” For example, if P: “It is raining” and 
       Q: “I’m indoors”, then P → Q means “If it is 
       raining, then I’m indoors.” In the case of P 
       implies Q (P → Q), P is called the antecedent and 
       Q is called the consequent.
        ___________________________
        P      |      false
        Q      |      false
        P → Q  |      true
        -------------------
        P      |      false
        Q      |      true
        P → Q  |      true
        -------------------
        P      |      true
        Q      |      false
        P → Q  |      false
        -------------------
        P      |      true
        Q      |      true
        P → Q  |      true
        -------------------
    - Biconditional (↔) is an implication that goes both 
      directions. You can read it as “if and only if.” P 
      ↔ Q is the same as P → Q and Q → P taken together. 
      For example, if P: “It is raining.” and Q: “I’m 
      indoors,” then P ↔ Q means that “If it is raining, 
      then I’m indoors,” and “if I’m indoors, then it is 
      raining.” This means that we can infer more than 
      we could with a simple implication. If P is false, 
      then Q is also false; if it is not raining, we 
      know that I’m also not indoors.
        ___________________________
        P      |      false
        Q      |      false
        P → Q  |      true
        -------------------
        P      |      false
        Q      |      true
        P → Q  |      false
        -------------------
        P      |      true
        Q      |      false
        P → Q  |      false
        -------------------
        P      |      true
        Q      |      true
        P → Q  |      true
        -------------------
    |Model(The model is an assignment of a truth value 
    |to every proposition.)
    |
    |
    ------Knowledge Base(KB):The knowledge base is a set 
    |of sentences known by a knowledge-based agent. This 
    |is knowledge that the AI is provided about the 
    |world in the form of propositional logic sentences 
    |that can be used to make additional inferences 
    |about the world.

Enter fullscreen mode Exit fullscreen mode

In next part we will look through the inference and model checking algorithm.

Reference:

Top comments (0)