Discovering Edge Cases with CodeLogician
One of the most powerful capabilities of CodeLogician is automatic edge-case discovery.
Traditional testing only explores a small number of scenarios. LLM reasoning explores a handful of likely paths.
CodeLogician instead systematically searches the full behavioral space and returns concrete counterexamples when assumptions fail.
Setup
If Claude Code doesn't already know about CodeLogician, start with:
Learn how to use codelogician by running
codelogician doc --help
Example: Fee Logic
You have a fee calculation in Python:
def calculate_fee(method: str, amount: float) -> float:
if method == "card":
return 0.029 * amount + 0.30
elif method == "bank_transfer":
return 0.008 * amount + 1.50
else:
return 0.0Ask Claude Code:
Use CodeLogician to verify that the fee is always less than the transaction amount for positive amounts.
What Happens
Claude Code will:
- Translate the Python function into an IML model
- Add a verification goal expressing the property
- Run
codelogician eval checkto submit it to ImandraX
Example Counterexample
CodeLogician discovers:
Counterexample found
method = "bank_transfer"
amount = 1.51
fee = 1.5108
This reveals a real boundary condition where the fixed fee dominates the transaction — a bank transfer of £1.51 costs almost as much in fees as the transfer itself.
Claude Code can then use this finding to suggest a minimum transaction amount or adjust the fee structure.
Why This Matters
Edge cases like this often appear only in production systems.
CodeLogician identifies them automatically by:
- exploring numeric boundaries
- enumerating behavioral regions
- testing logical invariants
No manual test cases needed — the reasoning engine derives them from the code itself.
Next Steps
Continue with: