Skip to content

Consumption is a relation O consumes R — operation O consumes resource R — asserting that O uses R exactly once in a way that destroys R: after O completes, R no longer exists in the state that preceded O's execution. The defining structure: consumption is linear use — R is the operation's input and R is used up by O; R cannot be used again after O. Consumption is the fundamental operation in linear logic (the linear implication A ⊸ B uses A to produce B, destroying A in the process) and in Petri net token semantics (a transition fires by consuming tokens from its input places). Consumption is strictly stronger than taking (which acquires a resource but may leave it accessible) and strictly different from reading (which accesses without destroying).
Table of contents

Consumes

Formal definition

Consumption is a relation O consumes RO \text{ consumes } R:

(O:Operation,  R:ResourceType)(O : \mathrm{Operation},\; R : \mathrm{ResourceType})

holding when OO uses exactly one instance r:Rr : R and rr does not exist (in its pre-execution form) after OO completes. The resource rr is consumed — it passes through OO and ceases to be available.

One invariant. O consumes RO \text{ consumes } R iff:

  1. Linear use: OO uses exactly one instance of RR as an input, and that instance is unavailable (destroyed or transformed) after OO completes. The instance cannot be shared with another operation running in parallel, duplicated for later use, or referenced after OO returns. This is the use-once constraint: the resource is a linearly typed input to OO.

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 AA and ABA \Rightarrow B, one can derive BB while retaining AA for future use. Linear logic eliminates this unbounded reuse: each proposition (resource) must be used exactly once.

Linear implication ABA \multimap B (read: “AA leads to BB”): consuming one instance of AA produces one instance of BB. An operation of type ABA \multimap B consumes AA and produces BB; the AA no longer exists after the operation. This is the formal type of a consuming operation.

The linear logic sequent ABA \vdash B means: from exactly one instance of AA, derive one instance of BB. Contrast with classical logic’s ABA \vdash B, where AA is still available after deriving BB.

The exponential modality !A!A (read: “of course AA”, or “unlimited AA”): restores classical behavior — !A!A can be used any number of times. An operation !AB!A \multimap B reads AA non-destructively (can use AA as many times as needed). The difference: ABA \multimap B consumes AA; !AB!A \multimap B reads AA.

Tensor product ABA \otimes B: having both AA and BB simultaneously. An operation ABCA \otimes B \multimap C consumes both AA and BB to produce CC. 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 (P,T,F)(P, T, F), a transition tTt \in T fires by consuming tokens from its preset t={pP(p,t)F}\bullet t = \{p \in P \mid (p, t) \in F\} and depositing tokens in its postset t={pP(t,p)F}t\bullet = \{p \in P \mid (t, p) \in F\}.

Token consumption: firing tt from marking MM removes one token from each input place: M(p)=M(p)1M'(p) = M(p) - 1 for ptp \in \bullet t, M(p)=M(p)+1M'(p) = M(p) + 1 for ptp \in t\bullet, M(p)=M(p)M'(p) = M(p) otherwise. The tokens in t\bullet t are consumed — they no longer exist in the marking after tt 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 xvx \mapsto v: location xx owns the value vvxx is the exclusive owner of this heap cell. Separation conjunction PQP * Q: the heap splits into two disjoint parts, one satisfying PP and one satisfying QQ.

Deallocation is the canonical consuming operation on heap cells:

{xv}  free(x)  {emp}\{x \mapsto v\}\; \mathbf{free}(x)\; \{\mathrm{emp}\}

After free(x)\mathbf{free}(x), the heap is empty (emp\mathrm{emp}): the resource pointed to by xx has been consumed — the memory is returned to the allocator and no longer accessible.

The frame rule {P}  C  {Q}{PR}  C  {QR}\{P\}\; C\; \{Q\} \Rightarrow \{P * R\}\; C\; \{Q * R\} expresses that consuming operations are local: if CC consumes PP (transforming it to QQ), and RR is a separate portion of heap, then CC does not affect RR. 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 \uplus 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 (ABA \multimap B, A1A \multimap 1, A0A \multimap 0 respectively).
  • Whether consumption in the relational history corresponds to the transfer nucleus Δt\Delta_t — whether consuming a resource RR at history tt removes RR from the execution-settled fiber and whether this removal corresponds to a transition ttt \to t' where RHtR \notin H^*_{t'}.

Relations

Ast
Date created
Date modified
Defines
Consumes
Operation
Relational universe morphism
Output
Relational universe morphism
Related
Takes, reads, produces, returns, emits, linear logic, petri net, separation logic
Resource type
Relational universe