Advanced Techniques
6.1 Cross-Cutting Concerns
Problem: Some legal concepts (like appeals) apply across multiple processes.
Example: Appeals can be made against:
Registration refusal (Art 33)
Required Steps Notice (Art 33)
Deregistration decision (Art 33)
Name change refusal (Art 33)
Solution - Generic appeal mechanism:
DECLARE AppealableDecision IS ONE OF
RegistrationRefusal HAS reasons IS A LIST OF STRING
RequiredStepsNotice HAS steps IS A LIST OF STRING
DeregistrationDecision HAS grounds IS A LIST OF STRING
NameChangeRefusal HAS reasons IS A LIST OF STRING
§ `Universal Appeal Right (Art 33)`
GIVEN decision IS AN AppealableDecision
GIVETH A PROVISION Actor Action
`appeal process` MEANS
PARTY AffectedParty
MAY AppealDecision OF decision
WITHIN 28 days OF `decision notice served`
HENCE `appeal proceeds to tribunal`
LEST `appeal time expired`
6.2 Multi-Instrument Integration
Real example - Annual Return Requirements:
Combines requirements from 4 different instruments:
Art 13(7)-(10) Law 2014: Basic obligation
Core Info Regs 2018: Financial data requirements
Additional Info Order 2018: Governor payment details
Timing Order 2019: Deadline specifications
L4 integration approach:
Step 1: Define the complex data structure outside the PROVISION:
-- Define integrated financial data structure first
integratedFinancialData MEANS IntegratedFinancialData WITH
coreFinancialInfo IS TRUE, -- Core Info Regs 2018
governorPayments IS TRUE, -- Additional Info Order 2018
publicBenefitNarrative IS TRUE -- Additional Info Order 2018
Step 2: Reference it in the CONTRACT rule:
§ `Integrated Annual Return (4 instruments)`
GIVETH A PROVISION Actor Action
`comprehensive annual return` MEANS
PARTY RegisteredCharity
MUST FileReturn OF integratedFinancialData
WITHIN 2 months OF `financial year end` -- Timing Order 2019
HENCE `full transparency achieved` -- Purpose of Art 13 Law 2014
LEST `lateFlag set + Required Steps Notice enabled`
Key insight: Keep CONTRACT actions simple by pre-defining complex objects rather than constructing them inline.
6.2a CONTRACT Syntax Best Practices
Critical Rule: Avoid complex object construction within CONTRACT rules.
❌ Problematic (causes syntax errors):
PARTY applicant
MUST ProvideApplication OF ApplicationContents WITH
constitution IS applicant's constitution,
purposes IS applicant's purposes,
coreFinancialInfo IS CoreFinancialInfo WITH
income IS Money OF 0 "GBP",
expenditure IS Money OF 0 "GBP"
✅ Correct approach - Use helper functions:
-- Define helper function outside CONTRACT
GIVEN applicant IS A RegisterEntry
GIVETH AN ApplicationContents
DECIDE `build application contents` IS
ApplicationContents WITH
constitution IS applicant's constitution,
purposes IS applicant's purposes,
coreFinancialInfo IS CoreFinancialInfo WITH
income IS Money OF 0 "GBP",
expenditure IS Money OF 0 "GBP"
-- Use simple reference in CONTRACT
PARTY applicant
MUST ProvideApplication OF `build application contents` applicant
✅ Alternative - Pre-define examples:
-- Define complete example outside CONTRACT
exampleApplication MEANS ApplicationContents WITH
constitution IS standardConstitution,
purposes IS LIST `advancement of education`,
coreFinancialInfo IS standardFinancials
-- Reference directly in CONTRACT
PARTY applicant
MUST ProvideApplication OF exampleApplication
Why this matters:
Syntax requirements: L4 parser expects simple expressions in CONTRACT actions
Readability: Complex object construction clutters the legal logic
Maintainability: Helper functions can be reused across multiple CONTRACT rules
Testing: Pre-defined objects are easier to validate and test
Pattern for actions with structured data:
Define the structure using
DECLARE
Create helper functions or examples using
DECIDE
orMEANS
Use simple references in CONTRACT rules
Keep legal logic clean and focus on the process flow
6.3 Advanced Simulations
Multi-party scenario with error handling:
#TRACE `Complex Misconduct Scenario` charity Commissioner governor tribunal AT 1 WITH
-- Discovery phase
PARTY Commissioner DOES `discover potential misconduct` governor AT 10
PARTY Commissioner DOES `investigate allegations` AT 20
-- Decision phase
PARTY Commissioner DOES SuspendGovernor OF governor, "mismanagement", (Date OF 2024, 12, 31) AT 30
-- Charity response (may fail)
PARTY charity DOES `attempt to ignore suspension` AT 40 -- Error condition
PARTY Commissioner DOES `detect non-compliance by charity` AT 50
-- Escalation
PARTY Commissioner DOES IssueNotice OF requiredSteps AT 60
PARTY charity DOES `comply with required steps` AT 70
-- Appeal
PARTY governor DOES AppealDecision OF suspensionOrder AT 80
PARTY tribunal DOES `hear appeal and vary order` AT 120
-- Resolution
PARTY Commissioner DOES VaryOrder OF originalSuspension, newConditions AT 130
Performance considerations for large schemes:
-- Efficient register lookups
ASSUME `charity by registration number` IS A FUNCTION FROM STRING TO MAYBE RegisteredCharity
ASSUME `active governors for charity` IS A FUNCTION FROM STRING TO LIST OF Person
-- Bulk operations for large datasets
DECLARE BulkAction IS ONE OF
BulkAnnualReturnReminder HAS charities IS A LIST OF STRING
BulkComplianceCheck HAS cutoffDate IS A Date
Success Check: You can now handle cross-cutting legal concerns, integrate multiple legal instruments, and create sophisticated simulations with error handling and performance considerations.
Last updated