Lawfare Group → Knowledge Institute → Lawfare Academy
Reproduce the worked examples
Copy the complete code below into a UTF-8 file named verify.py and run python verify.py with Python 3. It uses only the standard library and performs exact or rational synthetic calculations. It does not access a network or learner records. Assertions fail if the expected synthetic results change.
These checks verify the stated arithmetic and query behavior, not independent academic acceptance or production migration safety.
from fractions import Fraction as F
import json
checks=[]
def ck(name,actual,expected):
assert actual==expected,(name,actual,expected)
checks.append(dict(case=name,actual=str(actual),expected=str(expected)))
ck('Nominal output growth',F(560,500)-1,F(3,25))
ck('One-index real output growth',F(112,108)-1,F(1,27))
ck('Real per-person growth',F(112,108)/F(102,100)-1,F(23,1377))
ck('Firm quantity under constant mix',F(105,108)-1,F(-1,36))
ck('Original unemployment rate',F(60,660),F(1,11))
ck('Later unemployment rate',F(40,650),F(4,65))
ck('Original participation',F(660,1000),F(33,50))
ck('Later participation',F(650,1000),F(13,20))
ck('Real income change',F(104,106)-1,F(-1,53))
ck('Disinflation still raises level',100*F(108,100)*F(103,100),F('111.24'))
ck('Baseline operating profit',800*(150-90)-35000,13000)
ck('Downside units',800*F(4,5),F(640))
ck('Downside unit cost',90*F(11,10),F(99))
ck('Downside original operating profit',640*(150-99)-35000,-2360)
ck('Later fixed saving under original downside',640*(150-99)-30000,2640)
ck('Stronger unit-cost shock',90*F(115,100),F('103.5'))
ck('Stronger combined adverse operating result',640*(150-F('103.5'))-35000,F(-5240))
ck('Later fixed saving remains insufficient under stronger shock',640*(150-F('103.5'))-30000,F(-240))
ck('Retained nine-month floating interest increment',180000*F(1,100)*F(9,12),F(1350))
ck('Retained reset timing three-month increment',180000*F(1,100)*F(3,12),F(450))
ck('Expected bid contribution at thirty percent',F(3,10)*50000,F(15000))
ck('Expected bid net at thirty percent',F(3,10)*50000-8000,F(7000))
ck('Expected bid net at ten percent',F(1,10)*50000-8000,F(-3000))
ck('Narrow bid break-even probability',F(8000,50000),F(4,25))
ck('Low-rate gross euro payable',60000*F(105,100),F(63000))
ck('Low-rate euro receipt',20000*F(105,100),F(21000))
ck('Low-rate net outflow',40000*F(105,100),F(42000))
ck('High-rate gross payable',60000*F(115,100),F(69000))
ck('High-rate receipt',20000*F(115,100),F(23000))
ck('High-rate net outflow',40000*F(115,100),F(46000))
ck('Net currency sensitivity',40000*F(10,100),F(4000))
ck('Cumulative baseline payable',100000*F(110,100),F(110000))
ck('Cumulative adverse payable',100000*F(120,100),F(120000))
ck('Cumulative additional currency settlement',100000*F(10,100),F(10000))
ck('Full-year interest increment',200000*F(1,100),F(2000))
ck('Quarter-year immediate reset increment',200000*F(1,100)*F(3,12),F(500))
ck('Immediate-reset common-horizon added cash',10000+200000*F(1,100)*F(3,12),F(10500))
ck('Delayed-reset one-month increment',200000*F(1,100)*F(1,12),F(500,3))
ck('Delayed-reset common-horizon added cash',10000+200000*F(1,100)*F(1,12),F(30500,3))
ck('Retained cumulative one-index real growth',F(106,104)-1,F(1,52))
print(json.dumps(dict(passed=True,scope='Synthetic macro mechanisms only; not current observations, firm forecasts, legal entitlement or learner proficiency',checks=checks)))