Skip to main content

Overview

The interpret_smt_results.py script analyzes SMT solver outputs and generates human-readable explanations for logical fallacies. It provides counter-examples when arguments are invalid.

How It Works

1

Read SMT Output

Loads the solver output file containing SAT/UNSAT result and counter-model.
2

Parse Result

Determines if the formula is valid (UNSAT) or contains a fallacy (SAT).
3

Load Sentence Data

Reads the JSON file with claim, implication, entities, properties, and formula.
4

Generate Interpretation

Uses LLM to interpret the counter-model in natural language (for fallacies only).
5

Display Results

Prints the validity status and human-readable explanation.

Command Usage

Basic Command

Parameters

string
required
Path to the SMT solver output file (e.g., results/run_name_smt/0_out.txt).This file should contain:
  • First line: sat or unsat
  • Subsequent lines: Counter-model (if SAT)
string
required
Path to JSON file containing the sentence analysis data.Required fields:
  • Claim - The extracted claim
  • Implication - The extracted implication
  • Referring expressions - Entity mappings
  • Properties - Property assignments
  • Formula - The FOL formula

Example Usage

Input File Formats

SMT Output File Format

Valid Argument (UNSAT):
Logical Fallacy (SAT) with Counter-Model:

JSON Sentence Data Format

Output Examples

Valid Statement

Logical Fallacy with Interpretation

SMTResults Class

The interpretation logic is implemented in the SMTResults class:

LLM-Based Interpretation

For logical fallacies, the system uses an LLM to generate natural language explanations:
1

Load Prompt Template

Reads prompt_counter_example.txt containing instructions for interpretation.
2

Format Prompt

Inserts claim, implication, entities, properties, formula, and counter-model.
3

Query LLM

Sends the prompt to the LLM (via llm.py helper).
4

Return Explanation

Returns human-readable explanation of why the argument fails.

Prompt Template

The interpretation prompt (in prompts/prompt_counter_example.txt) typically includes:
Customize the prompt template to adjust the style and detail level of interpretations.

Usage Methods

Programmatic Usage

Disable Interpretation

To check validity without generating explanations:
Disabling interpretation speeds up batch processing but provides less insight into why arguments fail.

Counter-Model Analysis

The counter-model from the SMT solver shows: Function Definitions: How predicates are interpreted
Entity Assignments: Which entities satisfy which properties
Relationship Violations: Where the implication breaks down

Understanding Fallacy Types

Common fallacy patterns revealed by counter-examples:

Hasty Generalization

Argument: “Some wealthy people are happy, therefore all wealthy people are happy.” Counter-model: Shows a wealthy person who is not happy.

False Cause

Argument: “A happened before B, therefore A caused B.” Counter-model: Shows A and B occurring without causal relationship.

Composition Fallacy

Argument: “Each part has property P, therefore the whole has property P.” Counter-model: Shows parts with P but whole without P.

Batch Processing

For processing multiple results:

Error Handling

Missing Files

Malformed Output

Invalid JSON

LLM Configuration

The llm.py helper module typically supports:
Configure your LLM provider:
  • Set API keys in environment variables
  • Adjust model selection for cost/quality tradeoff
  • Modify temperature for interpretation creativity
LLM interpretations require API access (OpenAI) or local model setup. Ensure proper authentication and rate limiting.

Visualization

Extend the script to generate visual representations:

Next Steps

After interpreting individual results:
  1. Aggregate results across the dataset
  2. Calculate evaluation metrics (accuracy, precision, recall, F1)
  3. Analyze patterns in fallacy types
  4. Refine FOL translation based on error analysis
See Evaluation Metrics for performance analysis.