ColorWheel generates five-color HSL palettes that satisfy mood-based saturation/lightness bounds and harmony-based hue patterns. The invariant is maintained by aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/metareflection/dafny-replay/llms.txt
Use this file to discover all available pages before exploring further.
Normalize function that falls back to Custom mood or harmony when a user adjustment would otherwise violate the constraints. The app also demonstrates a deliberate separation between spec and proof to prevent LLM-generated proofs from silently weakening the specification.
Domain model
Key invariants
The invariant is defined inColorWheelSpec.dfy:
Custom, every color’s saturation and lightness must fall within that mood’s bounds. For example, Vibrant requires S ≥ 70 and 40 ≤ L ≤ 60.
Harmony Coherence — if the current harmony is not Custom, the five hues must match the pattern computed from baseHue. Complementary produces hues at H₀ and H₀+180° plus three spread variations; Analogous produces five hues evenly spaced around H₀.
Graceful Degradation — when an adjustment (AdjustColor, AdjustPalette, SetColorDirect) would break either constraint, the model transitions to Custom mood or Custom harmony instead of failing. This is the graceful degradation property: the palette always remains valid.
Normalize repairs any violation
Apply can produce intermediate states that violate the invariant (for example, a palette palette with hues that no longer match the active harmony). Normalize repairs these by falling back to Custom:
Spec/proof separation
The ColorWheel domain splits its Dafny code across two files:ColorWheelSpec.dfy— user-facing types, predicates, and theApplyfunction. This file defines what the invariant is and what the actions do. It is kept separate so that an LLM assisting with proofs cannot quietly modify the spec to make proofs easier.ColorWheelProof.dfy— all lemmas, includingInitSatisfiesInvandStepPreservesInv.
PROVED.md file in the colorwheel/ directory records exactly what has been formally verified and what has been shipped without verification.
Actions
| Action | Description |
|---|---|
GeneratePalette | Generate a fresh five-color palette from a base hue, mood, harmony, and ten random seeds |
AdjustColor | Independently adjust one color’s H/S/L; auto-transitions to Custom if constraints break |
AdjustPalette | Shift all colors together (linked mode); auto-transitions to Custom mood if bounds break |
RegenerateMood | Replace S/L values to satisfy a new mood while keeping existing hues |
RegenerateHarmony | Replace hues to satisfy a new harmony while keeping existing S/L values |
RandomizeBaseHue | Pick a new base hue and regenerate the full palette |
SetColorDirect | Set one color to an exact value; preserves mood/harmony if possible |
Running the app
Replay kernel
ColorWheel uses the Replay kernel for local undo/redo with invariant preservation.
Guarantees reference
What is proved, what is trusted, and where the verification boundary lies.