Knowledge and Logical Agents

Types of logic
Note this is a huge area, so I just looked as the basics for each
Syntax based
0-Order logic (Propositional logic)
Proposition - is a statement that can be true of false (not both)
1+1=2 is propositional
X+1=2 is not propositional, since we dont know what X is, thus is true and false
Typically boolean operators are used to define facts, such as AND, NOT and OR.
First-Order Logic
Propositional logic defines facts.
First order logic builds on propositional logic and includes objects, that have facts assigned to them.
Objects may have relationships between other objects, such as brother_of()…
You can think of the objects being the same as in programming, where variables constants and functions define them. However they are more abstract so you can make up functions and stuff.
Inference
With propositional logic statements can be inferred:
P: “Today is rainy”
Q: “Is the ground wet”
P ⇒ Q: “If today is rainy, then the ground is wet”
If something cannot be proven, that does not mean it is false.

Proof by truth table
In the example below we can prove that Q is true, but we connot prove that because of Q we get P1.

Applying logical rules
- Apply logical rules to pairs of sentences
- This means we can infer new sentences
- We can then add add the new sentence to the knowledge base
- Just keep repeating
Example methods of inference:
- Unit resolution:
- If we know
A OR B
- And we also know
NOT A
- Then we can infer
B
- “Now is day or night”, “not day”, “then now is night”
- If we know
- Modus Ponens
- If we know
A
- And we know
A ⇒ B
- Then we know
B
- “Jay said yes”, “Jerry always says what Jay says”, “We know Jay says yes”
- If we know
Resolution Algorithm
Imagine you have a detective's notebook, which is your knowledge base (KB), and you're trying to solve a mystery - whether it rained today (Q).
Your notebook has two notes:
- If the ground is wet, then it rained.
- The ground is not wet.
You want to use these notes to figure out if it rained today.
Turning Notes into Formal Logic
First, you translate your notes into logic:
- Ground wet (W) implies Rain (R): W⇒R
- Not Ground wet: ¬W
In formal logic, an implication like "if W then R" is the same as saying "not W or R" (because if it's not true that the ground is wet, the statement is true regardless of the rain, and if it is true that the ground is wet, it must have rained for the statement to be true). So you rewrite your first note as ¬W∨R.
Resolution Algorithm
Now, you want to use the resolution algorithm to figure out if it rained. Here's what you do in simple steps:
- Add the opposite of what you want to prove to your notebook. You want to prove it rained, so you add "it did not rain" (¬R) to your notes.
- Look for contradictions. If you can find two notes that contradict each other, then your assumption (it did not rain) must be wrong, and therefore, it must have rained.
- Apply the resolution. You look for notes that, when put together, would cancel each other out. You have ¬W∨R and ¬R as your notes. According to the rules of logic, these two can be combined (resolved) to simply ¬W, because the R and ¬R cancel each other out.
- Check for contradictions. After resolution, you're left with ¬W, which is also in your notebook already. Since you're not getting a contradiction (because you haven't proven W, just ¬W), you can't conclude that it rained based on your notes. The resolution was unsuccessful in proving it rained.
Preparing the knowledge base
You can string the sentences together with ORs. (Apparently)
P1 or P2 or … or Pi