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 limited synthetic formal-logic, stipulated-evidence and counting calculations, not independent academic acceptance or production migration safety.

"""Limited synthetic logic/count/evidence checks. Philosophy is not decided by code."""
from itertools import product
from fractions import Fraction as F
import json
checks=[]
def record(name,value):checks.append(dict(case=name,result=value))
implies=lambda p,q:not p or q
worlds=list(product([False,True],repeat=2))
counter=[dict(approved=a,reviewed=r) for a,r in worlds if implies(a,r) and r and not a]
assert counter==[dict(approved=False,reviewed=True)];record('affirming consequent countermodel',counter)
assert not [(a,r) for a,r in worlds if implies(a,r) and not r and a]
assert not [(a,r) for a,r in worlds if implies(a,r) and implies(r,a) and r and not a]
record('modus tollens and added sufficient condition','No classical truth-table countermodels under the specified added premises.')
matrices=list(product([False,True],repeat=4))
every_visitor=lambda m:(m[0] or m[1]) and (m[2] or m[3])
common_guide=lambda m:(m[0] and m[2]) or (m[1] and m[3])
bad=[m for m in matrices if every_visitor(m) and not common_guide(m)]
assert len(bad)==2 and (True,False,False,True) in bad;record('quantifier reversal',{'all16relationsChecked':True,'countermodels':bad})
# Empty extension illustrates lack of existential import, not a claim about ordinary pragmatics.
assert all(False for _ in []) and not any(True for _ in [])
record('universal empty-domain instance','A universal over an empty certified-plan extension does not assert a certified plan exists.')
def posterior(prior,lr):
 odds=prior/(1-prior)*lr;return odds/(1+odds)
assert posterior(F(1,5),3)==F(3,7)
assert posterior(F(1,5),9)==F(9,13)
assert posterior(F(1,10),4)==F(4,13)
assert posterior(F(1,10),16)==F(16,25)
assert posterior(posterior(F(1,10),4),F(1,4))==F(1,10)
record('retained and new conditional odds','1/5 LR3→3/7; two independent LR3→9/13. New1/10 LR4→4/13; two independent→16/25; fresh symmetric negative→1/10. Copying supplies no new event.')
assert F(80,80+180)==F(4,13) and F(64,64+36)==F(16,25)
record('independent hypothetical frequency reconstruction',{'onePositive':str(F(80,260)),'twoIndependentPositives':str(F(64,100))})
# Exhaust every relation on three objects; find no equivalence relation with P=L,P=R,L!=R.
equivalences=[]
for bits in product([False,True],repeat=9):
 rel=lambda x,y:bits[3*x+y]
 if not all(rel(x,x) for x in range(3)):continue
 if not all(rel(x,y)==rel(y,x) for x in range(3) for y in range(3)):continue
 if not all(not(rel(x,y) and rel(y,z)) or rel(x,z) for x in range(3) for y in range(3) for z in range(3)):continue
 equivalences.append(bits)
assert len(equivalences)==5
assert not [r for r in equivalences if r[1] and r[2] and not r[5]]
record('branching identity constraint','All512binary relations checked;5equivalence relations; none preserves P=L and P=R with distinctL/R. Does not establish possible copying technology or a full personal-identity theory.')
damage=lambda fault,switch:fault and not switch
assert damage(True,False) and not damage(True,True)
record('causal efficacy versus fatalism',{'faultWithoutSwitch':damage(True,False),'faultWithSwitch':damage(True,True),'freeWillSettled':False})
attempts=set(range(30));contacts=set(range(20,40));assert len(attempts|contacts)==40 and len(attempts&contacts)==10
assert F(18,30)==F(3,5)
possible_unions=[30+20-overlap for overlap in range(21)];assert min(possible_unions)==30 and max(possible_unions)==50
assert 8000+4000==12000
record('cumulative counts and budget',{'completionRate':str(F(18,30)),'knownOverlapUnion':40,'unknownOverlapUnionRange':[30,50],'splitBudget':12000,'normativeChoiceDetermined':False})
print(json.dumps(dict(passed=True,checks=checks,boundary='Checks establish only the listed formal relationships and stipulated numerical results. They do not decide knowledge, metaphysical truth, moral/political justification, textual interpretation, real evidence/authority, independent review or learner competence.',learnerRecordsAccessed=False),indent=2))

Related chapters