{"abstract":"Lines break inside \"Dr.~Knuth\" style ties.","category":"Typography line breaking","checks":8,"contract":"Input [source, width]. Runs of spaces are one breakable space; \"~\" is an unbreakable space rendered \" \"; \"\\-\" is a discretionary hyphen: invisible unless the line breaks there, then rendered \"-\"; \"|\" is an invisible break opportunity. Greedy: append the next chunk if the line (without a potential hyphen) fits, else break at that opportunity. Return rendered lines.","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-ties-discretionaries","failed_approach":"Dropping the tie keeps the words together but glues them with no space.","family":"w2-typography-line-breaking-ties-discretionaries-tie-breakability","id":"FA-80181","implementations":{"attempt":{"sha256":"6a04bc4cc3d83edb112ee960c2e54076756432e883c590461a1fc5d5abed1a2e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    src, width = x\n    chunks = ['']\n    ops = []\n    i = 0\n    while i < len(src):\n        c = src[i]\n        if src.startswith('\\\\-', i):\n            ops.append('d')\n            chunks.append('')\n            i += 2\n            continue\n        if c == ' ':\n            j = i\n            while j < len(src) and src[j] == ' ':\n                j += 1\n            ops.append('s')\n            chunks.append('')\n            i = j\n            continue\n        if c == '|':\n            ops.append('z')\n            chunks.append('')\n            i += 1\n            continue\n        chunks[-1] += '' if c == '~' else c\n        i += 1\n    line = chunks[0]\n    lines = []\n    for op, ch in zip(ops, chunks[1:]):\n        sep = ' ' if op == 's' else ''\n        if len(line + sep + ch) <= width:\n            line = line + sep + ch\n        else:\n            lines.append(line + ('-' if op == 'd' else ''))\n            line = ch\n    lines.append(line)\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('regression: tie breakability', ['com\\\\-po\\\\-si\\\\-tion word word  ~url|path com\\\\-po\\\\-si\\\\-tion 10~pt', 14], ['composition', 'word word  url', 'path composi-', 'tion 10 pt']), ('regression: tie breakability', ['ink  x Dr.~Knuth ink ink set x word', 7], ['ink x', 'Dr. Knuth', 'ink ink', 'set x', 'word']), ('regression: tie breakability', ['url|path type type com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 5], ['url', 'path', 'type', 'type', 'compo-', 'si-', 'tion', 'Dr. Knuth']), ('double space collapses', ['type  set', 20], ['type set']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['word  a a set', 7], ['word a', 'a set']), ('control layout', ['url|path com\\\\-po\\\\-si\\\\-tion x a url|path  a', 14], ['urlpath compo-', 'sition x a url', 'path a'])], [('regression: tie breakability', ['com\\\\-po\\\\-si\\\\-tion ~x  com\\\\-po\\\\-si\\\\-tion', 13], ['composition', ' x composi-', 'tion']), ('regression: tie breakability', ['hy\\\\-phen ~type set ~com\\\\-po\\\\-si\\\\-tion set  type  com\\\\-po\\\\-si\\\\-tion word set', 15], ['hyphen  type', 'set  composi-', 'tion set type', 'composition', 'word set']), ('regression: tie breakability', ['ink 10~pt ink b|c hy\\\\-phen ~set url|path word', 16], ['ink 10 pt ink bc', 'hyphen  set url', 'path word']), ('regression: tie breakability', ['hy\\\\-phen ~10~pt b|c hy\\\\-phen ~x  com\\\\-po\\\\-si\\\\-tion', 5], ['hy-', 'phen', ' 10 pt', 'bc hy-', 'phen', ' x', 'compo-', 'si-', 'tion']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('control layout', ['b|c ink hy\\\\-phen url|path type com\\\\-po\\\\-si\\\\-tion', 8], ['bc ink', 'hyphen', 'urlpath', 'type com-', 'position']), ('control layout', ['b|c  a ink  ink com\\\\-po\\\\-si\\\\-tion', 11], ['bc a ink', 'ink composi-', 'tion'])], [('regression: tie breakability', ['x com\\\\-po\\\\-si\\\\-tion ink ~type', 14], ['x composition', 'ink  type']), ('regression: tie breakability', ['Dr.~Knuth  hy\\\\-phen  com\\\\-po\\\\-si\\\\-tion Dr.~Knuth word ink', 6], ['Dr. Knuth', 'hyphen', 'compo-', 'sition', 'Dr. Knuth', 'word', 'ink']), ('regression: tie breakability', ['hy\\\\-phen type ~word  hy\\\\-phen ~x', 14], ['hyphen type', ' word hyphen', ' x']), ('partial-repair probe', ['b|c url|path word  Dr.~Knuth', 9], ['bc url', 'path word', 'Dr. Knuth']), ('double space collapses', ['type  set', 20], ['type set']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['word com\\\\-po\\\\-si\\\\-tion a', 15], ['word composi-', 'tion a']), ('control layout', ['type set b|c', 6], ['type', 'set bc'])], [('regression: tie breakability', ['type a hy\\\\-phen com\\\\-po\\\\-si\\\\-tion ~set set ink  type', 8], ['type a', 'hyphen', 'composi-', 'tion', ' set set', 'ink type']), ('regression: tie breakability', ['ink ~10~pt type  com\\\\-po\\\\-si\\\\-tion url|path  a ~x 10~pt b|c', 9], ['ink', ' 10 pt', 'type com-', 'position', 'urlpath a', ' x 10 pt', 'bc']), ('partial-repair probe', ['ink com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 16], ['ink composition', 'Dr. Knuth']), ('regression: tie breakability', ['x set  type com\\\\-po\\\\-si\\\\-tion a ~ink b|c hy\\\\-phen url|path', 13], ['x set type', 'composition a', ' ink bc hy-', 'phen urlpath']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['a type  com\\\\-po\\\\-si\\\\-tion a', 6], ['a type', 'compo-', 'sition', 'a']), ('control layout', ['com\\\\-po\\\\-si\\\\-tion  hy\\\\-phen com\\\\-po\\\\-si\\\\-tion ink  b|c a', 10], ['composi-', 'tion hy-', 'phen compo-', 'sition ink', 'bc a'])], [('regression: tie breakability', ['Dr.~Knuth ink 10~pt  set x', 16], ['Dr. Knuth ink', '10 pt set x']), ('regression: tie breakability', ['hy\\\\-phen type ~x ~x hy\\\\-phen  10~pt  hy\\\\-phen 10~pt word', 14], ['hyphen type  x', ' x hyphen', '10 pt hyphen', '10 pt word']), ('partial-repair probe', ['url|path type  10~pt  word', 6], ['url', 'path', 'type', '10 pt', 'word']), ('regression: tie breakability', ['url|path type type com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 5], ['url', 'path', 'type', 'type', 'compo-', 'si-', 'tion', 'Dr. Knuth']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['com\\\\-po\\\\-si\\\\-tion type hy\\\\-phen hy\\\\-phen url|path ink', 13], ['composition', 'type hyphen', 'hyphen url', 'path ink']), ('control layout', ['word  a a set', 7], ['word a', 'a set'])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"f1eebb36a25b022ffb070d11b723682417ea1a3b6afd154c27479abbbb573576","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    src, width = x\n    chunks = ['']\n    ops = []\n    i = 0\n    while i < len(src):\n        c = src[i]\n        if src.startswith('\\\\-', i):\n            ops.append('d')\n            chunks.append('')\n            i += 2\n            continue\n        if c in ' ~':\n            j = i\n            while j < len(src) and src[j] in ' ~':\n                j += 1\n            ops.append('s')\n            chunks.append('')\n            i = j\n            continue\n        if c == '|':\n            ops.append('z')\n            chunks.append('')\n            i += 1\n            continue\n        chunks[-1] += ' ' if c == '~' else c\n        i += 1\n    line = chunks[0]\n    lines = []\n    for op, ch in zip(ops, chunks[1:]):\n        sep = ' ' if op == 's' else ''\n        if len(line + sep + ch) <= width:\n            line = line + sep + ch\n        else:\n            lines.append(line + ('-' if op == 'd' else ''))\n            line = ch\n    lines.append(line)\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('regression: tie breakability', ['com\\\\-po\\\\-si\\\\-tion word word  ~url|path com\\\\-po\\\\-si\\\\-tion 10~pt', 14], ['composition', 'word word  url', 'path composi-', 'tion 10 pt']), ('regression: tie breakability', ['ink  x Dr.~Knuth ink ink set x word', 7], ['ink x', 'Dr. Knuth', 'ink ink', 'set x', 'word']), ('regression: tie breakability', ['url|path type type com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 5], ['url', 'path', 'type', 'type', 'compo-', 'si-', 'tion', 'Dr. Knuth']), ('double space collapses', ['type  set', 20], ['type set']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['word  a a set', 7], ['word a', 'a set']), ('control layout', ['url|path com\\\\-po\\\\-si\\\\-tion x a url|path  a', 14], ['urlpath compo-', 'sition x a url', 'path a'])], [('regression: tie breakability', ['com\\\\-po\\\\-si\\\\-tion ~x  com\\\\-po\\\\-si\\\\-tion', 13], ['composition', ' x composi-', 'tion']), ('regression: tie breakability', ['hy\\\\-phen ~type set ~com\\\\-po\\\\-si\\\\-tion set  type  com\\\\-po\\\\-si\\\\-tion word set', 15], ['hyphen  type', 'set  composi-', 'tion set type', 'composition', 'word set']), ('regression: tie breakability', ['ink 10~pt ink b|c hy\\\\-phen ~set url|path word', 16], ['ink 10 pt ink bc', 'hyphen  set url', 'path word']), ('regression: tie breakability', ['hy\\\\-phen ~10~pt b|c hy\\\\-phen ~x  com\\\\-po\\\\-si\\\\-tion', 5], ['hy-', 'phen', ' 10 pt', 'bc hy-', 'phen', ' x', 'compo-', 'si-', 'tion']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('control layout', ['b|c ink hy\\\\-phen url|path type com\\\\-po\\\\-si\\\\-tion', 8], ['bc ink', 'hyphen', 'urlpath', 'type com-', 'position']), ('control layout', ['b|c  a ink  ink com\\\\-po\\\\-si\\\\-tion', 11], ['bc a ink', 'ink composi-', 'tion'])], [('regression: tie breakability', ['x com\\\\-po\\\\-si\\\\-tion ink ~type', 14], ['x composition', 'ink  type']), ('regression: tie breakability', ['Dr.~Knuth  hy\\\\-phen  com\\\\-po\\\\-si\\\\-tion Dr.~Knuth word ink', 6], ['Dr. Knuth', 'hyphen', 'compo-', 'sition', 'Dr. Knuth', 'word', 'ink']), ('regression: tie breakability', ['hy\\\\-phen type ~word  hy\\\\-phen ~x', 14], ['hyphen type', ' word hyphen', ' x']), ('partial-repair probe', ['b|c url|path word  Dr.~Knuth', 9], ['bc url', 'path word', 'Dr. Knuth']), ('double space collapses', ['type  set', 20], ['type set']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['word com\\\\-po\\\\-si\\\\-tion a', 15], ['word composi-', 'tion a']), ('control layout', ['type set b|c', 6], ['type', 'set bc'])], [('regression: tie breakability', ['type a hy\\\\-phen com\\\\-po\\\\-si\\\\-tion ~set set ink  type', 8], ['type a', 'hyphen', 'composi-', 'tion', ' set set', 'ink type']), ('regression: tie breakability', ['ink ~10~pt type  com\\\\-po\\\\-si\\\\-tion url|path  a ~x 10~pt b|c', 9], ['ink', ' 10 pt', 'type com-', 'position', 'urlpath a', ' x 10 pt', 'bc']), ('partial-repair probe', ['ink com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 16], ['ink composition', 'Dr. Knuth']), ('regression: tie breakability', ['x set  type com\\\\-po\\\\-si\\\\-tion a ~ink b|c hy\\\\-phen url|path', 13], ['x set type', 'composition a', ' ink bc hy-', 'phen urlpath']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['a type  com\\\\-po\\\\-si\\\\-tion a', 6], ['a type', 'compo-', 'sition', 'a']), ('control layout', ['com\\\\-po\\\\-si\\\\-tion  hy\\\\-phen com\\\\-po\\\\-si\\\\-tion ink  b|c a', 10], ['composi-', 'tion hy-', 'phen compo-', 'sition ink', 'bc a'])], [('regression: tie breakability', ['Dr.~Knuth ink 10~pt  set x', 16], ['Dr. Knuth ink', '10 pt set x']), ('regression: tie breakability', ['hy\\\\-phen type ~x ~x hy\\\\-phen  10~pt  hy\\\\-phen 10~pt word', 14], ['hyphen type  x', ' x hyphen', '10 pt hyphen', '10 pt word']), ('partial-repair probe', ['url|path type  10~pt  word', 6], ['url', 'path', 'type', '10 pt', 'word']), ('regression: tie breakability', ['url|path type type com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 5], ['url', 'path', 'type', 'type', 'compo-', 'si-', 'tion', 'Dr. Knuth']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['com\\\\-po\\\\-si\\\\-tion type hy\\\\-phen hy\\\\-phen url|path ink', 13], ['composition', 'type hyphen', 'hyphen url', 'path ink']), ('control layout', ['word  a a set', 7], ['word a', 'a set'])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic toy typesetting model with integer widths and a stipulated rule set; it does not claim conformance to any engine. 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-typography-line-breaking-ties-discretionaries-tie-breakability","generated_at":"2026-09-29T14:49:51.549302+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Line breaking decides where paragraphs wrap on screen and in print; a wrong decision point shifts every following line.","root_cause":"The tie is tokenized like an ordinary space.","sha256":"84f0a4eb737e2c8e6d0ffc13faab30f5ee253c05a82fd636546db24a7035128b","title":"Ties and discretionary hyphens: tie breakability · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":43.477,"exit_code":1,"observations":[{"actual":["see","Dr.Knuth","now"],"check":"tie keeps title with name","expected":["see","Dr. Knuth","now"],"passed":false},{"actual":["composition","word word url","path composi-","tion 10pt"],"check":"regression: tie breakability","expected":["composition","word word  url","path composi-","tion 10 pt"],"passed":false},{"actual":["ink x","Dr.Knuth","ink ink","set x","word"],"check":"regression: tie breakability","expected":["ink x","Dr. Knuth","ink ink","set x","word"],"passed":false},{"actual":["url","path","type","type","compo-","si-","tion","Dr.Knuth"],"check":"regression: tie breakability","expected":["url","path","type","type","compo-","si-","tion","Dr. Knuth"],"passed":false},{"actual":["type set"],"check":"double space collapses","expected":["type set"],"passed":true},{"actual":["url","pathx"],"check":"invisible break","expected":["url","pathx"],"passed":true},{"actual":["word a","a set"],"check":"control layout","expected":["word a","a set"],"passed":true},{"actual":["urlpath compo-","sition x a url","path a"],"check":"control layout","expected":["urlpath compo-","sition x a url","path a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie keeps title with name\", \"actual\": [\"see\", \"Dr.Knuth\", \"now\"], \"expected\": [\"see\", \"Dr. Knuth\", \"now\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"composition\", \"word word url\", \"path composi-\", \"tion 10pt\"], \"expected\": [\"composition\", \"word word  url\", \"path composi-\", \"tion 10 pt\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"ink x\", \"Dr.Knuth\", \"ink ink\", \"set x\", \"word\"], \"expected\": [\"ink x\", \"Dr. Knuth\", \"ink ink\", \"set x\", \"word\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"url\", \"path\", \"type\", \"type\", \"compo-\", \"si-\", \"tion\", \"Dr.Knuth\"], \"expected\": [\"url\", \"path\", \"type\", \"type\", \"compo-\", \"si-\", \"tion\", \"Dr. Knuth\"], \"passed\": false}, {\"check\": \"double space collapses\", \"actual\": [\"type set\"], \"expected\": [\"type set\"], \"passed\": true}, {\"check\": \"invisible break\", \"actual\": [\"url\", \"pathx\"], \"expected\": [\"url\", \"pathx\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"word a\", \"a set\"], \"expected\": [\"word a\", \"a set\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"urlpath compo-\", \"sition x a url\", \"path a\"], \"expected\": [\"urlpath compo-\", \"sition x a url\", \"path a\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.165,"exit_code":1,"observations":[{"actual":["see Dr.","Knuth now"],"check":"tie keeps title with name","expected":["see","Dr. Knuth","now"],"passed":false},{"actual":["composition","word word url","path composi-","tion 10 pt"],"check":"regression: tie breakability","expected":["composition","word word  url","path composi-","tion 10 pt"],"passed":false},{"actual":["ink x","Dr.","Knuth","ink ink","set x","word"],"check":"regression: tie breakability","expected":["ink x","Dr. Knuth","ink ink","set x","word"],"passed":false},{"actual":["url","path","type","type","compo-","si-","tion","Dr.","Knuth"],"check":"regression: tie breakability","expected":["url","path","type","type","compo-","si-","tion","Dr. Knuth"],"passed":false},{"actual":["type set"],"check":"double space collapses","expected":["type set"],"passed":true},{"actual":["url","pathx"],"check":"invisible break","expected":["url","pathx"],"passed":true},{"actual":["word a","a set"],"check":"control layout","expected":["word a","a set"],"passed":true},{"actual":["urlpath compo-","sition x a url","path a"],"check":"control layout","expected":["urlpath compo-","sition x a url","path a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie keeps title with name\", \"actual\": [\"see Dr.\", \"Knuth now\"], \"expected\": [\"see\", \"Dr. Knuth\", \"now\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"composition\", \"word word url\", \"path composi-\", \"tion 10 pt\"], \"expected\": [\"composition\", \"word word  url\", \"path composi-\", \"tion 10 pt\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"ink x\", \"Dr.\", \"Knuth\", \"ink ink\", \"set x\", \"word\"], \"expected\": [\"ink x\", \"Dr. Knuth\", \"ink ink\", \"set x\", \"word\"], \"passed\": false}, {\"check\": \"regression: tie breakability\", \"actual\": [\"url\", \"path\", \"type\", \"type\", \"compo-\", \"si-\", \"tion\", \"Dr.\", \"Knuth\"], \"expected\": [\"url\", \"path\", \"type\", \"type\", \"compo-\", \"si-\", \"tion\", \"Dr. Knuth\"], \"passed\": false}, {\"check\": \"double space collapses\", \"actual\": [\"type set\"], \"expected\": [\"type set\"], \"passed\": true}, {\"check\": \"invisible break\", \"actual\": [\"url\", \"pathx\"], \"expected\": [\"url\", \"pathx\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"word a\", \"a set\"], \"expected\": [\"word a\", \"a set\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"urlpath compo-\", \"sition x a url\", \"path a\"], \"expected\": [\"urlpath compo-\", \"sition x a url\", \"path a\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}