From Natural Language to Logical Formulas
Knowledge representation means describing facts about the world in a way that a computer (AI) can understand and reason with.
In everyday language, we say things like: "Every student who takes a course learns something."
But a computer doesn't understand sentences like that! We need to translate them into a logical form using mathematical symbols.
First-Order Logic (FOL) provides a structured language with:
Let's convert this natural language statement into FOL step by step...
Now we want to say:
We write this as:
Let's break down the formula piece by piece:
FOL allows you to describe general rules, not just single facts.
Student(ali) ∧ Takes(ali, CS221) → Learns(ali) Student(sara) ∧ Takes(sara, AI101) → Learns(sara) Student(omar) ∧ Takes(omar, ML202) → Learns(omar) Student(fatima) ∧ Takes(fatima, DB301) → Learns(fatima) ... // Need to list thousands of students!
∀x ∀y (Student(x) ∧ Takes(x, y)) → Learns(x) // This ONE formula applies to everyone! // Ali, Sara, Omar, Fatima, and anyone else.
FOL helps AI systems generalize and infer new facts automatically.
If the AI knows:
↓ Automatic Inference ↓
It can automatically conclude:
That's reasoning! The AI didn't need to be explicitly told that Ali learns—it figured it out from the general rule.
English: "Everyone has a mother"
For all people x, there exists someone y who is x's mother.
English: "All birds have wings"
For all x, if x is a bird, then x has wings.
English: "If person x is a friend of y, then y is a friend of x"
Friendship is symmetric (bidirectional).
English: "Students who study hard pass exams"
For all x, if x studies hard, then x passes the exam.
English: "If x is taller than y, and y is taller than z, then x is taller than z"
Height is transitive.
English: "There exists a book that everyone has read"
There exists at least one book x such that every person y has read it.
| Concept | Meaning |
|---|---|
| Knowledge Representation | Describing facts about the world in a structured way that computers can process |
| Why FOL? | Because it can represent general rules using variables and quantifiers (∀, ∃) |
| Generalization | One rule covers many situations—no need to list every individual case |
| Automatic Inference | AI can derive new facts from existing knowledge using logical rules |
| Precision | Unambiguous meaning—no confusion about what statements mean |
| Compositionality | Complex statements built from simpler parts using logical operators |