For AI systems to reason intelligently, they need a way to represent knowledge about the world. Knowledge representation (KR) is the study of how to encode knowledge in a form that computers can use for inference and problem-solving.
Techniques
Logical Representations — Propositional and first-order logic for precise reasoning
Semantic Networks — Graph-based representation with nodes (concepts) and edges (relationships)
Frames — Object-oriented representation with slots and fillers
Production Rules — IF-THEN rules for expert systems
Ontologies — Formal, shared conceptualizations of a domain
Probabilistic Representations — Bayesian networks for uncertainty
Propositional Logic
Propositional logic uses boolean variables (propositions) and logical connectives: AND (∧), OR (∨), NOT (¬), IMPLIES (→).
Propositions:
P: "It is raining"
Q: "The ground is wet"
Rules:
P → Q (If raining, ground is wet)
P (It is raining)
∴ Q (Therefore, ground is wet) — Modus Ponens
First-Order Logic (FOL)
FOL extends propositional logic with quantifiers (∀ for all, ∃ there exists) and predicates that describe relationships between objects.
∀x (Man(x) → Mortal(x)) (All men are mortal)
Man(Socrates) (Socrates is a man)
∴ Mortal(Socrates) (Therefore, Socrates is mortal)
Inference Rules
Modus Ponens — If P → Q and P is true, infer Q
Modus Tollens — If P → Q and Q is false, infer ¬P
Resolution — Combine clauses to derive new knowledge
Forward Chaining — Start with known facts, apply rules to derive new facts
Backward Chaining — Start with goal, work backward to find supporting facts
Unification & Resolution
Unification finds substitutions that make two logical expressions identical. Resolution is a complete inference rule for FOL that proves statements by contradiction.
Practice Task: Represent the following in FOL: "All students like AI. John is a student. Therefore John likes AI." Perform forward chaining to prove "John likes AI." Represent a family tree using FOL predicates (Parent, Sibling) and infer three new facts using resolution.