Overview
Theinterpret_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:
satorunsat - Subsequent lines: Counter-model (if SAT)
string
required
Path to JSON file containing the sentence analysis data.Required fields:
Claim- The extracted claimImplication- The extracted implicationReferring expressions- Entity mappingsProperties- Property assignmentsFormula- The FOL formula
Example Usage
Input File Formats
SMT Output File Format
Valid Argument (UNSAT):JSON Sentence Data Format
Output Examples
Valid Statement
Logical Fallacy with Interpretation
SMTResults Class
The interpretation logic is implemented in theSMTResults 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 (inprompts/prompt_counter_example.txt) typically includes:
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 interpretedUnderstanding 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
Thellm.py helper module typically supports:
- Set API keys in environment variables
- Adjust model selection for cost/quality tradeoff
- Modify temperature for interpretation creativity
Visualization
Extend the script to generate visual representations:Next Steps
After interpreting individual results:- Aggregate results across the dataset
- Calculate evaluation metrics (accuracy, precision, recall, F1)
- Analyze patterns in fallacy types
- Refine FOL translation based on error analysis
