The journal theory: the sorts, the operations and the laws.
Modulevortex-journal-0.1.0GHC2024
Vortex.Journal.Theory
The journal as a sheaf theory: its sorts, its operations and its laws, each law named. It is a linear/non-linear theory: the resource sorts (tokens and markings) are linear, read in a symmetric monoidal category where nothing is copied or discarded (a net's free model), and the information sorts (logs, answers, versions, snapshots, refusals, conflicts) are cartesian, freely copied. The fold of a log and the recorded answer are the bridge between the two.
sheaf's sorts carry only a name, so the usage of each sort and the mode of each operation's arguments are kept here, beside the theory, and linearityErrors checks the theory's laws against them.
- 4 types
- 7 values
- Packagevortex-journal-0.1.0
- Exports11
- LanguageGHC2024
- LicenceMIT
- SourceTheory.hs
The theory
2 declarationsThe laws, each with its name. The numbers are the journal's equations as first stated; the rest are the multiset, version and decision laws they rest on.
Linear and cartesian sorts
6 declarationsHow a sort's values may be used: a linear value exactly once, a cartesian one any number of times.
The usage of every sort of the theory.
Each operation with its signature and the mode of each argument.
Where an operation stands between the two worlds.
Constructors
Resourceconsumes linear values into a linear result
Bridgemakes a linear value from cartesian ones (the fold, pre and post)
Observationlooks at linear values for a cartesian result
Informationcartesian in, cartesian out
An operation's role, from its signature and modes.
Checking linearity
3 declarationsWhy a theory is not linear in its resources.
Constructors
UnclassifiedSort Sorta sort with no usage
UnclassifiedOp Stringan operation with no argument modes
ModeArityMismatch Stringan operation with a mode list of the wrong length
ModeSortMismatch String Intan argument whose mode does not fit its sort's usage
ConsumedIntoCartesian Stringan operation that consumes a resource into a cartesian value
UsedUnequally Equation Stringa resource consumed on one side of a law and not the other
UsedMoreThanOnce Equation Stringa resource consumed twice on one side of a law
ConsumedAndObserved Equation Stringa resource consumed and also looked at on one side of a law
Instances2Eq, Show
Eq LinearityErrorDefined in vortex-journal-0.1.0 · Vortex.Journal.TheoryShow LinearityErrorDefined in vortex-journal-0.1.0 · Vortex.Journal.Theory
Check a theory's linearity against the usage table and a mode table: every sort and operation is classified, the modes fit the sorts, no operation consumes a resource into a cartesian value, and every law consumes each resource variable once on each side or on neither, and never consumes and observes it on the same side. Premises are guards on the cartesian shadow of the state and are not counted.
The linearity errors of one law.