The difference between pattern matching and automated reasoning isn't just technical. It's the difference between hoping your LLM behaves and proving it did.
Most teams verify LLM outputs with regex patterns, keyword filters, or secondary LLM "judge" models. This works for simple cases but breaks down quickly:
# Check if loan recommendation mentions required fields
patterns = [
r"credit score[:\s]+(\d{3})",
r"loan amount[:\s]+\$?([\d,]+)",
r"DTI[:\s]+(\d+)%"
]
# Problems:
# - Breaks when LLM says "FICO of 720" instead of "credit score: 720"
# - Can't verify "if score < 650 then amount must be < 50k"
# - No proof that all rules were checked
# - Maintenance nightmare as patterns multiply
The fundamental limitation: pattern matching finds text, but compliance requires verifying relationships between values.
aare.ai uses Z3, a satisfiability modulo theories (SMT) solver, to mathematically verify that extracted values satisfy your constraints. Instead of checking if text matches patterns, we prove whether constraints hold.
# Define your rules as logical constraints
constraints = {
"loan_amount": {"<=": 100000},
"credit_score": {">=": 600},
"debt_to_income": {"<=": 0.43},
"conditional": "credit_score < 650 -> loan_amount <= 50000"
}
# Z3 explores the entire solution space
# - If constraints are satisfiable: COMPLIANT (with proof)
# - If unsatisfiable: VIOLATION (with counterexample)
Important: Extractors still use pattern matching to parse LLM output into structured variables. The guarantee is: if extraction is correct, verification is mathematically complete. This separation of concerns means you can improve extractors independently while the logical verification remains sound.
Consider 10 business rules. With pattern matching, you check each independently. With automated reasoning, Z3 evaluates all 210 = 1,024 possible states automatically.
This is how Z3 catches rule interactions that humans miss: violations that only occur when specific combinations of conditions align.
| Capability | Pattern Matching | Automated Reasoning |
|---|---|---|
| Find "credit score: 720" | Yes | Yes (via extractors) |
| Verify score >= 600 | Fragile | Proven |
| Verify "if score < 650 then amount < 50k" | No | Yes |
| Handle rule interactions | No | Complete |
| Explain violations | Pattern name only | Counterexample with values |
| Audit trail | "Pattern matched" | Machine-verifiable proof |
| Maintenance at scale | Exponential | Linear |
"Pattern matched" or "Pattern not found"
No explanation of why
No proof of correctness
Verification ID: a8f3b2c
Status: VIOLATION
Constraint: LOAN_AMOUNT_LIMIT
Formula: loan_amount <= 100000
Extracted: loan_amount = 150000
Result: 150000 > 100000 (UNSAT)
Counterexample:
{loan_amount: 150000, credit_score: 720, dti: 0.35}
Violated at: "We recommend a loan of $150,000..."
Pattern matching is appropriate for:
Automated reasoning is required for:
Try the live demos to see formal verification working on mortgage compliance and HIPAA rules.
Try Mortgage Demo Try HIPAA Demo