FAILURE MAP
← Case archive

FA-4061 / Parsing / Open access

An exponentiation chain builds a left-associated tree · case 01

An exponentiation chain builds a left-associated tree.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Parse a valid alternating operand/caret token list with right associativity.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Parse a valid alternating operand/caret token list with right associativity.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Parse a valid alternating operand/caret token list with right associativity.

Why this case matters

A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[0]
        for i in range(1,len(x),2): tree=[x[i],tree,x[i+1]]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '^', 'b', '^', 'c']), ['^', 'a', ['^', 'b', 'c']])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '^', 'b']), ['^', 'a', 'b'])
check('boundary 4', solve(['a', '^', 'b', '^', 'c', '^', 'd']), ['^', 'a', ['^', 'b', ['^', 'c', 'd']]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1['^', ['^', 'a', 'b'], 'c']['^', 'a', ['^', 'b', 'c']]Failed
boundary 2xxPassed
boundary 3['^', 'a', 'b']['^', 'a', 'b']Passed
boundary 4['^', ['^', ['^', 'a', 'b'], 'c'], 'd']['^', 'a', ['^', 'b', ['^', 'c', 'd']]]Failed

SHA-256 / 19efeaf9f1f796e966f6d4ef8e6dc2b8e54cd6a65e61e80df531d451ab46a8a1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ['^',x[0],x[-1]] if len(x)>1 else x[0]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '^', 'b', '^', 'c']), ['^', 'a', ['^', 'b', 'c']])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '^', 'b']), ['^', 'a', 'b'])
check('boundary 4', solve(['a', '^', 'b', '^', 'c', '^', 'd']), ['^', 'a', ['^', 'b', ['^', 'c', 'd']]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1['^', 'a', 'c']['^', 'a', ['^', 'b', 'c']]Failed
boundary 2xxPassed
boundary 3['^', 'a', 'b']['^', 'a', 'b']Passed
boundary 4['^', 'a', 'd']['^', 'a', ['^', 'b', ['^', 'c', 'd']]]Failed

SHA-256 / def12a8262295795905a695f49f807e33fd5d7d49f93f12c43642a56fdd49424

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[-1]
        for i in range(len(x)-2,0,-2): tree=[x[i],x[i-1],tree]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '^', 'b', '^', 'c']), ['^', 'a', ['^', 'b', 'c']])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '^', 'b']), ['^', 'a', 'b'])
check('boundary 4', solve(['a', '^', 'b', '^', 'c', '^', 'd']), ['^', 'a', ['^', 'b', ['^', 'c', 'd']]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1['^', 'a', ['^', 'b', 'c']]['^', 'a', ['^', 'b', 'c']]Passed
boundary 2xxPassed
boundary 3['^', 'a', 'b']['^', 'a', 'b']Passed
boundary 4['^', 'a', ['^', 'b', ['^', 'c', 'd']]]['^', 'a', ['^', 'b', ['^', 'c', 'd']]]Passed

SHA-256 / 4ccd0c86eab5541ea51e72f7e5de662f805657d072fa730e838359d4a38758c9

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:35.001662+00:00.

Case digest / ad4597a1691881a3165b360841ea06248006d004ae979f2bc40f6979a5b97f8c