After studying this material, you should be able to:
Before Real Logic, you need to understand classical (Boolean) logic:
| Statement | Truth Value |
|---|---|
| "The sky is blue" | TRUE (1) |
| "The sky is green" | FALSE (0) |
⚠️ Problem: Classical logic is binary — everything is either true or false. But reality is often gradual.
Example:
Fuzzy Logic solves the binary problem by allowing degrees of truth:
Truth Value ∈ [0, 1]
0 = completely false
0.5 = half true
1 = completely true
Example:
"Coffee is healthy" → truth value = 0.6
"Arsenic is healthy" → truth value = 0.02
"Broccoli is healthy" → truth value = 0.95
💡 Key Insight: Fuzzy logic captures gradual, real-world uncertainty better than binary logic.
Real Logic combines:
1. First-Order Language It uses FOL constructs:
∀x P(x) → "For all x, P(x) is true"
∃x P(x) → "There exists x where P(x) is true"
P(x) ∧ Q(x) → "P(x) AND Q(x)"
P(x) → Q(x) → "If P(x) then Q(x)"
2. Fuzzy Predicates Instead of TRUE/FALSE, predicates return values in [0,1]:
Healthy(broccoli) = 0.95
Healthy(candy) = 0.15
3. Real Domains Variables map to actual real-world objects (numbers, food items, chemicals, etc.)
LTN is the computational framework that implements Real Logic using neural networks.
Real World Data
↓
[Tensor Representations] ← objects become vectors/tensors
↓
[Neural Network Predicates] ← learn fuzzy truth values
↓
[Real Logic Formulas] ← combine predicates with FOL
↓
[Truth Value in [0,1]] ← output
| Capability | What it means | Example |
|---|---|---|
| Querying | Ask questions about data | "Which foods are high in vitamin C?" |
| Learning | Train predicates from data | Learn what "healthy" means |
| Reasoning | Derive new knowledge | If food has nutrients A and B → it's balanced |
End-to-End Differentiable =
Every component can be optimized through backpropagation
Real Logic (before this paper) could handle:
But it could NOT handle:
⚠️ Gap: Real Logic lacked aggregate functions — operations that summarize collections of data.
Aggregate functions summarize a set of values into a single value.
| Function | Symbol | What it does | Example |
|---|---|---|---|
| Average | AVG | Mean of values | AVG(vitamin_C) = 45mg |
| Sum | SUM | Total of values | SUM(calories) = 2000 |
| Count | COUNT | Number of items | COUNT(fruits) = 15 |
| Maximum | MAX | Highest value | MAX(sugar) = 95g |
| Minimum | MIN | Lowest value | MIN(fat) = 0.1g |
SELECT AVG(vitamin_c), MAX(calories)
FROM foods
WHERE category = 'fruit'
💡 Key Insight: This paper brings SQL-like aggregation into Real Logic.
The paper's main contribution is formally defining how aggregate functions fit into Real Logic.
Real Logic formulas produce truth values in [0,1]. Aggregate functions produce numerical summaries. How do you combine them?
Step 1: Define aggregate functions over relation tables
AVG_x [NutrientAmount(food, x)]
Step 2: Use results as arguments in fuzzy predicates
HighVitaminC(AVG_x [VitaminC(food, x)])
Step 3: Combine with FOL formulas
∀food: HighVitaminC(AVG_x[VitaminC(food,x)]) → Healthy(food)
Real Logic is end-to-end differentiable
+
Aggregate functions are differentiable operations
↓
Aggregates slot naturally into the framework!
Example — Averaging is differentiable:
AVG(x₁, x₂, x₃) = (x₁ + x₂ + x₃) / 3
Gradient with respect to x₁ = 1/3 ✅ (can backpropagate!)
The paper demonstrates this on FooDB, a food chemistry database.
Food Table:
| food_id | name | category |
|---------|---------|----------|
| 001 | Apple | Fruit |
| 002 | Spinach | Vegetable|
Nutrient Table:
| food_id | nutrient | amount_mg |
|---------|-------------|-----------|
| 001 | Vitamin_C | 8.4 |
| 001 | Iron | 0.12 |
| 002 | Vitamin_C | 28.1 |
| 002 | Iron | 2.71 |
Query 1: "Find foods with above-average Vitamin C"
∃food: VitaminC(food) > AVG_f[VitaminC(f)]
Query 2: "Is this food nutritionally balanced?"
Balanced(food) ←
HighProtein(AVG[protein(food)]) ∧
AdequateVitamins(AVG[vitamins(food)]) ∧
LowSugar(MAX[sugar(food)])
Query 3: "Rank foods by nutrient density"
NutrientDense(food) =
SUM[beneficial_nutrients(food)] / Calories(food)
This extended Real Logic combines three powerful paradigms:
┌─────────────────────────────────────────────────────┐
│ Extended Real Logic Framework │
├─────────────────┬──────────────┬────────────────────┤
│ Fuzzy │ FOL │ SQL-like │
│ Predicates │ Formulas │ Aggregates │
├─────────────────┼──────────────┼────────────────────┤
│ Descriptive │ Complex │ Summarize │
│ statistics │ logical │ insights from │
│ with degrees │ queries & │ data tables │
│ of truth │ reasoning │ │
├─────────────────┼──────────────┼────────────────────┤
│ "Broccoli is │ "If food │ "Average iron │
│ 0.95 healthy" │ has iron AND │ content = 2.3mg" │
│ │ Vit C → │ │
│ │ better │ │
│ │ absorption" │ │
└─────────────────┴──────────────┴────────────────────┘
BEFORE this paper:
Real Logic → Good at individual facts + logical reasoning
→ Could NOT aggregate over tables
AFTER this paper:
Extended Real Logic → Individual facts ✅
→ Logical reasoning ✅
→ Aggregate functions ✅
→ Database queries ✅
→ Still fully differentiable ✅
| Application | How Extended Real Logic Helps |
|---|---|
| Healthcare | "Average patient with condition X has nutrient Y deficiency" |
| Recommendation | "Foods with highest average nutrient scores" |
| Research | "Statistical patterns + logical rules combined" |
| Databases | Natural language queries over relational data |
Test your understanding:
What range do truth values take in Real Logic?
Answer: [0, 1]
What are the three capabilities of LTN?
Answer: Querying, Learning, Reasoning
Why couldn't original Real Logic handle "average vitamin C content"?
Answer: It lacked aggregate functions to summarize collections
Why do aggregate functions fit naturally into Real Logic?
Answer: They are differentiable, preserving the end-to-end differentiable property
Name the three paradigms combined in the extended framework:
Answer: Fuzzy predicates, FOL formulas, SQL-like aggregates
🎯 Core Takeaway: This paper extends Real Logic by adding aggregate functions (like AVG, SUM, COUNT), enabling it to handle database-style summarization while maintaining its fuzzy reasoning and logical expressiveness — all within a fully differentiable framework suitable for machine learning.