Balanced words through length 4Complete bounded membership · 31 candidates
The problem
List every balanced parenthesis word of length at most 4, including the empty word.
The checked result
Accepted words: 4.
A prefix can invalidate a word before its final symbol. The accepted list includes different nesting structures and concatenations, not only fully nested strings.
Why the checker accepts it
- Generate every parenthesis string up to the stated length.
- Scan each prefix and reject any negative balance.
- Accept only strings with terminal balance zero.
- Compare the complete accepted-word list and its cardinality.
Formal specification
{
"max_length": 4,
"alphabet": [
"(",
")"
],
"language": "Every prefix has nonnegative balance and the terminal balance is zero."
}Claim and evidence
{
"claim": {
"accepted_count": 4
},
"witness": {
"words": [
"",
"()",
"(())",
"()()"
]
}
}Dataset construction
Deterministic finite fixture; full enumeration or witness replay as stated. Structured JSON; field meanings are stated in the specification. Acceptance covers 31 checker units for this record; the unit type is stated in its verification scope.
Complexity and limits
A length bound n produces 2ⁿ⁺¹−1 candidate words; each membership scan takes O(n).
This enumerates a bounded language slice; it is not a grammar-equivalence theorem.
A boundary to investigate
Equal numbers of opening and closing symbols do not guarantee proper nesting. Add context-free grammar membership, CYK charts, and parse-tree certificates.