This guide explains how to install and use Claude Code to work with this codebase.
Claude Code is Anthropic's official command-line interface that allows you to interact with Claude AI directly in your terminal. It's particularly useful for:
- Asking questions about the codebase
- Making code changes with AI assistance
- Running analyses and generating documentation
- Understanding complex algorithms and mathematical proofs
# Using Homebrew (recommended)
brew install anthropics/claude/claude-code
# Or using curl
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | shOption 1: Using winget (Windows 11)
winget install Anthropic.ClaudeCodeOption 2: Using PowerShell
# Run in PowerShell (as Administrator)
irm https://raw.githubusercontent.com/anthropics/claude-code/main/install.ps1 | iexOption 3: Using WSL (Windows Subsystem for Linux)
# Follow the Linux installation instructions below
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | shDebian/Ubuntu:
# Download and install
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | sh
# Or using apt (if available)
sudo apt update
sudo apt install claude-codeArch Linux:
# Using yay (AUR helper)
yay -S claude-code
# Or using paru
paru -S claude-code
# Or manual installation
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | shFedora/RHEL:
# Using dnf
sudo dnf install claude-code
# Or using the install script
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | shAfter installation, verify Claude Code is installed correctly:
claude --versionYou should see the version number displayed.
Before using Claude Code, you need to authenticate:
# Start the authentication process
claude auth login
# Follow the prompts to:
# 1. Open the provided URL in your browser
# 2. Log in with your Anthropic account
# 3. Authorize Claude Code
# 4. Return to the terminalOnce authenticated, you're ready to use Claude Code!
If you haven't cloned this repository yet, Claude Code can help you follow the installation instructions. Once you have Claude Code installed and authenticated, start it in the directory that you want to clone this repository into (this will be the directory you will then work out of):
claudeThen ask Claude Code to follow the installation instructions:
Please follow the installation instructions at
https://github.com/benbrastmckie/Connectives/blob/master/docs/INSTALLATION.md
to clone the repository into this directory and install all dependencies.
Claude Code will:
- Fetch and read the installation instructions from the URL
- Clone the repository to your current directory
- Install Z3 and all required Python packages
- Verify the installation works correctly
Prerequisites: Make sure you have Python 3 and git installed before running the installation.
1. Navigate to the repository:
# Change to the nice_connectives directory
cd ~/Documents/Philosophy/Projects/Z3/nice_connectives
# Or use your full path
cd /home/benjamin/Documents/Philosophy/Projects/Z3/nice_connectives2. Start Claude Code:
# Start an interactive session
claude3. Ask questions or request changes:
Once Claude Code starts, you'll see a prompt where you can interact with Claude. The AI has full context of your codebase.
cd ~/Documents/Philosophy/Projects/Z3/nice_connectives
claudeThen in Claude Code:
How does the Z3-based independence checking work in this codebase?
Claude will analyze the relevant files and explain the implementation.
What is the truth table for connective f3_150? Can you show me
how it's used in the nice set examples?
Claude will look up the connective in the glossary and show you where it appears.
This example shows the complete workflow for developing a feature using Claude Code, following the Contributing Guide.
I want to add a feature that displays truth tables in a more readable
format. Can you help me follow the contribution workflow from
docs/CONTRIBUTING.md to:
1. Create a feature branch
2. Implement the feature
3. Add tests
4. Update documentation
Claude will guide you through each step:
Step 1: Create Feature Branch
Let me help you create a feature branch following the project's
contribution guidelines.
First, let's make sure your master branch is up to date:
Claude will run:
git checkout master
git pull upstream masterThen create your feature branch:
git checkout -b feature/readable-truth-tablesStep 2: Implement the Feature
Now I'll add a function to src/connectives.py that formats truth
tables in a readable way.
Claude will:
- Read the existing code in src/connectives.py
- Write a new
format_truth_table()function - Show you the implementation
- Explain the design decisions
def format_truth_table(connective, arity):
"""
Format a connective's truth table in human-readable form.
Args:
connective: BitVec representation of truth table
arity: Number of inputs (0, 1, 2, or 3)
Returns:
str: Formatted truth table with headers and rows
"""
# Implementation here...Step 3: Add Tests
Following the testing guidelines in docs/CONTRIBUTING.md, I'll add
tests to tests/test_connectives.py
Claude will create test cases like:
def test_format_truth_table_binary():
"""Test formatting for binary connectives."""
# Test AND connective
formatted = format_truth_table(AND, 2)
assert "A B | Output" in formatted
assert "T T | T" in formatted
# ... more assertionsStep 4: Run Tests
Let me run the test suite to make sure everything passes:
Claude will execute:
pytest tests/ -vAnd show you the results (should be 175+ passing tests).
Step 5: Update Documentation
According to docs/CONTRIBUTING.md, we should update relevant
documentation. I'll add this feature to:
- src/README.md (API documentation)
- Docstrings in the code
Step 6: Commit Changes
Following the commit guidelines in docs/CONTRIBUTING.md#commit-guidelines,
I'll create a clear commit message:
Claude will help you commit:
git add src/connectives.py tests/test_connectives.py src/README.md
git commit -m "feat: add readable truth table formatting
Implements format_truth_table() function that displays truth tables
with proper headers and formatting. Includes comprehensive tests and
documentation updates."Your feature is now ready for a pull request! See Example 4 for the next steps.
After developing your feature (as shown in Example 3), Claude Code can guide you through submitting a pull request following the Contributing Guide.
My feature is complete with passing tests. Can you help me submit
a pull request following the guidelines in docs/CONTRIBUTING.md?
Claude will guide you through the PR process:
Step 1: Push Your Branch
First, let's push your feature branch to your fork on GitHub:
Claude will run:
git push origin feature/readable-truth-tablesIf this is your first push of this branch, Claude will use:
git push -u origin feature/readable-truth-tablesStep 2: Create the Pull Request
Now I'll help you create a pull request. According to
docs/CONTRIBUTING.md#submitting-a-pull-request, you need to:
1. Go to your fork on GitHub
2. You'll see a yellow banner with "Compare & pull request"
3. Click that button
Alternatively, you can use the GitHub CLI if you have it installed.
Would you like me to create the PR using the gh command?
If you have gh CLI installed, Claude can run:
gh pr create --title "Add readable truth table formatting" --body "$(cat <<'EOF'
## Summary
Adds a new `format_truth_table()` function that displays connective
truth tables in a human-readable format with proper headers and
formatting.
## Changes
- Added `format_truth_table()` function to src/connectives.py
- Added comprehensive test coverage in tests/test_connectives.py
- Updated API documentation in src/README.md
## Testing
- All 177 tests pass (175 existing + 2 new)
- Tested with binary, ternary, and edge cases
- Run: `pytest tests/test_connectives.py::test_format_truth_table* -v`
## Documentation
- Updated src/README.md with new function documentation
- Added docstrings following project standards
- Included usage examples
## Checklist
- [x] All tests pass
- [x] Code follows project style (CLAUDE.md)
- [x] Documentation updated
- [x] Commit messages are clear
Follows guidelines from docs/CONTRIBUTING.md
EOF
)"Step 3: Address Review Feedback
Once your PR is submitted, reviewers may provide feedback. Claude Code can help:
I received review feedback on my PR. The reviewer suggests
simplifying the formatting logic. Can you help me address this?
Claude will:
- Read the PR comments and understand the feedback
- Make the requested changes
- Run tests to ensure they still pass
- Help you commit and push the updates
# Claude makes the changes, then:
git add src/connectives.py
git commit -m "refactor: simplify truth table formatting logic per review feedback"
git push origin feature/readable-truth-tablesThe PR will automatically update with your new commits.
Step 4: After PR is Merged
Once your PR is merged, Claude can help clean up:
My PR was merged! Can you help me clean up my local repository
following the post-merge steps in docs/CONTRIBUTING.md?
Claude will run:
# Switch back to master
git checkout master
# Pull the merged changes
git pull upstream master
# Delete your feature branch locally
git branch -d feature/readable-truth-tables
# Delete the feature branch from your fork
git push origin --delete feature/readable-truth-tables
# Update your fork's master
git push origin masterGreat! Your contribution is now part of the project. Ready to start
your next feature?
Learn More:
- Complete workflow: docs/CONTRIBUTING.md
- GitHub setup: docs/GITHUB.md
- Commit guidelines: docs/CONTRIBUTING.md#commit-guidelines
- PR process: docs/CONTRIBUTING.md#submitting-a-pull-request
I want to search for a size-36 nice set. Can you help me set up
the command with appropriate parameters based on the size-35
search?
Claude will suggest the command with optimized parameters.
Can you explain the pattern in search times for sizes 31-35?
Why did size-32 search faster than size-31?
Claude will analyze the data in the example files and provide insights.
The RESULTS.md file says the maximum is size 30, but we've now
found size 35. Can you update all the documentation to reflect
this?
Claude will:
- Find all references to the old maximum
- Update them consistently
- Show you what changed
Claude Code supports custom slash commands defined in .claude/commands/:
# List available commands
/help
# Use project-specific commands (if defined)
/test # Run tests
/search # Start a search
/validate # Validate a nice setClaude can work with multiple files at once:
Can you compare the structure of z3_nice_set_30.md and
z3_nice_set_35.md? What are the key differences in the
ternary functions used?
Create a script that generates a visualization of the truth
table distribution for all ternary connectives in the size-35
nice set
The independence checking code in src/independence.py is getting
long. Can you refactor it to separate pattern enumeration from
Z3 constraint generation?
Less effective:
How does this work?
More effective:
How does the pattern enumeration algorithm in src/independence.py
handle depth-3 compositions of ternary functions?
In examples/z3_nice_set_35.md, can you explain why f3_2 and f3_247
appear together in the nice set?
Before I run a size-36 search, can you explain what the
--max-candidates parameter does and what value I should use
based on the size-35 results?
I added a new pattern to the independence checker. Can you
review it for correctness and test it against the known
nice sets?
Claude Code maintains conversation history, so you can build on previous questions:
You: What is the largest nice set found?
Claude: The largest is size 35, found in z3_nice_set_35.md...
You: Can you show me the ternary functions in that set?
Claude: Here are the 33 ternary functions from the size-35 set...
You: Which of these have truth table values over 200?
Claude: The ternary functions with values over 200 are...
Explain what makes a connective set "nice" using examples from
the size-17 set in examples/z3_nice_set_17.md
Show me the truth tables for f3_19, f3_23, and f3_26 from the
glossary and explain what they have in common
Based on the search evolution data in z3_nice_set_35.md, what
parameters should I use to search for size-36?
Walk me through how Post's completeness theorem is implemented
in src/post_classes.py
I want to reproduce the size-33 result. What exact command
should I run and how long will it take?
Generate a summary of all the size records from 17 to 35 in
a table format showing size, search time, and percentage
of ternary functions
The project includes a comprehensive ternary connectives glossary at glossary/connectives.md:
Look up f3_150 in the glossary and show me its truth table
Which connectives in the glossary represent three-way XOR, OR,
and AND?
Are there any special patterns in the truth tables of the
connectives used in the size-35 nice set?
# Check if Claude Code is in your PATH
which claude
# Try reinstalling
curl -fsSL https://raw.githubusercontent.com/anthropics/claude-code/main/install.sh | sh
# Check authentication
claude auth status# Log out and log back in
claude auth logout
claude auth login# Clear cache
claude cache clear
# Check for updates
claude updateIf Claude Code has trouble running Python commands:
# Ensure Python is in PATH
which python3
# Activate virtual environment if needed
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows
# Then start Claude Code
claude- Jupyter Notebooks - Interactive tutorials and examples
- Notebooks Overview - Notebook learning paths
- Claude Code Documentation: https://docs.claude.com/claude-code
- Project README: ../README.md
- Research Results: RESULTS.md
- Examples Directory: ../examples/README.md
- Ternary Connectives Glossary: ../glossary/connectives.md
Can you help me understand how to use Claude Code more
effectively with this codebase?
Q: Can Claude Code run the search commands?
A: Yes! Claude can execute commands like python -m src.cli prove z3 --target-size 35
Q: Will Claude modify files without asking? A: No. Claude will show you proposed changes and ask for confirmation before modifying files.
Q: Can Claude Code work offline? A: No, Claude Code requires an internet connection to communicate with Claude AI.
Q: How much does it cost? A: Pricing depends on your Anthropic account plan. Check https://anthropic.com/pricing for details.
Here's a complete example session:
# Navigate to the repository
cd ~/Documents/Philosophy/Projects/Z3/nice_connectives
# Start Claude Code
claude
# Example conversation:You:
Hi! I'm new to this codebase. Can you give me an overview of what
this project does?
Claude:
This is the Nice Connectives project, which searches for the maximum
size of "nice" connective sets in classical logic...
[detailed explanation]
You:
What's the current record for the largest nice set?
Claude:
The current record is size 35, discovered on 2025-10-07. You can see
the details in examples/z3_nice_set_35.md...
You:
Can you show me one of the ternary connectives from that set with
its complete truth table?
Claude:
Sure! Let me show you f3_19 from that set:
[truth table displayed]
This connective is interesting because...
You:
Great! Now I want to run a search for size 36. What command should
I use?
Claude:
Based on the size-35 search, I recommend:
python -m src.cli prove z3 --target-size 36 --max-depth 3 --max-candidates 100000
Here's why: [explanation]
Would you like me to run this command?
Happy coding with Claude Code!