← Back to Installation | Basic Installation → | Technical Docs →
This guide walks you through the basics of using ModelChecker to explore logical theories and test formulas.
- Before You Begin: Using the Terminal
- Before You Begin: Setting Up Your Editor
- Creating Your First Project
- Understanding the Project Structure
- Running Examples
- Modifying Examples
- Exploring Different Theories
- Next Steps
NOTE: Skip this section if you're already comfortable using the terminal/command line.
ModelChecker is a command-line tool, which means you interact with it by typing commands in a terminal (also called a command prompt, shell, or console). If you've never used a terminal before, this section will get you started.
The terminal is a text-based interface for controlling your computer. Instead of clicking icons and menus, you type commands to:
- Navigate between folders (directories)
- Run programs like ModelChecker
- Create and edit files
- Install software
While it might seem unfamiliar at first, the terminal is a powerful tool that becomes second nature with practice.
macOS:
- Press
Cmd + Spaceto open Spotlight - Type "Terminal" and press Enter
- Or: Navigate to Applications → Utilities → Terminal
Windows:
- PowerShell (recommended): Press
Windows + X, then select "PowerShell" - Command Prompt: Press
Windows + R, typecmd, press Enter - Windows Terminal (modern): Search for "Terminal" in the Start menu
Linux:
- Press
Ctrl + Alt + T(works on most distributions) - Or search for "Terminal" in your application menu
Here are the essential commands you'll need:
Navigating Directories:
pwd # Print working directory - shows where you are
ls # List files in current directory (dir on Windows)
cd folder_name # Change directory - move into a folder
cd .. # Go up one directory level
cd ~ # Go to your home directoryCommon Usage:
# See where you are
pwd
# List what's here
ls
# Move into Documents folder
cd Documents
# Move up one level
cd ..
# Go home
cd ~Creating Directories:
mkdir my_folder # Create a new folder
mkdir -p path/to/dir # Create nested foldersTips for Beginners:
- Tab completion: Start typing a folder name and press Tab - the terminal will complete it
- Command history: Use Up/Down arrow keys to cycle through previous commands
- Copy/Paste: Usually
Ctrl+Shift+C/Ctrl+Shift+Vin Linux/Windows terminals,Cmd+C/Cmd+Von macOS - Clear screen: Type
clear(orclson Windows) to clean up your terminal - Get help: Most commands support
--helpflag, e.g.,model-checker --help
A path tells your computer where to find a file or folder:
Absolute path - Full address from the root:
/home/benjamin/Documents/Projects/my_project # Linux/macOS
C:\Users\Benjamin\Documents\Projects\my_project # WindowsRelative path - Location relative to where you are now:
Projects/my_project # Folder inside current directory
../my_project # Folder in parent directory
./examples.py # File in current directoryHome directory shortcut:
~/Documents # Your home directory + DocumentsOnce installed, you'll use commands like:
# Check Python version
python --version
# Run ModelChecker
model-checker examples.py
# Create a new project
model-checker impositionThe terminal will show output from these commands, including any errors or results.
"Command not found": The program isn't installed or not in your PATH
- Solution: Install the program or check installation instructions
"Permission denied": You don't have rights to access that file/folder
- Solution: Check file permissions or use appropriate installation method
"No such file or directory": The path you specified doesn't exist
- Solution: Check spelling, use
lsto see what's available, verify you're in the right directory
For more help with terminal usage, these resources are excellent:
Skip this section if you already have an editor set up.
Working with ModelChecker involves editing Python files containing logical formulas. A properly configured text editor makes this much easier by providing:
- Syntax highlighting for Python code
- Unicode support for logical symbols (∧, ∨, ¬, □, ◇)
- LaTeX preview for mathematical notation
- Auto-completion for common patterns
- Keybindings for running examples
Setting up a good text editor provides an essential foundation for using the model-checker. In addition to editing Python files, modern editors provide a vastly improved experience for writing in LaTeX and Markdown, consolidating all of your text editing into a single platform which you can configure to suite your exact needs. Especially for academics, no tool is more important than your editor.
It is well worth watching demo videos on YouTube and chatting with an LLM before choosing your editor if you have not already.
- Repository: VSCodium Setup Guide
- Open-source version of VS Code with helpful extensions pre-configured
- User-friendly interface with point-and-click functionality
- Great for those new to programming
- Repository: NeoVim Configuration
- Powerful text editor with extensive customization
- Keyboard-driven workflow for efficiency
- Ideal for experienced developers
If you haven't already, install ModelChecker:
pip install model-checkerEasier Option: Use Claude Code to automate the installation process. Claude Code can handle the entire setup, verify everything works, and help you create your first project with AI assistance.
To create a project using a given theory as a template, run:
model-checker -l <theory_name>You'll be prompted to:
- Choose whether to create a new project (type
y) - Enter a project name (use snake_case, e.g.,
some_name)
Available theories:
logos- Hyperintensional bilateral semantics (default)exclusion- Unilateral semantics with exclusionimposition- Fine's counterfactual semanticsbimodal- Temporal-modal logic
Selecting Logos Subtheories:
For the logos theory, you can specify which subtheories to include:
# Load specific subtheories (default loads all)
model-checker -l logos --subtheory modal # Modal logic only (+ dependencies)
model-checker -l logos --subtheory counterfactual constitutive # Multiple
model-checker -l logos -st extensional # Just extensional (short form)Example:
model-checker -l impositionYou can also load the logos theory by simply running:
model-checkerThis creates a new project with the Logos theory by default.
After creating a project, you'll have these files:
project_my_logic/
├── README.md # Theory-specific documentation
├── examples.py # Pre-configured examples to run
├── __init__.py # Makes the directory a Python package
├── semantic.py # Core semantic definitions
├── operators.py # Logical operators for the theory
├── docs/ # Additional documentation
└── notebooks/ # Interactive Jupyter notebooks (if available)
This is your main working file. It contains:
- Import statements - Load the theory components
- Example definitions - Logical formulas to test
- Settings - Control model generation
- Theory configuration - Specify which semantic theory to use
Examples files may be saved in an examples/ directory if you have many example files that you are working with for a given theory.
For ModelChecker to successfully run an examples.py file, it must contain these essential variables:
A dictionary mapping theory names to their implementations, where at least one must be provided:
semantic_theories = {
"logos": logos_theory, # Maps a name to the theory object
"imposition": imposition_theory, # NOTE: it is often convenient to comment out all but one theory
}A dictionary of examples that will be executed when you run the file. Each key is an example name, each value is a list containing [premises, conclusions, settings]:
# Define individual examples first
EXT_CM_1_premises = ["A", "(A \\rightarrow B)"]
EXT_CM_1_conclusions = ["\\Box B"]
EXT_CM_1_settings = {
'N': 4, # Max number of atomic propositions
'contingent': True, # All propositions must be contingent
'non_null': True, # Exclude the null state
'non_empty': True, # Require non-empty verifier/falsifier sets
'disjoint': False, # Allow verifier/falsifier overlap
'max_time': 10, # Timeout in seconds
'iterate': 1, # Number of models to find
'expectation': True, # True = expect countermodel, False = expect theorem
}
EXT_CM_1_example = [
EXT_CM_1_premises,
EXT_CM_1_conclusions,
EXT_CM_1_settings
]
EXT_TH_1_premises = ["A", "(A \\rightarrow B)"]
EXT_TH_1_conclusions = ["B"]
EXT_TH_1_settings = {
'N': 3, # Max number of atomic propositions
'contingent': False, # Allow non-contingent propositions
'non_null': False, # Allow the null state
'non_empty': False, # Allow empty verifier/falsifier sets
'disjoint': False, # Allow verifier/falsifier overlap
'max_time': 10, # Timeout in seconds
'iterate': 1, # Number of models to find
'expectation': False, # True = expect countermodel, False = expect theorem
}
EXT_TH_1_example = [
EXT_TH_1_premises,
EXT_TH_1_conclusions,
EXT_TH_1_settings
]
# This is what model-checker executes
example_range = {
# Countermodels
"EXT_CM_1": EXT_CM_1_example,
# ... potentially dozens more
# Theorems
"EXT_TH_1": EXT_TH_1_example,
# ... potentially dozens more
}For more detailed information, see the Examples Documentation.
A dictionary used by the testing framework (run_tests.py) to run comprehensive test suites. Often organized by grouping countermodels and theorems separately:
# Group examples by type
ext_cm_examples = {
"EXT_CM_1": EXT_CM_1_example, # ANTECEDENT STRENGTHENING
"EXT_CM_2": EXT_CM_2_example, # CONTRAPOSITION
"EXT_CM_3": EXT_CM_3_example, # TRANSITIVITY FAILURE
# ... more countermodels
}
ext_th_examples = {
"EXT_TH_1": EXT_TH_1_example, # MODUS PONENS
"EXT_TH_2": EXT_TH_2_example, # DISJUNCTIVE SYLLOGISM
"EXT_TH_3": EXT_TH_3_example, # HYPOTHETICAL SYLLOGISM
# ... more theorems
}
# Combine collections using dictionary unpacking
unit_tests = {**ext_cm_examples, **ext_th_examples}
# Used by: ./run_tests.py --examples logosFor more detailed information, see the Unit Tests Documentation.
Controls execution behavior and output formatting:
general_settings = {
"print_impossible": False, # Show impossible states
"print_constraints": False, # Display Z3 constraints
"print_z3": False, # Show Z3 model/unsat core
"save_output": False, # Save results to files
"maximize": False, # Find maximum N for each theory
"align_vertically": False, # Vertical time display (bimodal)
}If not provided, all default to False.
See the Tools and Settings as well as the Examples Standard for how to create and use example files.
Navigate to your project directory and run:
model-checker examples.pyThe output shows:
- Whether the formula is valid (a theorem) or invalid
- Countermodels when formulas are invalid
- Model details including propositions and their truth values
========================================
EXAMPLE EXT_TH_1: there is no countermodel.
Atomic States: 3
Semantic Theory: Brast-McKie
Premises:
1. A
2. (A \rightarrow B)
Conclusion:
3. B
Z3 Run Time: 0.0098 seconds
========================================
========================================
EXAMPLE CF_CM_1: there is a countermodel.
Atomic States: 4
Semantic Theory: Brast-McKie
Premises:
1. \neg A
2. (A \boxright C)
Conclusion:
3. ((A \wedge B) \boxright C)
Z3 Run Time: 0.0293 seconds
========================================
State Space:
#b0000 = □
#b0001 = a
#b0010 = b
#b0100 = c
#b0101 = a.c (world)
#b0110 = b.c (world)
...
The evaluation world is: b.c
INTERPRETED PREMISES:
1. |\neg A| = < {b.c}, {a, a.b.c.d} > (True in b.c)
|A| = < {a, a.b.c.d}, {b.c} > (False in b.c)
2. |(A \boxright C)| = < {a.c, b.c}, {a.d} > (True in b.c)
|A| = < {a, a.b.c.d}, {b.c} > (False in b.c)
|A|-alternatives to b.c = {a.c}
|C| = < {a.c}, {a.b.c.d, a.b.d, a.d, b} > (True in a.c)
INTERPRETED CONCLUSION:
3. |((A \wedge B) \boxright C)| = < ∅, {a.d, b.c} > (False in b.c)
|(A \wedge B)| = < {a.b, a.b.c, a.b.c.d, a.b.d, a.d}, {a.b.c, a.c, b.c} > (False in b.c)
|A| = < {a, a.b.c.d}, {b.c} > (False in b.c)
|B| = < {a.b, a.b.c, a.b.c.d, a.b.d, b, b.c.d, b.d, d}, {a.c} > (True in b.c)
|(A \wedge B)|-alternatives to b.c = {a.d}
|C| = < {a.c}, {a.b.c.d, a.b.d, a.d, b} > (False in a.d)
Total Run Time: 0.2815 seconds
========================================
For countermodels, the output includes:
- State Space: All possible states and their status (world, impossible, or base state)
- Evaluation World: The specific world where the premises are true but conclusion is false
- Interpreted Formulas: Shows verifier/falsifier sets and truth values at the evaluation world
Each theory has unique operators and capabilities:
- Full hyperintensional semantics
- Counterfactual operators:
\boxright,\diamondright - Constitutive operators:
\equiv,\sqsubseteq - See: Logos Documentation
- Unilateral negation semantics
- Exclusion operator:
\exclude - Solves the False Premise Problem
- See: Exclusion Documentation
- Fine's counterfactual semantics
- Specialized for counterfactual reasoning
- See: Imposition Documentation
- Combines temporal and modal operators
- Past/Future:
P,F - Necessity/Possibility:
\Box,\Diamond - See: Bimodal Documentation
In this directory (Docs/):
- Installation Guide - Platform-specific setup
- Claude Code Guide - AI-assisted development and installation
- Getting Started with GitHub - Version control basics and GitHub setup
- Development Guide - Contributing to ModelChecker
- Tools Guide - Advanced debugging and analysis
- Architecture - Research approach and validation
Theory Documentation:
Framework Documentation:
- Core Framework - Architecture and design
- API Reference - Framework API documentation
- Custom Theories: Create your own semantic theory
- Model Iteration: Find multiple models satisfying constraints
- Debugging: Use print flags (
-p,-z) to see Z3 constraints - Batch Testing: Run comprehensive test suites
- Check the Tools Guide for troubleshooting
- Review theory-specific documentation
- Examine the example files in each theory
- Create an issue on GitHub