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.
"""Synthetic evidence-packet checks, not a legal decision engine.
No network, production records, legal filings or learner data.
The program checks stated identity/timing facts, never judicial outcomes.
"""
from datetime import datetime
import json
checks={}
def check(k,v):assert v,k;checks[k]=True
quote={'version':'Q1','base':1000,'attachment':'A1'}
customer={'version':'Q1','attachment':'A2'}
check('attachment_dispute_detected',quote['attachment']!=customer['attachment'])
check('billing_sum_only',1000+200==1200)
expenses=[{'source':'receipt-1','amount':200,'label':'repair'},{'source':'receipt-1','amount':200,'label':'restoration'}]
unique={e['source']:e['amount'] for e in expenses}
check('duplicate_allegation_detected',sum(e['amount'] for e in expenses)==400 and sum(unique.values())==200)
incident={'location':'showroom-A','time':'2026-01-31T10:15','substance':'spill-X'}
notice={'location':'showroom-A','time':'2026-01-31T10:05','substance':'spill-X'}
def same_prior_condition(a,b):
return a['location']==b['location'] and a['substance']==b['substance'] and datetime.fromisoformat(a['time'])<datetime.fromisoformat(b['time'])
check('same_prior_notice_evidence',same_prior_condition(notice,incident))
check('changed_location_loses_specific_match',not same_prior_condition({**notice,'location':'warehouse-B'},incident))
check('later_notice_not_prior',not same_prior_condition({**notice,'time':'2026-01-31T10:20'},incident))
check('unknown_condition_not_invented',not same_prior_condition({**notice,'substance':None},incident))
dates=[datetime.fromisoformat('2026-06-01'),datetime.fromisoformat('2026-06-02'),datetime.fromisoformat('2026-06-03')]
check('delivery_inspection_objection_order',dates==sorted(dates) and (dates[-1]-dates[0]).days==2)
claim={'speaker':'agent','principal':'Harbor','scope':'unlimited','evidence':'agent-assertion'}
representation={'speaker':'Harbor','principal':'Harbor','scope':'equipment-order-7','evidence':'principal-email'}
def principal_representation_for(e,scope):return e['speaker']==e['principal'] and e['scope']==scope
check('agent_assertion_not_principal_evidence',not principal_representation_for(claim,'equipment-order-7'))
check('changed_express_scope_evidence',principal_representation_for(representation,'equipment-order-7'))
claims=[dict(id='forum',state='Florida',federalIssue=True,unresolved=['attachment','assent']),dict(id='premises',state='Florida',federalIssue=False,unresolved=['cause','harm']),dict(id='contract',state='Florida',federalIssue=False,unresolved=['extra-price-assent'])]
check('state_default_explicit',all(x['state']=='Florida' for x in claims))
check('unresolved_facts_preserved',all(x['unresolved'] for x in claims))
check('separate_issue_identities',len({x['id'] for x in claims})==3)
check('rubric_maximum',6*4==24)
print(json.dumps(dict(passed=True,checks=checks,scope='Packet identity, chronology, arithmetic and missing-evidence controls only. No liability, enforceability, classification or regulatory verdict is computed.'),indent=2))
Related chapters
- Build an issue from authority and evidence before choosing a forum
- Separate a dangerous condition, a legal breach and causal harm
- Trace the promise from formation through an alleged change
- Read the transaction before applying a sales rule
- Separate the authority to act from the label placed on a worker
- Turn a legal obligation into a control that can be challenged and corrected
- Cumulative clinic: a Florida business-law issue and evidence dossier