SETTLEMENT_MATHEMATICAL_LIFECYCLE_PROOF_MODEL.md
Purpose
Define a mathematical model for settlement lifecycle validity and provide proof sketches for determinism, safety, and authorization soundness.
Resolving locale, route permissions, and workspace projection.
Current scope: Guest
Category: 10_normative | Version: v1.0.0
Owner: DOCUMENT_CUSTODIAN | Review cycle: 90 days
Approval authority: GOVERNANCE_ADMIN
Documentation portal is read-only. Editing and mutation endpoints are disabled.
Kvary platform is originally created in Georgian. Where a Georgian version exists, Georgian is authoritative for platform UI, documentation, and legal interpretation.
Translations into other languages are provided for convenience. Some records may originate in other languages and carry their own source or legal locale for a specific flow, but where a Georgian version is available, the Georgian version prevails for platform-level wording and interpretation.
Metadata incomplete: Document ID, Version, Status, Owner Role, Last Review Date, Next Review Date, Change Log
Define a mathematical model for settlement lifecycle validity and provide proof sketches for determinism, safety, and authorization soundness.
Applies to governance-layer settlement reasoning only. The model is ledger-derived and excludes execution-layer side effects.
L = (e_0, e_1, ..., e_n): finite ordered ledger sequence by append index.sid: settlement subject identifier, sid = <SubjectType>:<SubjectId>.Intent(L, sid): subsequence of entries where recordType=SETTLEMENT_INTENT and subjectId=sid.Events(L, sid): subsequence of entries where recordType=SETTLEMENT_EVENT and subjectId=sid.Dec(L, sid, a, p): latest ACCESS_DECISION before current point matching (subjectId=sid, action=a, policyHash=p).E = {ESCROW_OPENED, DEPOSIT_CONFIRMED, RELEASE_REQUESTED, RELEASE_EXECUTED, REFUND_EXECUTED, RAIL_ERROR}.SETTLEMENT_INTENT and SETTLEMENT_EVENT are the only settlement record types.SETTLEMENT.CREATE.SETTLEMENT.<EVENT_TYPE> with <EVENT_TYPE> in E.L only.PI(L, sid) = Intent(L, sid)PE(L, sid) = Events(L, sid)Define S(L, sid) as tuple:
(created, escrowOpened, funded, releaseRequestedSet, releasedSet, refunded, railErrorSeen)
Initialization:
S_0 = (false, false, false, {}, {}, false, false)
Transition over projected sequence (PI then PE in original ledger order):
created := trueESCROW_OPENED: escrowOpened := trueDEPOSIT_CONFIRMED: funded := trueRELEASE_REQUESTED(m): add m to releaseRequestedSetRELEASE_EXECUTED(m): add m to releasedSetREFUND_EXECUTED: refunded := trueRAIL_ERROR: railErrorSeen := trueV(L, sid) -> (ok: bool, errors: sequence<string>)
ok=true iff all hold:
escrowRequired=true then DEPOSIT_CONFIRMED occurs only after ESCROW_OPENEDRELEASE_EXECUTED(m) requires prior RELEASE_REQUESTED(m)RELEASE_REQUESTED or RELEASE_EXECUTED after REFUND_EXECUTEDStatement: For identical ledger L and same verifier rules, S(L, sid) and V(L, sid) are unique.
Sketch:
L order is total and fixed by append index.PI, PE are pure filters.Dec is deterministic latest-match scan.
Therefore outputs are functionally determined by L.Statement: If REFUND_EXECUTED exists for sid, no valid state permits later release progression.
Sketch:
errors != empty.Statement: If a settlement event is validly accepted at index k, then there exists earlier matching ALLOW decision and no later matching DENY before k.
Sketch:
k would become latest and invalidate event.authDecisionEntryHash, authDecisionPayloadHash) can be compared exactly.Given sid = AUCTION:A-100, policyHash = P-1:
e0: ACCESS_DECISION(ALLOW, action=SETTLEMENT.CREATE, sid, policyHash)
e1: SETTLEMENT_INTENT(action=SETTLEMENT.CREATE, sid, policyHash, metadata.escrowRequired=true)
e2: ACCESS_DECISION(ALLOW, action=SETTLEMENT.ESCROW_OPENED, sid, policyHash)
e3: SETTLEMENT_EVENT(action=SETTLEMENT.ESCROW_OPENED, sid, policyHash, trace hashes)
e4: ACCESS_DECISION(ALLOW, action=SETTLEMENT.DEPOSIT_CONFIRMED, sid, policyHash)
e5: SETTLEMENT_EVENT(action=SETTLEMENT.DEPOSIT_CONFIRMED, sid, policyHash, trace hashes)
e6: ACCESS_DECISION(ALLOW, action=SETTLEMENT.RELEASE_REQUESTED, sid, policyHash)
e7: SETTLEMENT_EVENT(action=SETTLEMENT.RELEASE_REQUESTED, sid, policyHash, metadata.milestoneId=M1, trace hashes)
e8: ACCESS_DECISION(ALLOW, action=SETTLEMENT.RELEASE_EXECUTED, sid, policyHash)
e9: SETTLEMENT_EVENT(action=SETTLEMENT.RELEASE_EXECUTED, sid, policyHash, metadata.milestoneId=M1, trace hashes)
Stepwise state evolution:
e1: created=truee3: escrowOpened=truee5: funded=truee7: releaseRequestedSet={M1}e9: releasedSet={M1}Final result:
S(L,sid) indicates successful release path without refund.V(L,sid) = (true, []).verifySettlementAuthorization.verifySettlementEventAuthorization.verifySettlementLifecycle.packages/core/settlement/*.RAIL_ERROR is modeled as a non-terminal event that does not imply fund movement.L multiple times and across runtimes.subjectId entries do not affect S(L,sid).