@hobin/developer 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -372
- package/REFERENCE_ROUTING.md +243 -0
- package/extensions/compaction-language.ts +303 -0
- package/extensions/developer.ts +607 -20
- package/extensions/machine.ts +45 -0
- package/extensions/references/behavior-preserving-structural-change.md +87 -8
- package/extensions/skills.ts +330 -52
- package/extensions/state.ts +227 -2
- package/package.json +9 -3
- package/skills/abstraction-review/SKILL.md +37 -23
- package/skills/abstraction-review/reference-policy.json +66 -0
- package/skills/abstraction-review/references/field-card.md +113 -168
- package/skills/abstraction-review/references/repair-table.md +66 -80
- package/skills/abstraction-review/references/worked-examples.md +79 -256
- package/skills/model/SKILL.md +31 -13
- package/skills/model/reference-policy.json +96 -0
- package/skills/model/references/contract-and-replacement-models.md +112 -0
- package/skills/model/references/logic-query-semantics.md +89 -0
- package/skills/model/references/planning-models.md +75 -0
- package/skills/model/references/problem-modeling.md +143 -276
- package/skills/model/references/proof-obligations.md +71 -0
- package/skills/model/references/relational-constraint-models.md +110 -0
- package/skills/model/references/solver-result-boundaries.md +83 -0
- package/skills/model/references/temporal-behavior-models.md +106 -0
- package/skills/naming-judgment/SKILL.md +17 -4
- package/skills/naming-judgment/reference-policy.json +29 -0
- package/skills/naming-judgment/references/domain-naming.md +29 -10
- package/skills/schedule/SKILL.md +16 -6
- package/skills/schedule/reference-policy.json +29 -0
- package/skills/schedule/references/structural-change-timing.md +81 -18
- package/skills/signal/SKILL.md +17 -6
- package/skills/signal/reference-policy.json +29 -0
- package/skills/signal/references/structural-movement.md +87 -14
- package/skills/sketch/SKILL.md +38 -42
- package/skills/sketch/reference-policy.json +212 -0
- package/skills/sketch/references/accumulator-invariants.md +125 -0
- package/skills/sketch/references/closure-and-conventional-interfaces.md +87 -0
- package/skills/sketch/references/composition-by-wishes.md +69 -0
- package/skills/sketch/references/data-driven-design.md +99 -22
- package/skills/sketch/references/data-shape-template-catalog.md +58 -19
- package/skills/sketch/references/design-levels-and-boundaries.md +133 -0
- package/skills/sketch/references/earned-abstraction.md +75 -0
- package/skills/sketch/references/generative-recursion.md +122 -0
- package/skills/sketch/references/generic-dispatch-systems.md +75 -0
- package/skills/sketch/references/language-semantics.md +82 -0
- package/skills/sketch/references/meaning-preserving-conversions.md +69 -0
- package/skills/sketch/references/process-shape-and-resources.md +157 -0
- package/skills/sketch/references/representation-barriers.md +73 -0
- package/skills/sketch/references/responsibility-and-collaboration.md +108 -0
- package/skills/sketch/references/runtime-and-compilation.md +84 -0
- package/skills/sketch/references/selection-and-creation.md +76 -0
- package/skills/sketch/references/state-history-and-order.md +126 -0
- package/skills/sketch/references/type-transitions.md +54 -0
- package/skills/sketch/references/variation-roles.md +59 -0
- package/skills/verify/SKILL.md +17 -6
- package/skills/verify/reference-policy.json +30 -0
- package/skills/verify/references/verifier-selection-and-pass-but-wrong.md +152 -192
- package/SOURCES.md +0 -104
- package/skills/abstraction-review/references/recipe-cards.md +0 -322
- package/skills/model/references/worked-models-and-specialized-techniques.md +0 -218
- package/skills/sketch/references/abstraction-barriers-and-closure.md +0 -160
- package/skills/sketch/references/abstraction-composition-and-state.md +0 -184
- package/skills/sketch/references/composition-generative-recursion-and-accumulators.md +0 -196
- package/skills/sketch/references/generic-operations-and-languages.md +0 -134
- package/skills/sketch/references/processes-state-and-time.md +0 -171
- package/skills/sketch/references/responsibility-and-variation.md +0 -245
|
@@ -1,333 +1,200 @@
|
|
|
1
|
-
# Problem Modeling
|
|
1
|
+
# Problem Modeling
|
|
2
2
|
|
|
3
|
-
Use this reference when
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Use this reference when prose and isolated examples no longer expose the whole
|
|
4
|
+
condition space under judgment. It extends `model` at the point where dimensions,
|
|
5
|
+
rules, and forbidden cases must become explicit. It does not select an API,
|
|
6
|
+
implementation, verifier, or specialized formal tool.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
Model only the condition space under judgment:
|
|
8
|
+
## Judgment Spine
|
|
10
9
|
|
|
11
10
|
```text
|
|
12
|
-
|
|
13
|
-
->
|
|
14
|
-
->
|
|
15
|
-
->
|
|
16
|
-
-> guarantee owners
|
|
17
|
-
-> counterexamples and verification targets
|
|
11
|
+
uncertainty
|
|
12
|
+
-> admitted domain and distinctions
|
|
13
|
+
-> predicates, rules, and forbidden combinations
|
|
14
|
+
-> assumptions and policy gaps
|
|
15
|
+
-> guarantee owners and counterexample targets
|
|
18
16
|
```
|
|
19
17
|
|
|
20
|
-
The model is
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Lower Prose Into Logic
|
|
25
|
-
|
|
26
|
-
Translate requirement language before choosing a representation:
|
|
18
|
+
The model is complete enough when every consequential distinction changes a rule,
|
|
19
|
+
forbidden case, owner, or check. Extra detail that changes none of those is not a
|
|
20
|
+
better model.
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
2. Judgments become predicates: `canEdit`, `isValidTransition`, `isReady`.
|
|
30
|
-
3. Quantity words become scoped quantifiers: all, some, none, exactly one.
|
|
31
|
-
4. Conditional words become implications: if, only if, unless, whenever.
|
|
32
|
-
5. `P => Q` becomes the counterexample to exclude: `P && !Q`.
|
|
33
|
-
6. Finite combinations become decision spaces.
|
|
34
|
-
7. Time words become actions, transitions, safety, or progress questions.
|
|
35
|
-
8. Preferences become objectives only after hard constraints are separated.
|
|
36
|
-
9. Reasonable stakeholder choices remain open policy questions.
|
|
22
|
+
## Lower Prose Into Decisions
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
*after*, *retry*, and *timeout* are often where the real requirement lives.
|
|
24
|
+
Translate requirement language before choosing notation:
|
|
40
25
|
|
|
41
|
-
|
|
26
|
+
1. nouns identify domains and facts;
|
|
27
|
+
2. judgments become predicates such as `canEdit` or `isReady`;
|
|
28
|
+
3. quantity words become scoped quantifiers;
|
|
29
|
+
4. conditional words become implications;
|
|
30
|
+
5. `P => Q` exposes the forbidden counterexample `P && !Q`;
|
|
31
|
+
6. finite combinations become partitions or decision tables;
|
|
32
|
+
7. time words identify a possible temporal handoff;
|
|
33
|
+
8. preferences remain separate from hard constraints;
|
|
34
|
+
9. stakeholder choices remain visible rather than being guessed.
|
|
42
35
|
|
|
43
|
-
A
|
|
44
|
-
|
|
36
|
+
A predicate states a relationship, not how to compute it. Mark abstract terms and
|
|
37
|
+
state the domain and nesting order of every quantifier. If `all qualifying items`
|
|
38
|
+
must not pass on an empty set, add the required existence condition explicitly.
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
- short-circuiting and evaluation order;
|
|
48
|
-
- exceptions, side effects, mutation, and non-termination;
|
|
49
|
-
- equality, identity, and collection semantics;
|
|
50
|
-
- floating-point, overflow, null, and missing-value behavior;
|
|
51
|
-
- whether a set-like mathematical model is actually represented by an ordered or
|
|
52
|
-
duplicate-preserving collection.
|
|
40
|
+
## Keep Logic And Runtime Distinct
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
A truth-preserving rewrite is not automatically a behavior-preserving program
|
|
43
|
+
rewrite. Record the observers that can distinguish it:
|
|
56
44
|
|
|
57
|
-
|
|
45
|
+
- coercion, equality, identity, and collection multiplicity;
|
|
46
|
+
- short-circuit demand and evaluation order;
|
|
47
|
+
- effects, exceptions, mutation, and non-termination;
|
|
48
|
+
- null, missing, false-like, and legacy values;
|
|
49
|
+
- numeric range, exactness, rounding, overflow, and underflow;
|
|
50
|
+
- time, storage, and resource behavior when they are part of the claim.
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type excludes values; a decidable model excludes expressions its checker cannot
|
|
62
|
-
handle.
|
|
52
|
+
Use logic to state intended relations. A later sketch or verification must still
|
|
53
|
+
show that the implementation model preserves them.
|
|
63
54
|
|
|
64
|
-
|
|
55
|
+
## Choose The Smallest Sufficient Model
|
|
65
56
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
| Uncertainty | Model view | Handoff when it becomes consequential |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| finite roles, flags, statuses, or defaults | predicates and a partition table | remain here while the complete finite surface is visible |
|
|
60
|
+
| caller/callee obligations or compatibility | contract and replacement relation | [Contract And Replacement Models](contract-and-replacement-models.md) |
|
|
61
|
+
| entities, intervals, and cross-record facts | relational constraints | [Relational Constraint Models](relational-constraint-models.md) |
|
|
62
|
+
| retry, lifecycle, concurrency, or allowed histories | transition and temporal behavior | [Temporal Behavior Models](temporal-behavior-models.md) |
|
|
63
|
+
| deductive implementation-conformance claim | proof obligations | [Proof Obligations](proof-obligations.md) |
|
|
64
|
+
| bounded counterexample, satisfiability, feasibility, or optimization status | solver-result boundary | [Solver Result Boundaries](solver-result-boundaries.md) |
|
|
65
|
+
| inference, answer multiplicity, negation, or query search | logic-query semantics | [Logic Query Semantics](logic-query-semantics.md) |
|
|
66
|
+
| legal action sequence toward a goal | planning model | [Planning Models](planning-models.md) |
|
|
67
|
+
| product-owned choice | human decision surface | return an explicit open question |
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
Use more than one view only when each answers a different unresolved question.
|
|
70
|
+
Do not model the whole product because one rule is difficult.
|
|
73
71
|
|
|
74
|
-
##
|
|
72
|
+
## Ability And Guarantee
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
| --- | --- | --- |
|
|
78
|
-
| vague boolean or conditional rule | predicates, quantified sets, implication counterexamples | exact domain, scope, and failure shape |
|
|
79
|
-
| function or API composition | contracts | caller obligations and callee guarantees |
|
|
80
|
-
| refactor, upgrade, schema, or API replacement | replacement model | which old guarantees and accepted inputs must survive |
|
|
81
|
-
| finite role/status/flag combinations | decision table | missing, overlapping, or contradictory cases |
|
|
82
|
-
| entities and relationships | domain/relational model | possible instances, impossible combinations, and assumptions |
|
|
83
|
-
| state, retry, concurrency, lifecycle | transition/temporal model | valid histories, safety, progress, stale events |
|
|
84
|
-
| allocation, planning, configuration | constraints plus objective | valid solutions versus preferred solutions |
|
|
85
|
-
| hard satisfaction or counterexample search | solver encoding | satisfiability, counterexamples, or optimal solutions |
|
|
86
|
-
| stakeholder-dependent behavior | human decision surface | choices the model must not invent |
|
|
87
|
-
|
|
88
|
-
Use multiple views when the task genuinely mixes shapes. Do not model the whole
|
|
89
|
-
product merely because one rule is complicated.
|
|
90
|
-
|
|
91
|
-
For complete, runnable-shaped examples of boolean policy, relational data,
|
|
92
|
-
temporal behavior, proof boundaries, solvers, logic programming, and planning,
|
|
93
|
-
read [Worked Models And Specialized Techniques](worked-models-and-specialized-techniques.md).
|
|
94
|
-
The examples are selected by uncertainty; they are not a mandatory progression.
|
|
95
|
-
|
|
96
|
-
## Statements, Specifications, And Tests
|
|
97
|
-
|
|
98
|
-
A stronger statement implies more statements and excludes more implementations.
|
|
99
|
-
A total specification describes all required behavior; most practical tests check
|
|
100
|
-
partial specifications because complete behavior is too complex or because a
|
|
101
|
-
smaller property localizes failures better.
|
|
102
|
-
|
|
103
|
-
Combine evidence deliberately:
|
|
104
|
-
|
|
105
|
-
- examples make product cases concrete;
|
|
106
|
-
- domain properties express rules specific to the product;
|
|
107
|
-
- structural properties express reusable shapes such as valid output, idempotence,
|
|
108
|
-
monotonicity, membership, or preservation;
|
|
109
|
-
- metamorphic relations compare several executions when the exact output is hard
|
|
110
|
-
to know;
|
|
111
|
-
- generators define the valid input domain for property tests;
|
|
112
|
-
- counterexample shrinking turns a broad failure into a diagnostic case.
|
|
113
|
-
|
|
114
|
-
A strong passing property gives breadth of confidence. A weak failing property
|
|
115
|
-
may provide better localization. Prefer several meaningful partial specifications
|
|
116
|
-
over one opaque assertion that cannot explain what failed.
|
|
117
|
-
|
|
118
|
-
## Contracts And Composition
|
|
119
|
-
|
|
120
|
-
Model a callable as:
|
|
74
|
+
Every restriction removes an ability while gaining a guarantee:
|
|
121
75
|
|
|
122
76
|
```text
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
77
|
+
restriction:
|
|
78
|
+
guarantee gained:
|
|
79
|
+
ability lost:
|
|
80
|
+
product evidence that the loss is acceptable:
|
|
126
81
|
```
|
|
127
82
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
83
|
+
A set removes order and duplicates. A narrow type removes representable values. A
|
|
84
|
+
read-only capability removes writes. A decidable language removes expressions.
|
|
85
|
+
Do not call a narrower model better until the excluded ability is known not to be
|
|
86
|
+
required.
|
|
132
87
|
|
|
133
|
-
|
|
134
|
-
values and are usually cheaper to check but less expressive. Runtime assertions,
|
|
135
|
-
validation, tests, properties, and proofs cover different parts of a semantic
|
|
136
|
-
contract. An unchecked contract can still aid reasoning, but it is not evidence.
|
|
88
|
+
## Finite Partitions And Defaults
|
|
137
89
|
|
|
138
|
-
|
|
90
|
+
A decision table is justified only when every dimension has a finite, pairwise
|
|
91
|
+
disjoint, exhaustive partition. Row count is evidence only after those conditions
|
|
92
|
+
hold. A structurally valid table can still encode the wrong policy, so ambiguous
|
|
93
|
+
rows remain human-owned.
|
|
139
94
|
|
|
140
|
-
|
|
95
|
+
For absence-sensitive values, distinguish at least:
|
|
141
96
|
|
|
142
97
|
```text
|
|
143
|
-
|
|
144
|
-
new.Post => old.Post
|
|
98
|
+
missing | undefined | null | empty | false-like | defaulted | legacy | invalid
|
|
145
99
|
```
|
|
146
100
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Observable behavior outside the declared contract may still be depended on in
|
|
152
|
-
real systems. Inspect actual callers, persisted data, tests, telemetry, and known
|
|
153
|
-
bugs before claiming compatibility. Logical replaceability is necessary evidence,
|
|
154
|
-
not a complete social or operational guarantee.
|
|
155
|
-
|
|
156
|
-
For representation changes, define an abstraction or refinement mapping from the
|
|
157
|
-
new representation back to the old model. A change is safe only if relevant new
|
|
158
|
-
states or behaviors map to valid old ones.
|
|
101
|
+
State which distinctions survive normalization, the single owner of the default,
|
|
102
|
+
and a counterexample where applying the default in another layer changes meaning.
|
|
103
|
+
A fallback expression is product policy when callers can observe it.
|
|
159
104
|
|
|
160
|
-
##
|
|
105
|
+
## Prediction, Observation, And Refinement
|
|
161
106
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
everything the product needs or that environmental assumptions hold.
|
|
165
|
-
|
|
166
|
-
For proof-shaped work, write:
|
|
107
|
+
Use the simplest representation that preserves the facts required for the current
|
|
108
|
+
prediction:
|
|
167
109
|
|
|
168
110
|
```text
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
assumptions outside the model
|
|
111
|
+
model + assumptions
|
|
112
|
+
-> predicted case or transition
|
|
113
|
+
-> observation
|
|
114
|
+
-> discrepancy
|
|
115
|
+
-> one explicit model refinement
|
|
175
116
|
```
|
|
176
117
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Tests, runtime validation, model checking, theorem proving, and static types make
|
|
180
|
-
different guarantees; do not label one as another.
|
|
181
|
-
|
|
182
|
-
## Decision Tables
|
|
183
|
-
|
|
184
|
-
Use a decision table only when:
|
|
185
|
-
|
|
186
|
-
1. independent inputs map clearly to outputs;
|
|
187
|
-
2. each input can be partitioned into a small finite set;
|
|
188
|
-
3. a table is clearer than an equation, invariant, or transition model;
|
|
189
|
-
4. the expanded table remains reviewable.
|
|
190
|
-
|
|
191
|
-
A table is complete when no input combination is missing and sound when the same
|
|
192
|
-
input does not map to conflicting outputs. Those properties make the table valid,
|
|
193
|
-
not necessarily correct. A valid table can still encode misunderstood product
|
|
194
|
-
policy; return ambiguous rows to a human owner.
|
|
195
|
-
|
|
196
|
-
Avoid tables for strongly dependent inputs, unbounded collections, recursion,
|
|
197
|
-
long-running side effects, or rules better expressed by precedence such as
|
|
198
|
-
`flags > user settings > defaults`.
|
|
199
|
-
|
|
200
|
-
## Absence And Defaults
|
|
201
|
-
|
|
202
|
-
For optional, nullable, configurable, inherited, persisted, or externally supplied
|
|
203
|
-
values, model absence before design:
|
|
118
|
+
A discrepancy may locate an implementation defect, an omitted fact, an external
|
|
119
|
+
drift, or a mistaken purpose. Keep these explanations separate.
|
|
204
120
|
|
|
205
|
-
|
|
206
|
-
- whether missing, `undefined`, `null`, empty, and false-like values differ;
|
|
207
|
-
- the domain default and the one boundary that owns it;
|
|
208
|
-
- legacy and serialized shapes;
|
|
209
|
-
- whether normalization preserves source distinctions needed later;
|
|
210
|
-
- a counterexample showing the default applied in the wrong layer.
|
|
121
|
+
Distinguish enforceable internal consistency from environmental observation:
|
|
211
122
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
- **decision**: may be true or false across valid instances;
|
|
220
|
-
- **property**: must hold or the model/design is wrong;
|
|
221
|
-
- **assumption**: defines the well-behaved instances for which the property is
|
|
222
|
-
meaningful.
|
|
223
|
-
|
|
224
|
-
Explore unusual valid instances even after properties pass. A checker verifies
|
|
225
|
-
consequences of the model; it cannot tell whether omitted real-world facts should
|
|
226
|
-
have been modeled.
|
|
227
|
-
|
|
228
|
-
Use a temporal model when correct snapshots are insufficient. State:
|
|
229
|
-
|
|
230
|
-
- initial states;
|
|
231
|
-
- actions and allowed next states;
|
|
232
|
-
- unchanged state for each action;
|
|
233
|
-
- safety properties that must always hold;
|
|
234
|
-
- progress/fairness properties that must eventually hold;
|
|
235
|
-
- stale, duplicated, reordered, retried, or concurrent events.
|
|
236
|
-
|
|
237
|
-
A concrete implementation refines an abstract system only when each observable
|
|
238
|
-
implementation behavior is allowed by the abstract specification, possibly after
|
|
239
|
-
an explicit refinement mapping. This catches gaps such as intermediate states
|
|
240
|
-
that users can observe even though an abstract operation looked atomic.
|
|
241
|
-
|
|
242
|
-
## Constraints, Objectives, And Solvers
|
|
243
|
-
|
|
244
|
-
For solver-shaped work, separate:
|
|
245
|
-
|
|
246
|
-
- variables and domains;
|
|
247
|
-
- hard constraints;
|
|
248
|
-
- an optional objective or ranking;
|
|
249
|
-
- acceptable equivalence among solutions;
|
|
250
|
-
- model assumptions and encoding limits.
|
|
251
|
-
|
|
252
|
-
Use the least specialized tool that is still economical to model, then specialize
|
|
253
|
-
when runtime or scale requires it. General solvers make new constraints easy but
|
|
254
|
-
can be much slower than bespoke algorithms. A solver result of `unknown` is not
|
|
255
|
-
proof of satisfaction or impossibility. Solver output is evidence only to the
|
|
256
|
-
extent that the encoding matches the product problem.
|
|
257
|
-
|
|
258
|
-
## Logic Programming And Planning
|
|
259
|
-
|
|
260
|
-
Logic programming is useful when facts, relations, and inference rules are more
|
|
261
|
-
natural than a fixed control flow. State facts, derived rules, query variables,
|
|
262
|
-
negation meaning, duplicate behavior, search order, and termination. A more
|
|
263
|
-
expressive query language may lose termination guarantees; a restricted system
|
|
264
|
-
may be the better product boundary.
|
|
123
|
+
```text
|
|
124
|
+
internal invariant: transition the modeled owner can enforce
|
|
125
|
+
external relation: correspondence observed at a time
|
|
126
|
+
drift signal: evidence the correspondence may no longer hold
|
|
127
|
+
mitigation: revalidate, narrow use, revise the model, or accept bounded failure
|
|
128
|
+
```
|
|
265
129
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if every intermediate state satisfies the invariant. An optimal plan is optimal
|
|
269
|
-
only for the encoded cost function.
|
|
130
|
+
A health check or compatibility probe cannot permanently force the environment
|
|
131
|
+
to remain aligned.
|
|
270
132
|
|
|
271
133
|
## Place Guarantees Deliberately
|
|
272
134
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
- `type` for representable-state restrictions;
|
|
276
|
-
- `contract` for caller/callee semantics;
|
|
277
|
-
- `runtime validation` for hostile or external inputs;
|
|
278
|
-
- `database constraint` for persisted relational facts;
|
|
279
|
-
- `assertion` for internal facts already expected to hold;
|
|
280
|
-
- `example/integration test` for concrete behavior;
|
|
281
|
-
- `property test` for a generatable valid domain;
|
|
282
|
-
- `model check/solver/proof` for exhaustive or high-risk relationships;
|
|
283
|
-
- `human decision` for policy rather than derivable fact.
|
|
135
|
+
For every important rule, name the cheapest trustworthy owner and evidence target:
|
|
284
136
|
|
|
285
|
-
|
|
286
|
-
|
|
137
|
+
- type for representable-state restrictions;
|
|
138
|
+
- constructor or runtime validation for hostile input;
|
|
139
|
+
- contract for caller/callee meaning;
|
|
140
|
+
- database constraint for persisted relational facts;
|
|
141
|
+
- state transition owner for history-sensitive rules;
|
|
142
|
+
- example or integration check for concrete behavior;
|
|
143
|
+
- property check for a declared generatable domain;
|
|
144
|
+
- model, solver, or proof for bounded exhaustive relationships;
|
|
145
|
+
- human decision for policy.
|
|
287
146
|
|
|
288
|
-
|
|
147
|
+
An unchecked statement may guide design, but it is not evidence.
|
|
289
148
|
|
|
290
|
-
|
|
149
|
+
## Model Artifact
|
|
291
150
|
|
|
292
151
|
```text
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
152
|
+
Question under judgment:
|
|
153
|
+
Domain and admitted values:
|
|
154
|
+
Dimensions and distinctions:
|
|
155
|
+
Predicates and rules:
|
|
156
|
+
Forbidden cases or transitions:
|
|
157
|
+
Decisions / properties / assumptions:
|
|
158
|
+
Ability gained and lost:
|
|
159
|
+
Guarantee owner and evidence target:
|
|
160
|
+
Counterexamples:
|
|
161
|
+
Human-owned unknowns:
|
|
162
|
+
Specialized handoff, if any:
|
|
299
163
|
```
|
|
300
164
|
|
|
301
|
-
|
|
302
|
-
runtime semantics.
|
|
165
|
+
## Stop And Separation
|
|
303
166
|
|
|
304
|
-
|
|
167
|
+
Stop when the admitted space, rules, forbidden cases, assumptions, owners, and
|
|
168
|
+
counterexamples are explicit enough to constrain a later design.
|
|
305
169
|
|
|
306
|
-
|
|
170
|
+
Separate rather than expanding this reference when:
|
|
307
171
|
|
|
308
|
-
-
|
|
309
|
-
-
|
|
310
|
-
-
|
|
311
|
-
-
|
|
312
|
-
|
|
313
|
-
- stateful rules cover transitions, not only enums;
|
|
314
|
-
- replacements state old/new contract relationships;
|
|
315
|
-
- every guarantee has an owner and evidence target;
|
|
316
|
-
- unresolved policy remains visible rather than being guessed.
|
|
172
|
+
- a public operation, ownership map, or caller shape must be invented (`sketch`);
|
|
173
|
+
- an existing structural candidate must be approved (`abstraction-review`);
|
|
174
|
+
- an implementation claim needs evidence (`verify`);
|
|
175
|
+
- a specialized contract, temporal, relational, proof, solver, logic, or planning
|
|
176
|
+
obligation has its own artifact and stop check (use the routed reference above).
|
|
317
177
|
|
|
318
178
|
## Source Trace
|
|
319
179
|
|
|
320
|
-
- Hillel Wayne, *Logic for Programmers*,
|
|
321
|
-
|
|
322
|
-
specifications,
|
|
323
|
-
|
|
180
|
+
- Hillel Wayne, *Logic for Programmers*, v0.14.0, 2026-05-04:
|
|
181
|
+
Chapters 2-4, pp. 5-46, for predicates, quantifiers, ability/guarantee,
|
|
182
|
+
specifications, and logic/runtime boundaries. Recorded beta defects are
|
|
183
|
+
excluded.
|
|
324
184
|
- Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram
|
|
325
|
-
Krishnamurthi, *How to Design Programs
|
|
326
|
-
|
|
327
|
-
|
|
185
|
+
Krishnamurthi, *How to Design Programs*, living build 9.2.0.3:
|
|
186
|
+
Preface,
|
|
187
|
+
Chapter 19,
|
|
188
|
+
Chapter 20,
|
|
189
|
+
and Intermezzo 4
|
|
190
|
+
for interpretation, simplest sufficient representations, prediction,
|
|
191
|
+
discrepancy, refinement, and numeric assumptions.
|
|
328
192
|
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
329
|
-
Interpretation of Computer Programs*, Second Edition
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
193
|
+
Interpretation of Computer Programs*, Second Edition:
|
|
194
|
+
Section 2.1
|
|
195
|
+
and Section 3.1
|
|
196
|
+
for abstraction mappings, state, identity, and history-sensitive meaning.
|
|
197
|
+
- Zachary Tellman, *Elements of Clojure*, Leanpub 2019-02-11:
|
|
198
|
+
Indirection, public-manuscript pp. 70-89, for model/environment distinctions,
|
|
199
|
+
assumptions, observation, drift, and environment-relative usefulness. Broad
|
|
200
|
+
proof rhetoric and language-specific idioms are not imported as general laws.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Proof Obligations
|
|
2
|
+
|
|
3
|
+
Use this reference when the model must state what a proof establishes about an
|
|
4
|
+
implementation under explicit assumptions.
|
|
5
|
+
|
|
6
|
+
## Specification Relative Proof
|
|
7
|
+
|
|
8
|
+
Write:
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
preconditions
|
|
12
|
+
postconditions
|
|
13
|
+
invariant for repeated control
|
|
14
|
+
initialization
|
|
15
|
+
preservation
|
|
16
|
+
conclusion
|
|
17
|
+
termination argument when total correctness is claimed
|
|
18
|
+
arithmetic and runtime model
|
|
19
|
+
assumptions outside the model
|
|
20
|
+
trusted tool boundary
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
A proof can be valid while the specification omits product meaning, performance,
|
|
24
|
+
effects, or environmental assumptions. Keep partial correctness, termination, and
|
|
25
|
+
resource claims separate.
|
|
26
|
+
|
|
27
|
+
## Worked Shape
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
qr(x, y) -> (q, r)
|
|
31
|
+
requires: x >= 0 && y > 0
|
|
32
|
+
ensures: q * y + r == x; 0 <= r < y
|
|
33
|
+
|
|
34
|
+
invariant: q * y + r == x
|
|
35
|
+
measure: r decreases by positive y
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The argument assumes mathematical integers. Overflow or a missing performance
|
|
39
|
+
claim can invalidate the product judgment without invalidating this relation.
|
|
40
|
+
|
|
41
|
+
## Artifact
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Claim and specification:
|
|
45
|
+
Preconditions and admitted domain:
|
|
46
|
+
Invariant:
|
|
47
|
+
Initialization, preservation, and conclusion:
|
|
48
|
+
Termination argument:
|
|
49
|
+
Arithmetic/runtime assumptions:
|
|
50
|
+
Trusted boundary:
|
|
51
|
+
Observers outside the proof:
|
|
52
|
+
Residual and verification target:
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Stop And Separation
|
|
56
|
+
|
|
57
|
+
Stop when initialization, preservation, conclusion, and any termination argument
|
|
58
|
+
support exactly the stated specification and every omitted observer is explicit.
|
|
59
|
+
|
|
60
|
+
Use `solver-result-boundaries` for bounded model or optimization status. Hand off
|
|
61
|
+
to `verify` when execution, source/tool provenance, or relevance of proof evidence
|
|
62
|
+
must be judged.
|
|
63
|
+
|
|
64
|
+
## Source Trace
|
|
65
|
+
|
|
66
|
+
- Hillel Wayne, *Logic for Programmers*, v0.14.0:
|
|
67
|
+
Chapter 6, pp. 61-72, for pre/postconditions, invariants, termination, and proof
|
|
68
|
+
limits. Recorded arithmetic and exercise defects are excluded.
|
|
69
|
+
- Matthias Felleisen et al., *How to Design Programs*, living build 9.2.0.3,
|
|
70
|
+
Chapter 28
|
|
71
|
+
for numerical-method assumptions and progress obligations.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Relational Constraint Models
|
|
2
|
+
|
|
3
|
+
Use this reference when correctness concerns possible combinations of entities,
|
|
4
|
+
intervals, records, or facts rather than one directional computation.
|
|
5
|
+
|
|
6
|
+
## Relation Before Procedure
|
|
7
|
+
|
|
8
|
+
State the admitted domains and relationship without choosing an execution
|
|
9
|
+
direction:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Employee(id)
|
|
13
|
+
Department(id)
|
|
14
|
+
Management(employeeId, departmentId, start, end?)
|
|
15
|
+
|
|
16
|
+
all m in Management:
|
|
17
|
+
exists Employee(m.employeeId)
|
|
18
|
+
exists Department(m.departmentId)
|
|
19
|
+
m.end is absent || m.start < m.end
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Classify each predicate:
|
|
23
|
+
|
|
24
|
+
- **decision** may vary across valid instances;
|
|
25
|
+
- **property** must hold for every admitted instance;
|
|
26
|
+
- **assumption** limits the instances for which the property is claimed.
|
|
27
|
+
|
|
28
|
+
A relation can receive information from several directions. Use a propagation
|
|
29
|
+
network only when bidirectional assertion, retraction, provenance, and conflict
|
|
30
|
+
behavior are real requirements. A normal function is clearer when direction is
|
|
31
|
+
fixed.
|
|
32
|
+
|
|
33
|
+
## Quantified Integrity
|
|
34
|
+
|
|
35
|
+
For uniqueness, overlap, containment, or reachability rules, state:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
quantified domains
|
|
39
|
+
identity and equality
|
|
40
|
+
interval endpoint convention
|
|
41
|
+
existence requirements
|
|
42
|
+
allowed empty instances
|
|
43
|
+
conflict or contradiction result
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A checker can prove consequences of the encoded relation but cannot tell whether
|
|
47
|
+
the domain omitted a real entity, event, or exception.
|
|
48
|
+
|
|
49
|
+
## Runtime Translation Boundary
|
|
50
|
+
|
|
51
|
+
Mathematical relations and storage/query semantics differ. When translating to a
|
|
52
|
+
database or collection runtime, verify:
|
|
53
|
+
|
|
54
|
+
- closed, open, or half-open endpoint behavior;
|
|
55
|
+
- `NULL`, missing, and three-valued logic;
|
|
56
|
+
- set versus bag multiplicity;
|
|
57
|
+
- row identity and duplicate joins;
|
|
58
|
+
- every create/update/delete path that can violate the rule;
|
|
59
|
+
- transaction or locking scope for cross-row invariants.
|
|
60
|
+
|
|
61
|
+
A half-open interval is not SQL `BETWEEN`. A correct query does not enforce a
|
|
62
|
+
constraint on mutation paths it never observes.
|
|
63
|
+
|
|
64
|
+
## Worked Shape
|
|
65
|
+
|
|
66
|
+
Requirement: a department has at most one active manager at any instant.
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
all a, b in Management where a != b
|
|
70
|
+
&& a.departmentId == b.departmentId:
|
|
71
|
+
intervalsDoNotOverlap(a, b)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Exercise historical, current, future, open-ended, touching-boundary, overlapping,
|
|
75
|
+
and missing-reference instances. The enforcement owner may be an exclusion
|
|
76
|
+
constraint, serialized transaction, or application rule with locking; select it
|
|
77
|
+
only after the relation is accepted.
|
|
78
|
+
|
|
79
|
+
## Artifact
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
Domains and relations:
|
|
83
|
+
Decisions / properties / assumptions:
|
|
84
|
+
Quantified constraints:
|
|
85
|
+
Identity, equality, multiplicity, and endpoint conventions:
|
|
86
|
+
Known valid and invalid instances:
|
|
87
|
+
Runtime translation risks:
|
|
88
|
+
Contradiction behavior:
|
|
89
|
+
Guarantee owner and verification target:
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Stop And Separation
|
|
93
|
+
|
|
94
|
+
Stop when known valid and invalid instances differ for the stated reason and the
|
|
95
|
+
runtime translation obligations are explicit.
|
|
96
|
+
|
|
97
|
+
Hand off to `temporal-behavior-models` when histories rather than static instances
|
|
98
|
+
carry meaning, to `solver-result-boundaries` when bounded exhaustive status is
|
|
99
|
+
the claim, and to `sketch` when an enforcement surface must be designed.
|
|
100
|
+
|
|
101
|
+
## Source Trace
|
|
102
|
+
|
|
103
|
+
- Hillel Wayne, *Logic for Programmers*, v0.14.0:
|
|
104
|
+
Chapter 7, pp. 73-88, for relational integrity and SQL/model translation.
|
|
105
|
+
The recorded half-open/`BETWEEN` defect is excluded.
|
|
106
|
+
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, *Structure and
|
|
107
|
+
Interpretation of Computer Programs*, Second Edition:
|
|
108
|
+
Section 3.3.5
|
|
109
|
+
for multi-directional constraint propagation, informants, retraction, and
|
|
110
|
+
contradiction.
|