syntax_verdict tool v0.1

STEP: 1532 / Test: 30/30 PASS / Lean 4: 4 theorem zero sorry / Type: STEP 1505 言語 2nd tool (47 defer 19 番目、 姉妹 tool 22)

Balanced brackets / nesting → syntactic well-formedness verdict。 () [] {} <> default supported。

6 case 決定表: 空 → ZERO / mismatched → FALSE / unbalanced nesting → FALSE / 3+ consecutive open → NEITHER (ambiguous) / 均衡 → TRUE (well_formed)。

決定表

ConditionVerdictReason
invalid (non-string)NEITHERinvalid_input
emptyZEROempty_input
mismatched (close before open)FALSEmismatched_brackets
unclosed / wrong type closeFALSEunbalanced_nesting
3+ consecutive same openNEITHERambiguous_parse
balancedTRUEwell_formed

使用例

syntaxVerdict({ input: '{[()]}' });
// { verdict: 'TRUE', reason: 'well_formed', maxNestingDepth: 3 }

syntaxVerdict({ input: '(]' });
// { verdict: 'FALSE', reason: 'unbalanced_nesting' }

syntaxVerdict({ input: '(' });
// { verdict: 'FALSE', reason: 'unbalanced_nesting' } (unclosed)

syntaxVerdict({ input: '((()))' });
// { verdict: 'NEITHER', reason: 'ambiguous_parse' } (3 consecutive open)

syntaxVerdict({ input: 'foo(bar[baz]qux)' });
// { verdict: 'TRUE' } (text with brackets)

syntaxVerdict({ input: 'hello world' });
// { verdict: 'TRUE' } (no brackets)

Lean 4 (4 theorem zero sorry)

syntax_no_brackets_gives_true    : 0 brackets → TRUE
syntax_unbalanced_gives_false    : open ≠ close → FALSE
syntax_ambiguous_gives_neither   : balanced + max_consec ≥ threshold → NEITHER
syntax_well_formed_gives_true    : balanced + max_consec < threshold → TRUE

Honest scope

❶ 簡易 bracket balance のみ、 real context-free grammar parsing 未 embed。

❂ Ambiguity detection は heuristic (3+ consecutive same open)、 real ambiguity classes (dangling else 等) 未 embed。

❸ 累計 defer 30 → 29 (STEP 1531 + 1532 で 2 tool 追加)。