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 synthetic operating, dated-cash and enterprise-valuation calculations, not independent academic acceptance or production migration safety.
"""Original integrated enterprise strategy verification. Standard library; no network or records."""
from fractions import Fraction as F
from math import isclose
import json
checks=[]
def eq(name,x,y):
assert isclose(float(x),float(y),rel_tol=1e-10,abs_tol=1e-5),(name,x,y)
checks.append(dict(case=name,value=float(x),expected=float(y)))
d=F(10,11);a2=d+d*d;a3=a2+d**3
eq('three-year discount factor',a3,2.4868519909842224)
improve=13*a3-30;niche=9*a3-15;acquire=30*a3+10*d**3-80
eq('improvement NPV',improve,2.329075882794891)
eq('niche NPV',niche,7.381667918858001)
eq('acquisition complete NPV',acquire,2.11870773854245)
assert 70-80<10 and 70+30-80>=10
eq('niche omitted support',6*a3-15,-.07888805409466566)
eq('original ownership advantage',7*a3-35,-17.592036063110442)
eq('contract advantage',5*a3-5,7.434259954921112)
eq('improved ownership advantage',15*a3-35,2.302779864763335)
eq('price-conceded ownership',15*a3-25,12.302779864763335)
eq('contract improved alongside ownership',8*a3-5,14.894815927873779)
eq('ownership price-conceded lead',15*a3-25-(5*a3-5),4.868519909842223)
qty=min(100,90);sales=qty*500;variable=qty*300;op=sales-variable-4000
eq('qualified annual jobs',qty,90);eq('delivered annual net cash',op,14000)
actual=-40000+op*a3+10000*d**3;unsupported=-40000+16000*a3+10000*d**3
eq('capacity-consistent NPV',actual,2329.075882794891)
eq('unsupported100-job NPV',unsupported,7302.779864763335)
eq('capacity overstatement',unsupported-actual,4973.703981968445)
eq('actual working-capital loss effect',10000*d**3,7513.148009015778)
eq('no recovery capacity NPV',actual-10000*d**3,-5184.072126220887)
eq('initial cash remaining',35000+10000-40000,5000)
eq('initial reserve gap',8000-5000,3000)
eq('verified deposit isolated remaining',35000+10000+5000-40000,10000)
eq('precedence-only launch weeks',2+2+max(3,3)+1,8)
eq('qualified-resource launch weeks',2+2+3+3+1,11)
eq('acceleration net value',3*3000-3000,6000)
eq('lower avoidable delay net',3*1000-3000,0)
eq('coherent persistent-state NPV',10*a3+10*d**3-40,-7.618332081141999)
high_late=18*a2-20;low_late=4*a2-20
eq('high year-one expansion value',high_late,11.239669421487603)
assert low_late<0
staged=-5+F(1,2)*high_late*d
eq('complete staged value',staged,.10894064613072878)
eq('higher staged fee',staged-6,-5.891059353869271)
assert niche>staged>10*a3+10*d**3-40
def expansion(initial,p=F(4,5),recovery=10):return (6+8*p)*a3+recovery*d**3-initial
base=expansion(30);corrected=expansion(33);concession=expansion(F(309,10))
eq('board initial expansion NPV',base,8.350112697220135)
eq('board integration-corrected NPV',corrected,5.350112697220135)
eq('board price-conceded NPV',concession,7.450112697220135)
eq('board original advantage',base-niche,.9684447783621337)
eq('board corrected disadvantage',niche-corrected,2.0315552216378663)
eq('board concession narrow advantage',concession-niche,.06844477836213374)
eq('board p.75 NPV',expansion(F(309,10),F(3,4)),6.455371900826446)
eq('board p.75 disadvantage',niche-expansion(F(309,10),F(3,4)),.9262960180315552)
eq('board no recovery',expansion(F(309,10),recovery=0),-.06303531179564237)
threshold=((niche+F(309,10)-10*d**3)/a3-6)/8
eq('board high-probability crossover',threshold,.796559667673716)
assert expansion(F(309,10),threshold)==niche
def choose(cash,reserve,initial,p=F(4,5),recovery=10):
options=[dict(name='no new project',uses=F(0),npv=F(0)),dict(name='niche',uses=F(15),npv=niche),dict(name='expansion',uses=initial,npv=expansion(initial,p,recovery))]
for x in options:x['remaining']=cash-x['uses'];x['feasible']=x['remaining']>=reserve
feasible=[x for x in options if x['feasible']]
return max(feasible,key=lambda x:x['npv']),options
policy_checks=[]
for name,cash,initial,p,rec,winner in [('original',F(45),F(30),F(4,5),10,'expansion'),('integration',F(45),F(33),F(4,5),10,'niche'),('concession unfunded',F(45),F(309,10),F(4,5),10,'niche'),('actual cash increased',F(46),F(309,10),F(4,5),10,'expansion'),('lower high probability',F(46),F(309,10),F(3,4),10,'niche'),('no working-capital recovery',F(46),F(309,10),F(4,5),0,'niche')]:
best,options=choose(cash,15,initial,p,rec);assert best['name']==winner
policy_checks.append(dict(case=name,best=best,allAlternatives=options))
checks.append(dict(case='independent complete alternative and reserve enumeration',passed=True,policies=policy_checks,amountUnit='thousands'))
eq('board after concession reserve shortfall',15-(45-F(309,10)),.9)
eq('board actual cash remaining',46-F(309,10),15.1)
# Verify the enterprise cash calculation by explicit persistent-state streams.
for p in [F(0),F(1,2),F(3,4),F(4,5),F(1)]:
high=-F(309,10)+sum(14*d**year for year in range(1,4))+10*d**3
low=-F(309,10)+sum(6*d**year for year in range(1,4))+10*d**3
assert p*high+(1-p)*low==expansion(F(309,10),p)
# Retained native and full companion models, reconstructed without altering them.
assert 30000<=40000 and 50000>40000 and 50000<=40000+15000
eq('retained gross synergy net',8000-5000,3000)
eq('retained synergy NPV',3000*a3-15000,-7539.444027047333)
eq('retained changed synergy NPV',6000*a3-15000,-78.88805409466566)
eq('retained operating investment NPV',-48000+20000*a3+8000*d**3,7747.55822689707)
eq('retained working-capital recovery loss',8000*d**3,6010.518407212622)
eq('retained no recovery value',-48000+20000*a3,1737.039819684448)
eq('retained sequential launch',3+2+4,9)
eq('retained qualified-overlap launch',3+1+4,8)
assert [20000-10000-8000*m for m in range(1,4)]==[2000,-6000,-14000]
assert [20000-8000*m for m in range(1,4)]==[12000,4000,-4000]
eq('retained omitted costs correction',6000-4000-3000,-1000)
eq('retained seller concession correction',-1000+2000,1000)
eq('retained cumulative expansion',-60000+20000*a3+10000*d**3,-2749.8121712997745)
eq('retained omitting working capital',-50000+20000*a3,-262.960180315552)
eq('retained cumulative price concession',-55000+20000*a3+10000*d**3,2250.1878287002255)
eq('retained native funding need',120000+30000,150000)
eq('retained native verified resources',90000+40000,130000)
eq('retained native funding gap',150000-130000,20000)
eq('retained native deposit remaining',130000+25000-150000,5000)
def clean(v):
if isinstance(v,F):return float(v)
raise TypeError(type(v).__name__)
print(json.dumps(dict(passed=True,checks=checks,limits='Original synthetic model verification only. Real demand, financing, contractual/operating authority, qualification, independent subject review and observed learner competence are not established.'),default=clean))
Related chapters
- Frame an enterprise commitment with a strong feasible rival
- Explain why ownership adds value beyond a larger revenue total
- Reconcile the strategic forecast with deliverable output and dated finance
- Make the implementation schedule obey real dependencies and people
- Test strategic uncertainty with feasible contingent policies
- Deliver an enterprise recommendation whose conclusions survive correction
- Cumulative board dossier: reconcile value, cash, capability and a strong alternative