@@ -131,30 +131,28 @@ parsedTypesCorrect (TArray _) = Refl
131131parsedTypesCorrect (TInlineTable _ ) = Refl
132132parsedTypesCorrect (TTable _ ) = Refl
133133
134- ||| OWED: `isScalar`, `isTable`, and `isArray` are pairwise disjoint on
135- ||| `TOMLValue` constructors. The seven scalar constructors (`TString`,
136- ||| `TInt`, `TFloat`, `TBool`, `TDateTime`, `TDate`, `TTime`) make
137- ||| `isScalar val = True`; the same constructors all make
138- ||| `isTable val = False` and `isArray val = False` (see
139- ||| `src/Proven/SafeTOML/Types.idr` L376-L393). The two propositions
140- ||| therefore agree by exhaustive case-split on `val`.
141- |||
142- ||| Held back by Idris2 0.8.0 requiring an explicit ten-arm case-split
143- ||| on `val` to close the proof — for each scalar arm the
144- ||| `isScalar val = True` premise is already `Refl`, and the conclusion
145- ||| reduces to `not (False || False) = True` which is *also* `Refl`,
146- ||| but the three non-scalar arms (`TArray`, `TInlineTable`, `TTable`)
147- ||| make the premise `False = True`, requiring an `absurd`/`uninhabited`
148- ||| witness that the elaborator does not derive automatically from the
149- ||| `Bool` decision shape. Same shape as boj-server's class-J
150- ||| `Bool`-vs-`Prop` reflection gap (see SafetyLemmas `charEqSound`).
151- ||| Discharge once a reflective `Bool`-to-`Dec` lemma is wired up for
152- ||| derived enum-shaped predicates, or by hand-writing the ten-arm
153- ||| case-split with one `Refl` per arm and `absurd Refl` for the three
154- ||| `True = False` branches.
155- 0 isScalarCorrect : (val : TOMLValue) ->
156- isScalar val = True ->
157- not (isTable val || isArray val) = True
134+ ||| DISCHARGED via 10-arm case-split: the 7 scalar arms (`TString`,
135+ ||| `TInt`, `TFloat`, `TBool`, `TDateTime`, `TDate`, `TTime`) close by
136+ ||| `Refl` since the goal `not (isTable val || isArray val) = True`
137+ ||| reduces to `not (False || False) = True` = `Refl`. The 3 container
138+ ||| arms (`TArray`, `TInlineTable`, `TTable`) have the premise
139+ ||| `isScalar val = True` reduce to `False = True` which is uninhabited
140+ ||| (`Refl impossible`). The OWED note correctly identified the
141+ ||| ten-arm discharge shape — just hadn't executed.
142+ public export
143+ isScalarCorrect : (val : TOMLValue) ->
144+ isScalar val = True ->
145+ not (isTable val || isArray val) = True
146+ isScalarCorrect (TString _ ) _ = Refl
147+ isScalarCorrect (TInt _ ) _ = Refl
148+ isScalarCorrect (TFloat _ ) _ = Refl
149+ isScalarCorrect (TBool _ ) _ = Refl
150+ isScalarCorrect (TDateTime _ ) _ = Refl
151+ isScalarCorrect (TDate _ ) _ = Refl
152+ isScalarCorrect (TTime _ ) _ = Refl
153+ isScalarCorrect (TArray _ ) Refl impossible
154+ isScalarCorrect (TInlineTable _ ) Refl impossible
155+ isScalarCorrect (TTable _ ) Refl impossible
158156
159157||| Theorem: Scalars cannot contain nested structures
160158export
0 commit comments