tessl install tessl/pypi-crosshair-tool@0.0.0Analyze Python code for correctness using symbolic execution and SMT solving to automatically find counterexamples for functions with type annotations and contracts.
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.25x
Baseline
Agent success rate without this tile
69%
Build a simple bank account manager that validates account operations using contract-based verification. The system should enforce business rules through preconditions and postconditions to ensure valid account transactions.
Implement a BankAccount class that manages account balance and transactions with the following operations:
The implementation must use contract-based specifications to enforce these business rules. You should define:
You may use any contract specification approach, including:
Implement the following test cases:
@generates
class BankAccount:
"""
A bank account that enforces business rules through contract verification.
"""
def __init__(self, account_number: str, initial_balance: float) -> None:
"""
Initialize a bank account with an account number and initial balance.
Args:
account_number: Unique identifier for the account
initial_balance: Starting balance (must be non-negative)
"""
pass
def deposit(self, amount: float) -> float:
"""
Deposit money into the account.
Args:
amount: Amount to deposit (must be positive)
Returns:
New balance after deposit
"""
pass
def withdraw(self, amount: float) -> float:
"""
Withdraw money from the account.
Args:
amount: Amount to withdraw (must be positive and <= balance)
Returns:
New balance after withdrawal
"""
pass
def get_balance(self) -> float:
"""
Get the current account balance.
Returns:
Current balance
"""
pass
def transfer(self, amount: float, destination: 'BankAccount') -> None:
"""
Transfer money to another account.
Args:
amount: Amount to transfer (must be positive and <= balance)
destination: The destination account
"""
passProvides contract verification and symbolic execution capabilities for Python code.