|
2 | 2 | // an API wrapper for a collection of SMT solvers: |
3 | 3 | // https://github.com/sosy-lab/java-smt |
4 | 4 | // |
5 | | -// SPDX-FileCopyrightText: 2020 Dirk Beyer <https://www.sosy-lab.org> |
| 5 | +// SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org> |
6 | 6 | // |
7 | 7 | // SPDX-License-Identifier: Apache-2.0 |
8 | 8 |
|
|
15 | 15 | * all formulae for one heap need to use matching types (sorts) for the AdressFormulae and |
16 | 16 | * ValueFormulae. The user has to take care of this, otherwise the {@link ProverEnvironment} |
17 | 17 | * complains at runtime! |
| 18 | + * |
| 19 | + * @see <a href="https://en.wikipedia.org/wiki/Separation_logic">Separation Logic</a> |
| 20 | + * @see <a href="https://cacm.acm.org/research/separation-logic/">Separation Logic</a> |
| 21 | + * @see <a |
| 22 | + * href="https://www.cs.cmu.edu/afs/cs.cmu.edu/project/fox-19/member/jcr/www15818As2011/cs818A3-11.html">15-818A3 |
| 23 | + * Introduction to Separation Logic (6 units) Spring 2011</a> |
| 24 | + * @see <a href="https://www.philipzucker.com/executable-seperation">Modeling Separation Logic with |
| 25 | + * Python Dicts and Z3</a> |
18 | 26 | */ |
19 | 27 | @SuppressWarnings("MethodTypeParameterName") |
20 | 28 | public interface SLFormulaManager { |
21 | 29 |
|
| 30 | + /** |
| 31 | + * Creates a formula representing the "separating conjunction" (*) of two Boolean formulas. In |
| 32 | + * separation logic, the separating conjunction asserts that the two formulas describe disjoint |
| 33 | + * parts of the heap. It is similar to the logical AND operator, but with the additional |
| 34 | + * constraint that the memory regions described by the two formulas do not overlap. |
| 35 | + * |
| 36 | + * @return a Boolean formula representing the separating conjunction of {@code f1} and {@code f2}. |
| 37 | + */ |
22 | 38 | BooleanFormula makeStar(BooleanFormula f1, BooleanFormula f2); |
23 | 39 |
|
| 40 | + /** |
| 41 | + * Creates a formula representing a "points-to" relation in the heap. The "points-to" relation |
| 42 | + * asserts that a pointer points to a specific value in memory. |
| 43 | + * |
| 44 | + * @param <AF> the type of the address formula. |
| 45 | + * @param <VF> the type of the value formula. |
| 46 | + * @param ptr the pointer formula. |
| 47 | + * @param to the value formula. |
| 48 | + * @return a Boolean formula representing the "points-to" relation. |
| 49 | + */ |
24 | 50 | <AF extends Formula, VF extends Formula> BooleanFormula makePointsTo(AF ptr, VF to); |
25 | 51 |
|
| 52 | + /** |
| 53 | + * Creates a formula representing the "magic wand" (-*) operator in separation logic. The "magic |
| 54 | + * wand" operator asserts that if the first formula holds, then the second formula can be added to |
| 55 | + * the heap without conflict. It is a form of implication (=>) that takes into account the |
| 56 | + * disjointness of memory regions. |
| 57 | + * |
| 58 | + * @return a Boolean formula representing the "magic wand" of {@code f1} and {@code f2}. |
| 59 | + */ |
26 | 60 | BooleanFormula makeMagicWand(BooleanFormula f1, BooleanFormula f2); |
27 | 61 |
|
| 62 | + /** |
| 63 | + * Creates a formula representing an empty heap. The empty heap formula asserts that no memory is |
| 64 | + * allocated for the given address and value types. |
| 65 | + * |
| 66 | + * @param <AF> the type of the address formula. |
| 67 | + * @param <VF> the type of the value formula. |
| 68 | + * @param <AT> the type of the address formula type. |
| 69 | + * @param <VT> the type of the value formula type. |
| 70 | + * @param pAddressType the type of the address formula. |
| 71 | + * @param pValueType the type of the value formula. |
| 72 | + * @return a Boolean formula representing an empty heap. |
| 73 | + */ |
28 | 74 | <AF extends Formula, VF extends Formula, AT extends FormulaType<AF>, VT extends FormulaType<VF>> |
29 | | - BooleanFormula makeEmptyHeap(AT pAdressType, VT pValueType); |
| 75 | + BooleanFormula makeEmptyHeap(AT pAddressType, VT pValueType); |
30 | 76 |
|
| 77 | + /** |
| 78 | + * Creates a formula representing the "nil" element for a given address type. The "nil" element is |
| 79 | + * used to represent a null pointer or an unallocated memory address. |
| 80 | + * |
| 81 | + * @param <AF> the type of the address formula. |
| 82 | + * @param <AT> the type of the address formula type. |
| 83 | + * @param pAdressType the type of the address formula. |
| 84 | + * @return a formula representing the "nil" element for the given address type. |
| 85 | + */ |
31 | 86 | <AF extends Formula, AT extends FormulaType<AF>> AF makeNilElement(AT pAdressType); |
32 | 87 | } |
0 commit comments