Original resource accounting and identity composition
DefinitionAPFResourceIdentityapfresource-identity
This module retains original full occurrence fibers, actual account annotations, complete protocol resource loads, and their fixed calibration. It records the original empty-process typing and the C1/C2 source clauses explicitly, then names both ordered empty extensions and their partial domains and ledger graphs. Literal empty-word subject equality precedes account attribution. No account on all processes or arbitrary composition is supplied. This is formal coverage of existing source arguments under RI0–RI7. Original C1/C2 and B03 remain source inputs where used. No all-process account, probability, general implementation-price quotient, full tested P1/P5 structure, or completed transport is asserted.
Definition code
import Definitions.Def_APFSameDeploymentSource
/-! RI0-RI7: original empty-instruction source clauses, not laws of arbitrary U.
C1/C2 below reify the personally consulted original closure/reach clauses.
No null occurrence, accounted-composite existence, domain equality or annotation
promotion is a field. Actual occurrence witnesses are recovered from fullUse. -/
set_option autoImplicit false
namespace APFResourceIdentity
open APFTF1 APFOriginalProcess APFOriginalSource APFUpstreamOccupant
open APFPaper1.Foundation APFOriginalFinitePossibilities APFOriginalAdmission
variable {Γ : Type*} {Raw FullProcess Resource : Γ → Type*}
variable [∀ γ, AddCommMonoid (Resource γ)] [∀ γ, Preorder (Resource γ)]
variable {T : OriginalTyping Γ FullProcess} {P : ∀ γ, Set (FullProcess γ)}
variable {A : ∀ γ, Account (R := Resource γ) (P γ)}
abbrev FullFiber (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) :=
Σ b : Raw ((T γ).outputContext p.val), U.occurrence γ p.val x b
abbrev FullOccurrence (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) := Σ x : Raw γ, FullFiber U p x
abbrev OwnFiber (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) :=
Σ b : Raw ((T γ).outputContext p.val), WholeUse U γ p x b
def wholeBill {γ : Γ} (p : ProtocolView (P γ)) : ℝ :=
((A γ).calibration ((A γ).wholeResource p) : ℝ)
def affordable {γ : Γ} (p : ProtocolView (P γ)) : Prop :=
wholeBill (A := A) p ≤ ((A γ).capacity : ℝ)
def subject {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (_h : FullOccurrence U p) : ProtocolView (P γ) := p
def resourceCoordinate {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (h : FullOccurrence U p) : Resource γ :=
(A γ).wholeResource (subject h)
def ledgerCoordinate {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (h : FullOccurrence U p) : ℝ :=
((A γ).calibration (resourceCoordinate h) : ℝ)
def fullGraph (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) (t : ℝ) : Prop :=
∃ h : FullFiber U p x, t = ledgerCoordinate (⟨x,h⟩ : FullOccurrence U p)
def ownDomain (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) : Prop := Nonempty (OwnFiber U p x)
def ownGraph (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) (t : ℝ) : Prop :=
∃ h : OwnFiber U p x,
t = ledgerCoordinate (⟨x,h.1,h.2.val⟩ : FullOccurrence U p)
abbrev AnnotatedEvent (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) := FullOccurrence U p × Unit
def eventLift {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (h : FullOccurrence U p) : AnnotatedEvent U p := (h,())
def eventForget {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (e : AnnotatedEvent U p) : FullOccurrence U p := e.1
def eventIncidence {U : UseSource (Raw := Raw) T P A} {γ : Γ}
{p : ProtocolView (P γ)} (e : AnnotatedEvent U p) : ℝ :=
((({()} : Finset Unit).filter (fun t => t = e.2)).card : ℝ)
/-- Original empty process has the original context as output. This is the
C1 identity's source typing, identified with the account's zero-fragment null
by the accepted written source identification, not by its price. -/
structure EmptyTyping (T : OriginalTyping Γ FullProcess)
(P : ∀ γ, Set (FullProcess γ))
(A : ∀ γ, Account (R := Resource γ) (P γ)) where
output : ∀ γ, (T γ).outputContext (A γ).nullProtocol.val = γ
def atIdentityContext (N : EmptyTyping T P A) {γ : Γ}
(b : Raw ((T γ).outputContext (A γ).nullProtocol.val)) : Raw γ :=
cast (congrArg Raw (N.output γ)) b
inductive EmptyOrder where | initial | terminal
def emptyWord {γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) : List (FullProcess γ) :=
match o with
| .initial => [p.val] ++ []
| .terminal => [] ++ [p.val]
def emptySubject {γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) : FullProcess γ :=
(emptyWord o p).head (by cases o <;> simp [emptyWord])
theorem raw_empty_subject {γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) :
emptySubject o p = p.val := by cases o <;> rfl
/-- Membership is transported ONLY after the proved literal raw identity. -/
def wholeProtocol {γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) : ProtocolView (P γ) :=
⟨emptySubject o p, by rw [raw_empty_subject]; exact p.property⟩
theorem wholeProtocol_eq {γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) :
wholeProtocol o p = p := by apply Subtype.ext; exact raw_empty_subject o p
structure InitialStages (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} (p : ProtocolView (P γ)) (x : Raw γ) where
original : FullFiber U p x
identity : FullFiber U (A γ).nullProtocol x
preserved : Profile U γ (atIdentityContext N identity.1) = Profile U γ x
following : FullFiber U p (atIdentityContext N identity.1)
structure TerminalStages (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} (p : ProtocolView (P γ)) (x : Raw γ) where
original : FullFiber U p x
identity : FullFiber U (A ((T γ).outputContext p.val)).nullProtocol original.1
preserved : Profile U ((T γ).outputContext p.val) (atIdentityContext N identity.1) =
Profile U ((T γ).outputContext p.val) original.1
/-- Source C1 (identity reaches the same profile) and C2 (compose actual typed
uses along reach when the WHOLE normalized instruction fits the original budget).
The C2 restrictions contain zero-fragment identities only: no recovery device,
waiting operation, general all-process account or summed load is supplied. -/
structure OriginalEmptyClauses (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A) : Prop where
c1_reach : ∀ γ (x : Raw γ), ∃ b,
fullUse T P A U.judgment γ (A γ).nullProtocol.val x b ∧
Profile U γ (atIdentityContext N b) = Profile U γ x
c2_initial : ∀ {γ} (p : ProtocolView (P γ)) (x : Raw γ)
(s : InitialStages U N p x), affordable (A := A) (wholeProtocol .initial p) →
∃ b, fullUse T P A U.judgment γ (wholeProtocol .initial p).val x b ∧
Profile U ((T γ).outputContext p.val) b =
Profile U ((T γ).outputContext p.val) s.following.1
c2_terminal : ∀ {γ} (p : ProtocolView (P γ)) (x : Raw γ)
(s : TerminalStages U N p x), affordable (A := A) (wholeProtocol .terminal p) →
∃ b, fullUse T P A U.judgment γ (wholeProtocol .terminal p).val x b ∧
Profile U ((T γ).outputContext p.val) b =
Profile U ((T γ).outputContext p.val) (atIdentityContext N s.identity.1)
def Stages (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) (x : Raw γ) :=
match o with | .initial => InitialStages U N p x | .terminal => TerminalStages U N p x
def finalProfile (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} {o : EmptyOrder} {p : ProtocolView (P γ)} {x : Raw γ}
(s : Stages U N o p x) : Set (FullProcess ((T γ).outputContext p.val)) :=
match o, s with
| .initial, s => Profile U ((T γ).outputContext p.val) s.following.1
| .terminal, s => Profile U ((T γ).outputContext p.val) (atIdentityContext N s.identity.1)
structure OrderedPresentation (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) (x : Raw γ) where
stages : Stages U N o p x
fullBudget : affordable (A := A) p
whole : FullFiber U p x
reached : Profile U ((T γ).outputContext p.val) whole.1 = finalProfile U N stages
def budgetedDomain (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (x : Raw γ) : Prop :=
p.val ∈ Profile U γ x ∧ affordable (A := A) p
def orderedGraph (U : UseSource (Raw := Raw) T P A) (N : EmptyTyping T P A)
{γ : Γ} (o : EmptyOrder) (p : ProtocolView (P γ)) (x : Raw γ) (t : ℝ) : Prop :=
∃ z : OrderedPresentation U N o p x,
t = ledgerCoordinate (⟨x,z.whole⟩ : FullOccurrence U p)
def inputQuotientDomain (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (z : PhysicalState (Profile U γ)) : Prop :=
z ∈ quotientDomain (Profile U γ) p.val ∧ affordable (A := A) p
def inputQuotientValue (U : UseSource (Raw := Raw) T P A) {γ : Γ}
(p : ProtocolView (P γ)) (z : PhysicalState (Profile U γ)) (t : ℝ) : Prop :=
inputQuotientDomain U p z ∧ t = wholeBill (A := A) p
end APFResourceIdentity
Source
APF Paper 1, Enforceability of Distinction Supplement v9.27: C1/C2 and reach (lines 1223–1240), original resource/calibration (2188–2221), null convention (2880–2883), and finite typed words (3175–3228); accepted original-source RI0–RI7 formalization, 20 September 2026.