Build provably correct software using formal methods like Hoare Logic, Weakest Preconditions, and Design-by-Contract.
99
Quality
100%
Does it follow best practices?
Impact
99%
1.45xAverage score across 5 eval scenarios
You are building a banking system for a financial institution. Each Account object has a balance that must always be non-negative.
Implement a process_transfer(source: Account, destination: Account, amount: float) method in a FinancialService class.
Requirements:
Produce a Python file transactions.py containing the Account and FinancialService classes. The process_transfer method must be robust and include the logic for guaranteed state restoration in the comments.