Table of contents
Consumes
Formal definition
Consumption is a relation :
holding when uses exactly one instance and does not exist (in its pre-execution form) after completes. The resource is consumed — it passes through and ceases to be available.
One invariant. iff:
- Linear use: uses exactly one instance of as an input, and that instance is unavailable (destroyed or transformed) after completes. The instance cannot be shared with another operation running in parallel, duplicated for later use, or referenced after returns. This is the use-once constraint: the resource is a linearly typed input to .
Girard: linear logic and resource consumption
Jean-Yves Girard (Linear Logic, 1987, Theoretical Computer Science) introduced linear logic as the logic of resource-sensitive computation. In classical and intuitionistic logic, propositions can be used any number of times: from and , one can derive while retaining for future use. Linear logic eliminates this unbounded reuse: each proposition (resource) must be used exactly once.
Linear implication (read: “ leads to ”): consuming one instance of produces one instance of . An operation of type consumes and produces ; the no longer exists after the operation. This is the formal type of a consuming operation.
The linear logic sequent means: from exactly one instance of , derive one instance of . Contrast with classical logic’s , where is still available after deriving .
The exponential modality (read: “of course ”, or “unlimited ”): restores classical behavior — can be used any number of times. An operation reads non-destructively (can use as many times as needed). The difference: consumes ; reads .
Tensor product : having both and simultaneously. An operation consumes both and to produce . Consumption is distributed: both resources are used up.
Petri: token consumption in Petri nets
Carl Adam Petri (Kommunikation mit Automaten, 1962): in a Petri net , a transition fires by consuming tokens from its preset and depositing tokens in its postset .
Token consumption: firing from marking removes one token from each input place: for , for , otherwise. The tokens in are consumed — they no longer exist in the marking after fires.
Petri net token consumption is the canonical model of physical resource consumption: the token (the resource) is in the place (the repository) before the transition fires; after firing, the token is gone. This makes Petri nets the natural model for resource-consuming processes — manufacturing, chemical reactions, workflow steps.
Separation logic: ownership and exclusive use
Peter O’Hearn, John Reynolds, Hongseok Yang (Local Reasoning about Programs that Alter Data Structures, 2001; O’Hearn Resources, Concurrency and Local Reasoning, 2004) developed separation logic to reason about programs that consume (modify or deallocate) heap resources:
The points-to assertion : location owns the value — is the exclusive owner of this heap cell. Separation conjunction : the heap splits into two disjoint parts, one satisfying and one satisfying .
Deallocation is the canonical consuming operation on heap cells:
After , the heap is empty (): the resource pointed to by has been consumed — the memory is returned to the allocator and no longer accessible.
The frame rule expresses that consuming operations are local: if consumes (transforming it to ), and is a separate portion of heap, then does not affect . Consumption is precise: the operation consumes exactly what it owns, not more.
BI logic foundation (O’Hearn and Pym, The Logic of Bunched Implications, Bulletin of Symbolic Logic 5(2), 1999): separation logic’s is the multiplicative conjunction of BI logic — a substructural logic combining classical conjunction/implication (with weakening and contraction) and linear conjunction/implication (without). Heap semantics is precisely the resource model for the multiplicative fragment: heaps are monoidal elements, disjoint union is the monoidal product, and the empty heap is the unit. Consumption in separation logic is linear use in BI logic.
Open questions
- Whether the linear logic consumption model (use-once) and the Petri net consumption model (token removal) are formally the same — whether there is a functor from Petri nets to the proof nets of linear logic that maps token consumption to linear consumption of propositions.
- Whether there is a hierarchy of consumption strengths: consuming-and-producing (metabolic, like biological processes), consuming-only (destructive), and pure-consuming (no output), and whether each corresponds to a different linear logic connective (, , respectively).
- Whether consumption in the relational history corresponds to the transfer nucleus — whether consuming a resource at history removes from the execution-settled fiber and whether this removal corresponds to a transition where .