You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor `set` / `get` / `hasKey` / `remove` to use a `DecEq String`
key carrier (`lookupObj` / `updateObj` / `removeObj`) instead of the
prior `(==)` / `(/=)` / `lookup` / `filter` chain. Runtime semantics
identical (both bottom out at `prim__eq_String`); the win is that
`decEq`'s `Yes`/`No` arms expose structural proofs the discharge
lemmas can pattern-match on.
DISCHARGED (Family A — the 4 object-key OWEDs from proven#119 audit):
- **setGetIdentity**: `get k (set k v (JsonObject obj)) = Just v`
— by induction on `obj`, using `lookupObjConsRefl` on match and
`lookupObjConsSkip` + IH on non-match.
- **setPreservesOther**: `Not (k1 = k2) -> get k2 (set k1 v ...) =
get k2 ...` — by induction + 4-way case-split on
`decEq k1 k'` × `decEq k2 k'`. New helper `lookupObjConsCong`
lifts the IH through a cons-cell in the No-No branch (the
Yes-Yes / Yes-No / No-Yes branches close more directly with
`lookupObjConsSkip` and `Refl`). Type strengthened to take
`obj : List (String, JsonValue)` (was `obj : JsonValue`) — old
form was vacuously trivial for non-`JsonObject` values; new form
carries the actual invariant.
- **setHasKey**: by `cong isJust (setGetIdentity ...)`. Type also
strengthened from `obj : JsonValue + isObject obj = True` to
concrete object body.
- **removeNotHasKey**: by `cong isJust (removeLookupNothing ...)`,
where `removeLookupNothing` is a new top-level lemma proving
`lookupObj k (removeObj k xs) = Nothing` by induction. Type
strengthened (same pattern).
Helper lemmas added at top of Proofs.idr:
* `lookupObjConsRefl` : reflexive head match returns the head
* `lookupObjConsSkip` : non-matching head skips
* `lookupObjConsCong` : cong lifting through cons
* `removeLookupNothing` : remove-then-lookup misses
Net: 4 OWEDs cleared, +4 reusable helper lemmas, zero
`believe_me`/`postulate`/`idris_crash`. Refactor preserves the
`set : String -> JsonValue -> JsonValue -> JsonValue` API.
Empirical reduction verified at `/tmp/charrefl/src/TestDecEq.idr`
(prototype with full proofs of all 4 OWED shapes). Note on
local-vs-CI: `appendLengthInc` (merged in PR #127) still trips a
`Data.List.Quantifiers` name-resolution quirk in the local contrib
install; does NOT reproduce in CI.
Refs proven#90 (Phase 3 OWED triage), proven#107 (overly-cautious
OWED meta), proven#119 (paths-forward — this is Family A
implementing the "rewrite update/lookup onto DecEq carrier" path).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments