Separation logic
https://en.wikipedia.org/wiki/Separation_logic
Separation logic is an extension of Hoare logic, a way of reasoning about programs.
The assertion language of separation logic is a special case of the logic of bunched implications (BI).
Separation logic facilitates reasoning about:
programs that manipulate pointer data structuresβincluding information hiding in the presence of pointers
"transfer of ownership" (avoidance of semantic frame axioms)
virtual separation (modular reasoning) between concurrent modules
Separation logic supports the developing field of research described by Peter O'Hearn and others as local reasoning, whereby specifications and proofs of a program component mention only the portion of memory used by the component, and not the entire global state of the system.
Applications include automated parallelization of software, and automated program verification, where an algorithm checks the validity of another algorithm.
Separation logic assertions describe states consisting of a store and a heap, roughly corresponding to the state of local, stack-allocated, variables and dynamically-allocated objects.
A store s is a function mapping variables to values. A heap β is a partial function mapping memory addresses to values. Two heaps β and ββ² are disjoint, denoted β β₯ ββ², if their domains do not overlap; i.e. for every memory address β, at least one of β(β) and ββ²(β) is undefined.
The logic allows to prove judgements of the form s,β β¨ P, where s is a store, β is a heap, and P is an assertion over the given store and heap. Separation logic assertions (denoted as P, Q, R) contain the standard boolean connectives and, in addition, emp
, e β¦ e', P β Q, and P ββ Q, where e and eβ² are expressions.
The constant emp
asserts that the heap is empty, i.e. s,β β¨ emp when β is undefined for all addresses.
The binary operator β¦ takes an address and a value and asserts that the heap is defined at exactly one location, mapping the given address to the given value.
s,β β¨ e β¦ eβ² when β , where denotes the value of expression e evaluated in store s, and β is otherwise undefined.
The binary operator β () (pronounced star or separating conjunction) asserts that the heap can be split into two disjoint parts where its two arguments hold, respectively.
s,β β¨ P β Q when there exist such that and and and
The binary operator ββ (pronounced magic wand or separating implication) asserts that extending the heap with a disjoint part that satisfies its first argument results in a heap that satisfies its second argument.
when for every heap such that , also holds.
Last updated
Was this helpful?