1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
extern crate alloc;
use BOTTOM;
use crate;
/// A store of causally tagged state: the typed half of a causal pair
/// ([`Dotted`](crate::metis::Dotted)), holding content addressed by dots.
///
/// The crate's second deliberately open axis, after [`Gate`](crate::metis::Gate).
/// Minerva ships two *dot-shaped* instances: [`DotSet`] for bare presence and
/// [`DotMap`](crate::metis::DotMap) for caller-keyed composition. A
/// consumer whose store carries application values implements this trait for
/// its own type, keeping every payload and every application merge decision on
/// its own side of the boundary.
///
/// # The laws
///
/// These are what make [`Dotted::merge`](crate::metis::Dotted::merge)
/// converge. An implementation that breaks one breaks convergence two layers
/// up, so they are contract rather than guidance.
///
/// 1. *Support exactness.* [`dots`](Self::dots) enumerates exactly the dots
/// carried, each at most once; [`Default`] is bottom and
/// [`is_bottom`](Self::is_bottom) is true iff no state at all is carried.
/// Support emptiness and bottom are *distinct* facts for a store with a
/// recording plane beside its support
/// (`docs/metis-delta-context-law.adoc`). Across a composed shape a dot
/// appears under one place only, which [`DotMap`](crate::metis::DotMap)
/// enforces at insertion: a dot names one write, so straddling two keys
/// would break laws 2 and 3.
/// 2. *The survivor law.* In `self.causal_merge(sc, other, oc)`, a dot
/// survives iff it is in both stores, or in `self` and not covered by
/// `oc`, or in `other` and not covered by `sc`. Present in one store but
/// covered by the other side's context means *seen there and dropped*, so
/// the merge honours the drop rather than resurrecting. This is the one
/// law separating causal state from a plain union, and the point of the
/// axis.
/// 3. *Content follows the dot.* A surviving dot keeps whatever content the
/// shape attaches to it; the merge never invents, splits, or reassigns.
/// On the honest basis a dot names one write, so both sides carry equal
/// content and an implementation may keep either. The axis is
/// value-opaque, so this one is a *per-implementation* obligation no
/// generic conformance harness can reach. Test it against your own
/// accessors, as the in-tree suites do.
/// 4. *Semilattice on covered pairs.* Over states whose context covers their
/// store, `causal_merge` with the matching context merge is commutative,
/// associative, and idempotent, with the bottom pair as identity. Copy
/// the property-test shapes from `src/metis/tests/causal_store/`.
/// 5. *Restriction is fiber selection* (PRD 0013 R2).
/// [`restrict`](Self::restrict) keeps exactly the dots on the roster's
/// stations, with their content, and commutes with `causal_merge` under
/// restricted contexts.
/// The bare dot store: presence only, no content beyond the dots themselves.
///
/// The [`DotSet`] is both the *context* half of every causal pair and the
/// simplest store shape (the two roles are one lattice object, which is the
/// dotted-vector literature's own economy). As a store it models
/// enable-shaped state: a flag is on while any dot survives, off when every
/// minted dot has been superseded.