Lispex 2.0 specification · not released · Tested product not run · Examples not run

<a id="lispex.page.v2.values"></a>

# Values and text

Build immutable data, compare values, and preserve exact Unicode text across rule boundaries.

Canonical: /v2.0/en/docs/language/values

Document revision: 2.0-draft-1. Content locale: en. Translation: current.

- language: `lispex`
- languageVersion: `2.0`

<a id="lispex.section.v2.values.scope"></a>

## Scope

This chapter defines Datum, scalar values, portable data, and equality. It also defines raw Unicode text and the constraints on mapping host records into data. [Exact numbers](/v2.0/en/docs/language/numbers) defines numeric meaning. [Procedures](/v2.0/en/docs/language/procedures) defines executable values and entry calls.

<a id="lispex.section.v2.values.datum"></a>

## Datum

A Datum is a finite portable value. A scalar is a Boolean, an exact number, a character, a symbol, or the empty list. Aggregate Datum values are pairs, strings, vectors, and bytevectors. Every element of an aggregate Datum is itself a Datum. A list is a chain of pairs ending in the empty list.

Portable data has no cycles or executable components. A pair can hold another Datum in either position. A vector holds an ordered sequence of Datum values. A bytevector holds an ordered sequence of bytes. Strings and symbols preserve the Unicode scalar sequences described below.

[Procedures](/v2.0/en/docs/language/procedures#lispex.section.v2.procedures.parameters) defines internal callable values. Placing one inside a pair or vector does not make it portable data. The [value interchange contract](/v2.0/en/docs/profiles/#lispex.rule.v2.profiles.canonical-codec) supplies the concrete encoding for admitted data.

<a id="lispex.rule.v2.values.portable-datum"></a>

### Keep executable values inside evaluation

A Datum contains only the scalar and aggregate data defined here. Every nested element must also be Datum. A procedure cannot cross the input or result boundary, even inside an aggregate.

**Why**

A value boundary can be reproduced without carrying code, storage addresses, or host capabilities. Checking nested elements closes the same boundary for a list or vector as for a single value.

<a id="lispex.claim.v2.values.portable-datum"></a>

Claim: `lispex.claim.v2.values.portable-datum` · boundary · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "datum-boundary",
    "positions": [
      "input",
      "result"
    ],
    "aggregateValidation": "recursive"
  },
  "result": {
    "kind": "portable-data",
    "finite": true,
    "cycles": false,
    "executableComponents": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for all scalar and aggregate kinds, nested executable values, cycles, and boundary size limits."
  ]
}
```

<a id="lispex.example.v2.values.nested-datum"></a>

### Return nested data

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      input))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": [
          {
            "kind": "integer",
            "value": "7"
          },
          {
            "kind": "string",
            "value": "orchard"
          },
          {
            "kind": "vector",
            "items": [
              {
                "kind": "boolean",
                "value": true
              },
              {
                "kind": "character",
                "value": "λ"
              }
            ]
          }
        ]
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The result is the same nested list datum with the exact integer, string, Boolean, and character values preserved. Product invocation awaits its 2.0 adapter."
}
```

The list contains a vector of portable values. The request notation describes those values and does not define a serialized codec.

<a id="lispex.example.v2.values.nested-procedure-result"></a>

### Reject an executable element in a result

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (lambda (value) value))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The result boundary rejects the list because it contains a procedure. No result datum is returned. Product invocation awaits its 2.0 adapter."
}
```

The outer list cannot hide an executable value. The diagnostic catalog owns the concrete failure code and condition encoding.

See [Diagnostic catalog and reports](/v2.0/en/docs/diagnostics#lispex.rule.v2.cli-and-diagnostics.diagnostics.catalog).

<a id="lispex.section.v2.values.immutable-values"></a>

## Immutable values

Constructing a new value can reuse unchanged data internally. That storage choice does not grant a mutation operation or an observable address. Logical work and allocation remain governed by the [resource contract](/v2.0/en/docs/language/resources).

<a id="lispex.rule.v2.values.immutable-data"></a>

### Transform data without changing it

Values cannot be changed after construction. No public aggregate mutation operation is available. A transformation returns a value without changing its input values. Internal sharing follows the [event-preservation rule](/v2.0/en/docs/language/resources#lispex.rule.v2.resources.preserve-events).

**Why**

Immutable input and result data keep separate evaluations independent. A product can share storage while preserving the language meaning and the resource contract.

<a id="lispex.claim.v2.values.immutable-data"></a>

Claim: `lispex.claim.v2.values.immutable-data` · interaction · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "aggregate-use",
    "kinds": [
      "pair",
      "string",
      "vector",
      "bytevector"
    ]
  },
  "result": {
    "kind": "immutable-data",
    "publicMutation": false,
    "internalSharingChangesMeaning": false,
    "internalSharingChangesResourceEvents": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for every aggregate constructor, removed mutation operation, alias, and allocation boundary."
  ]
}
```

<a id="lispex.example.v2.values.preserve-input-list"></a>

### Keep the original list after construction

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (items)
      (list (cons 0 items) items)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "integer",
            "value": "2"
          }
        ]
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The result contains the new list 0, 1, 2 and the unchanged input list 1, 2. Product invocation awaits its 2.0 adapter."
}
```

The example checks the value of the original input after a constructor uses it. It makes no claim about physical sharing.

<a id="lispex.example.v2.values.vector-mutation-rejected"></a>

### Reject vector mutation

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (vector-set! input 0 9)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "integer",
            "value": "2"
          }
        ]
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The request fails because the public vector mutation operation is unavailable. The input vector is not changed. Product invocation awaits its 2.0 adapter."
}
```

The source deliberately uses a removed operation. Its concrete preparation diagnostic belongs to the diagnostic catalog.

See [Resource model numbers](/v2.0/en/docs/language/resources#lispex.pending.v2.resources.model-numbers).

<a id="lispex.section.v2.values.equality"></a>

## Equality

Use eq? and eqv? for scalars. Use equal? for portable data, including aggregate data. None of these operations compares storage addresses or procedure identity.

Scalar equality follows the value of a Boolean, exact number, character, symbol, or empty list. String content is aggregate data even though a string may look like one item in source.

<a id="lispex.rule.v2.values.scalar-equality"></a>

### Compare only scalars with eq? and eqv?

The operands of eq? and eqv? must be scalars. These procedures compare scalar values. An aggregate or procedure operand produces a domain failure even when both operands refer to the same internal value.

**Why**

Allocation and compiler choices must not change a comparison. Restricting these procedures to scalar values removes observable aggregate and procedure addresses.

<a id="lispex.claim.v2.values.scalar-equality"></a>

Claim: `lispex.claim.v2.values.scalar-equality` · boundary · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "equality-call",
    "procedures": [
      "eq?",
      "eqv?"
    ]
  },
  "result": {
    "kind": "scalar-comparison",
    "domain": "scalar",
    "storageIdentity": false,
    "nonScalarOutcome": "domain-failure"
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for every scalar kind, mixed scalar kinds, exact numeric spellings, and all non-scalar operands."
  ]
}
```

<a id="lispex.example.v2.values.scalar-comparisons"></a>

### Compare scalar values

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (eq? 7 7)
            (eqv? 'oak 'elm)
            (eq? '() '())
            (eqv? #\λ #\λ)
            (eq? #t #f))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The five comparisons return true, false, true, true, and false in order. Product invocation awaits its 2.0 adapter."
}
```

The cases cover exact integers, symbols, the empty list, characters, and Booleans. Exact numeric comparisons are developed in the numbers chapter.

<a id="lispex.example.v2.values.aggregate-scalar-comparison"></a>

### Reject aggregate operands for scalar equality

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (choose-string)
      (if choose-string
          (let ((text "oak")) (eq? text text))
          (let ((items (vector 1))) (eqv? items items)))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "boolean",
        "value": true
      }
    },
    {
      "input": {
        "kind": "boolean",
        "value": false
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The first request rejects a string operand to eq?. The second rejects a vector operand to eqv?. Neither request returns a Boolean. Product invocation awaits its 2.0 adapter."
}
```

Both operands in each comparison use the same binding. Internal sharing does not make an aggregate a scalar.

<a id="lispex.rule.v2.values.structural-equality"></a>

### Validate data before returning structural equality

The operands of equal? must be portable data. It compares scalar values and corresponding aggregate contents. Before it returns a Boolean, both operands must be valid Datum values throughout. A procedure inside either operand produces a domain failure. Shared storage cannot bypass that check.

**Why**

A procedure must not become comparable by wrapping it in a list or sharing that list. Domain validation also prevents a short circuit from hiding an invalid component.

<a id="lispex.claim.v2.values.structural-equality"></a>

Claim: `lispex.claim.v2.values.structural-equality` · interaction · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "equality-call",
    "procedures": [
      "equal?"
    ],
    "operands": "complete-values"
  },
  "result": {
    "kind": "structural-comparison",
    "domain": "portable-data",
    "nestedProcedureOutcome": "domain-failure",
    "sharedStorageSkipsValidation": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for all aggregate kinds, nested invalid data, unequal prefixes, complete domain validation, traversal order, and resource stops."
  ]
}
```

<a id="lispex.example.v2.values.equal-constructed-data"></a>

### Compare separately constructed lists

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (equal? (list 1 "oak") (list 1 "oak"))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The two separately constructed lists compare equal. Product invocation awaits its 2.0 adapter."
}
```

The result follows their corresponding contents. It does not depend on whether the product shares their storage.

<a id="lispex.example.v2.values.shared-procedure-data"></a>

### Reject a procedure inside shared data

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((items (list (lambda (value) value))))
        (equal? items items))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The shared list is outside the domain of equal? because it contains a procedure. The request fails without returning a Boolean. Product invocation awaits its 2.0 adapter."
}
```

A physical pointer comparison cannot replace the required data-domain check.

<a id="lispex.example.v2.values.unequal-prefix-procedure"></a>

### Check the whole data domain

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (equal? (list 1 (lambda (value) value))
              (list 2 0))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The procedure in the first operand causes a domain failure. The unequal first elements do not turn the request into a false result. Product invocation awaits its 2.0 adapter."
}
```

The operands must be portable before equal? can report either true or false. The validation-order rule below fixes the first invalid operand and component. The [Condition catalog](/v2.0/en/docs/language/conditions#lispex.rule.v2.conditions.condition-catalog) fixes the typed fields. Resource tariffs remain under [cost-model-freeze](/v2.0/en/docs/language/resources#lispex.pending.v2.resources.model-numbers).

<a id="lispex.rule.v2.values.equality-validation-order"></a>

### Validate equality operands in a fixed order

The equal? procedure validates the complete left operand before starting validation of the right operand. A failure ends validation at the first invalid component. Validation follows depth-first order with each pair car before its cdr and vector elements in ascending index order. After both operands pass, structural comparison follows that component order. Strings compare scalar positions from first to last and bytevectors compare byte positions from first to last.

**Why**

Two operands can contain different invalid components. Fixing validation and traversal order gives those requests one first failure. The same order also constrains optimizations and the placement of logical resource events.

Equality validation follows a fixed operand and component order.

<a id="lispex.claim.v2.values.equality-validation-order"></a>

Claim: `lispex.claim.v2.values.equality-validation-order` · interaction · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "equal-data-validation",
    "operation": "equal?",
    "operands": "already-evaluated"
  },
  "result": {
    "kind": "ordered-structural-comparison",
    "operandValidation": [
      "left",
      "right"
    ],
    "validationBeforeComparison": "both-complete",
    "traversal": "depth-first",
    "pairOrder": [
      "car",
      "cdr"
    ],
    "vectorOrder": "ascending-index",
    "textOrder": "ascending-scalar-index",
    "bytevectorOrder": "ascending-byte-index",
    "firstInvalid": "first-visited-component"
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for deep pairs, improper lists, vectors, both invalid operands, type mismatches, text and byte traversal, and resource stops at each visit."
  ]
}
```

<a id="lispex.example.v2.values.first-invalid-operand"></a>

### Select the first invalid operand

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (choice)
      (if (= choice 0)
          (equal? (lambda (value) value)
                  (list (lambda (value) value)))
          (if (= choice 1)
              (equal? (list 0 (lambda (value) value))
                      (lambda (value) value))
              (equal? (list 0 1)
                      (vector 2 (lambda (value) value)))))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "integer",
        "value": "0"
      }
    },
    {
      "input": {
        "kind": "integer",
        "value": "1"
      }
    },
    {
      "input": {
        "kind": "integer",
        "value": "2"
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The first request rejects the left procedure. The second rejects the procedure in the second element of the left list. Only the third request reaches validation of the right operand and rejects its second vector element. Product invocation awaits its 2.0 adapter."
}
```

Both operands have already been evaluated when equality validates their data domains. An empty component path names the operand itself. The component paths describe the semantic checks and do not assign serialized condition fields or diagnostic codes.

<a id="lispex.example.v2.values.first-invalid-component"></a>

### Visit pair and vector components in order

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (choose-pair)
      (if choose-pair
          (equal? (cons (lambda (value) value)
                        (lambda (value) value))
                  '())
          (equal? (vector (lambda (value) value)
                          (lambda (value) value))
                  '()))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "boolean",
        "value": true
      }
    },
    {
      "input": {
        "kind": "boolean",
        "value": false
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The pair fails at its car before its cdr is visited. The vector fails at element zero before element one is visited. Neither request starts validation of the right operand. Product invocation awaits its 2.0 adapter."
}
```

Each left operand contains two procedures. Their distinct component positions expose the chosen visitation order even though both are outside the data domain. Sufficient finite limits are fixed for these checks.

See [Concrete resource events](/v2.0/en/docs/language/resources#lispex.rule.v2.resources.event-catalog), [Resource model numbers](/v2.0/en/docs/language/resources#lispex.pending.v2.resources.model-numbers), [Diagnostic catalog and reports](/v2.0/en/docs/diagnostics#lispex.rule.v2.cli-and-diagnostics.diagnostics.catalog).

<a id="lispex.section.v2.values.unicode-text"></a>

## Unicode text

A character is one Unicode scalar value. A string is a finite sequence of those scalar values. A symbol preserves an exact scalar sequence and distinguishes case. Visually similar text can contain different sequences.

The Unicode semantics version belongs to the fixed language meaning. A host locale, operating system, or compiler update cannot select a different transformation. Explicit normalization and case operations require the exact tables and algorithms named by that contract.

<a id="lispex.rule.v2.values.raw-unicode"></a>

### Preserve Unicode scalar sequences

Strings, characters, and symbols preserve their raw Unicode scalar values. Reading or comparing text performs no implicit normalization or case folding. Text transformations use the specification-owned Unicode version and exact operation. Host locale cannot change their meaning.

**Why**

Unrequested normalization can merge distinct keys or names. Fixing Unicode operations in the language contract keeps host text libraries from choosing a different meaning.

<a id="lispex.claim.v2.values.raw-unicode"></a>

Claim: `lispex.claim.v2.values.raw-unicode` · structural · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "text-use",
    "values": [
      "character",
      "string",
      "symbol"
    ]
  },
  "result": {
    "kind": "raw-unicode-semantics",
    "implicitNormalization": false,
    "implicitCaseFolding": false,
    "unicodeVersionOwner": "language-specification",
    "hostLocaleSelectsMeaning": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for all scalar boundaries, combining sequences, supplementary characters, Unicode tables, full transformations, and differing host locales."
  ]
}
```

<a id="lispex.example.v2.values.raw-text-comparison"></a>

### Distinguish exact text sequences

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (equal? "é" "é")
            (equal? "A" "a")
            (equal? "é" "é"))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The comparisons return false, false, and true. The composed and decomposed spellings remain different sequences. Product invocation awaits its 2.0 adapter."
}
```

The first string uses U+00E9. The second uses U+0065 followed by U+0301. The expected values do not depend on a font or host locale.

<a id="lispex.rule.v2.values.unicode-operations"></a>

### Use the fixed Unicode repertoire

Unicode operations use Unicode 17.0.0 and the operation tables below. Products use these archived data and algorithms. Host locale, operating system, compiler, and text library defaults cannot select another meaning.

**Why**

The same text must produce the same classification and transformation on every product. A fixed repertoire also subjects each operation to the same finite resource contract.

Complete storage and work are assigned to the declared Unicode events. Original scalar counts, generated scalar counts, and typed result sites preserve reservation order across physical representations.

The following table fixes the Unicode property operations. Each accepts one character.

| Procedure | Result |
| --- | --- |
| `char-alphabetic?` | The `Alphabetic` Boolean |
| `char-numeric?` | True exactly for `General_Category = Nd` |
| `char-whitespace?` | The `White_Space` Boolean |
| `char-upper-case?` | The `Uppercase` Boolean |
| `char-lower-case?` | The `Lowercase` Boolean |
| `digit-value` | The exact decimal digit value from zero through nine for `Nd`, otherwise `#f` |

The complete Unicode transformation repertoire is fixed below. Its signatures belong to the [public procedure catalog](/v2.0/en/docs/library#lispex.rule.v2.standard-library.procedure-catalog).

| Group | Public names |
| --- | --- |
| Simple character case | `char-upcase` `char-downcase` `char-foldcase` |
| Full string case | `string-upcase` `string-downcase` `string-foldcase` |
| Explicit normalization | `string-normalize-nfc` `string-normalize-nfd` `string-normalize-nfkc` `string-normalize-nfkd` |
| Simple folded character comparison | `char-ci=?` `char-ci<?` `char-ci>?` `char-ci<=?` `char-ci>=?` |
| Full folded string comparison | `string-ci=?` `string-ci<?` `string-ci>?` `string-ci<=?` `string-ci>=?` |

The data sources are the archived Unicode 17.0.0 files. [UAX #44 revision 36](https://www.unicode.org/reports/tr44/tr44-36.html) fixes their interpretation and defaults.

| Data | Use |
| --- | --- |
| [UnicodeData.txt](https://www.unicode.org/Public/17.0.0/ucd/UnicodeData.txt) | General category, decimal digits, simple mappings, combining classes, and decompositions |
| [DerivedCoreProperties.txt](https://www.unicode.org/Public/17.0.0/ucd/DerivedCoreProperties.txt) | Alphabetic, Uppercase, Lowercase, Cased, and Case_Ignorable |
| [PropList.txt](https://www.unicode.org/Public/17.0.0/ucd/PropList.txt) | White_Space |
| [SpecialCasing.txt](https://www.unicode.org/Public/17.0.0/ucd/SpecialCasing.txt) | Full case mappings and original-input contexts |
| [CaseFolding.txt](https://www.unicode.org/Public/17.0.0/ucd/CaseFolding.txt) | Simple and full folding |
| [CompositionExclusions.txt](https://www.unicode.org/Public/17.0.0/ucd/CompositionExclusions.txt) and [DerivedNormalizationProps.txt](https://www.unicode.org/Public/17.0.0/ucd/DerivedNormalizationProps.txt) | Composition exclusions and normalization properties |

Every Unicode scalar is accepted by the appropriate character or string operation. Unassigned, private-use, and noncharacter scalars use the frozen defaults. A later Unicode assignment does not change those defaults. New data, errata, or tailoring require a new language semantics revision. The source grammar defines its own whitespace separately from `char-whitespace?`.

The call first completes expression evaluation and checks arity. It then checks argument types from left to right. Unicode work starts only after those checks succeed. Type and arity failures are language conditions. Resource exhaustion follows the [reservation order](/v2.0/en/docs/language/resources#lispex.rule.v2.resources.atomic-axis-order). A procedure returns its complete result or the first failure.

The [resource event catalog](/v2.0/en/docs/language/resources#lispex.rule.v2.resources.event-catalog) defines these event names, reservation points, and canonical sites.
This table selects the events used by each operation.

| Work | Resource events |
| --- | --- |
| Property queries and simple case mapping | `text-scalar-scan` `unicode-map` |
| Full string mapping | `text-scalar-scan` `unicode-map` `datum-allocate` |
| Normalization | `text-scalar-scan` `unicode-normalize` `datum-allocate` |
| Folded comparison | Folding events followed by `compare-scalar` |

Coefficients, allocation units, limits, and physical envelopes remain with the [cost model freeze](/v2.0/en/docs/language/resources#lispex.pending.v2.resources.model-numbers).

A scalar property query or simple case mapping performs one scalar scan and one unicode-map. Its map extent is one. For digit-value, that map reserves the complete exact integer representation and value slot before creating the digit result. A nondecimal input returns #f within the same event. Neither result adds a datum-allocate event. Booleans and characters retain their declared scalar representation requirements.

A completed string mapping or normalization reserves one datum-allocate before materializing its immutable result. Its extent is m, the actual number of output scalars. The complete requirements include the string header, value slot, and space for up to 4 times m UTF-8 octets. They also include encoding work and any temporary storage used for materialization. The extent remains m when input length, decomposition capacity, or UTF-8 octet length differs. Extent zero still reserves an empty string result. Refusal publishes no partial string and refunds no earlier charge.

<a id="lispex.claim.v2.values.unicode-operations"></a>

Claim: `lispex.claim.v2.values.unicode-operations` · structural · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "unicode-operation",
    "operations": [
      "char-alphabetic?",
      "char-numeric?",
      "char-whitespace?",
      "char-upper-case?",
      "char-lower-case?",
      "digit-value",
      "char-upcase",
      "char-downcase",
      "char-foldcase",
      "string-upcase",
      "string-downcase",
      "string-foldcase",
      "string-normalize-nfc",
      "string-normalize-nfd",
      "string-normalize-nfkc",
      "string-normalize-nfkd",
      "char-ci=?",
      "char-ci<?",
      "char-ci>?",
      "char-ci<=?",
      "char-ci>=?",
      "string-ci=?",
      "string-ci<?",
      "string-ci>?",
      "string-ci<=?",
      "string-ci>=?"
    ]
  },
  "result": {
    "kind": "fixed-unicode-operations",
    "unicodeVersion": "17.0.0",
    "dataVersion": "17.0.0",
    "ucdAnnexRevision": 36,
    "hostDefaults": false,
    "localeTailoring": false,
    "allUnicodeScalars": true,
    "propertyOperations": {
      "char-alphabetic?": "Alphabetic",
      "char-numeric?": "General_Category=Nd",
      "char-whitespace?": "White_Space",
      "char-upper-case?": "Uppercase",
      "char-lower-case?": "Lowercase",
      "digit-value": "decimal-digit-value-or-false"
    },
    "validationOrder": [
      "expression-evaluation",
      "arity",
      "argument-types-left-to-right",
      "unicode-work"
    ],
    "resourceEvents": [
      "text-scalar-scan",
      "unicode-map",
      "unicode-normalize",
      "datum-allocate",
      "compare-scalar"
    ]
  },
  "pendingCases": [
    "Native, npm, and WASM products require all Unicode 17.0.0 property, case, and normalization conformance cases. Cases must cover every supported engine and architecture, scalar boundaries, long combining sequences, and differing host locales and Unicode libraries. Resource boundary cases require the later cost model freeze."
  ]
}
```

<a id="lispex.example.v2.values.unicode-properties"></a>

### Use the frozen character properties

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (char-alphabetic? (integer->char 837))
            (char-numeric? (integer->char 1641))
            (char-numeric? (integer->char 178))
            (digit-value (integer->char 1641))
            (digit-value (integer->char 178))
            (char-whitespace? (integer->char 160))
            (char-upper-case? (integer->char 42958))
            (char-lower-case? (integer->char 42959))
            (char->integer (char-foldcase (integer->char 42958))))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The properties use the fixed tables. Arabic-Indic nine is a decimal digit and superscript two is not. U+A7CE folds to U+A7CF. Product invocation awaits its 2.0 adapter."
}
```

U+0345 exercises Alphabetic beyond letter categories. U+00A0 exercises the White_Space property. U+A7CE and U+A7CF exercise the pinned case table.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)

<a id="lispex.example.v2.values.unicode-scalar-defaults"></a>

### Preserve scalars with default mappings

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (map (lambda (n)
             (char->integer (char-foldcase (integer->char n))))
           (list 888 57344 64976 1114111))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "All four scalars retain their values under simple folding. Product invocation awaits its 2.0 adapter."
}
```

The inputs are U+0378, U+E000, U+FDD0, and U+10FFFF. They exercise unassigned, private-use, and noncharacter defaults.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)

<a id="lispex.example.v2.values.unicode-validation-order"></a>

### Validate every argument before Unicode work

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (choice)
      (if (= choice 0)
          (string-upcase #f)
          (if (= choice 1)
              (string-ci=? "z" "a" 7)
              (string-normalize-nfc (car '()))))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "integer",
        "value": "0"
      }
    },
    {
      "input": {
        "kind": "integer",
        "value": "1"
      }
    },
    {
      "input": {
        "kind": "integer",
        "value": "2"
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The first two requests reject invalid argument types before Unicode work. The third fails while evaluating its argument. A false comparison prefix does not skip argument validation. Product invocation awaits its 2.0 adapter."
}
```

All arguments finish evaluation before call validation. Type checks finish before folding, normalization, or comparison begins. Unicode argument positions start at zero. A null position means operand evaluation failed before Unicode argument checks.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)

<a id="lispex.rule.v2.values.explicit-normalization"></a>

### Normalize only through the requested form

The four normalization procedures apply the named Unicode 17.0.0 form. NFC, NFD, NFKC, and NFKD are distinct explicit choices. Reading, equality, case conversion, and case folding do not normalize text implicitly.

**Why**

Canonical and compatibility equivalence answer different questions. Explicit forms preserve the original scalar value until the program requests a transformation.

Complete storage and work are assigned to the declared Unicode events. Original scalar counts, generated scalar counts, and typed result sites preserve reservation order across physical representations.

Each procedure takes exactly one string and returns a string.

| Procedure | Unicode 17.0.0 result |
| --- | --- |
| `string-normalize-nfc` | `NFC(input)` |
| `string-normalize-nfd` | `NFD(input)` |
| `string-normalize-nfkc` | `NFKC(input)` |
| `string-normalize-nfkd` | `NFKD(input)` |

[Chapter 3 sections 3.11 and 3.12](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/) define the algorithms. [UAX #15 revision 57](https://www.unicode.org/reports/tr15/tr15-57.html) fixes the normalization conformance requirements. They include canonical ordering, composition exclusions, and Hangul decomposition and composition.

The empty string returns the empty string. A normalization procedure neither changes case nor inserts Stream-Safe separator characters. Long combining sequences keep their specified result and consume the declared resource events. Exhaustion stops the operation before a partial result becomes visible.

After the complete original scalar scan and required end, each normalization call performs one unicode-normalize at argument(0). Its extent is the original scalar count n. D is 4 for NFC and NFD, and 18 for NFKC and NFKD. Its complete requirements cover two scalar buffers, each with capacity D times n, and 256 canonical-combining-class counters. Bound arithmetic, decomposition lookup, ordering, composition, and all intermediate storage belong to this reservation. It succeeds before transformation or scratch materialization starts.

Fully decompose the input under the selected form. Use stable counting order within each maximal nonstarter run. A scalar with combining class zero separates runs. Equal combining classes retain their original order. Compose NFC and NFKC in place under the Unicode blocking, exclusion, and Hangul rules. With decomposed length L and r runs of at least two nonstarters, ordering work has the structural bound O(1 + L + 256r). L is at most D times n and r is at most floor(L / 2). Reserve from n, D, and these upper bounds before decomposition; discovering actual L or r is transformation work. The selected model covers fixed workspace setup and every complete lookup, counter pass, scalar visit, and movement, including their coefficients. It cannot hide a recursive walk, comparison sort, or quadratic insertion pass outside the reservation.

The empty string still has one unicode-normalize with extent zero, followed by one datum-allocate with extent zero. The fixed workspace and empty-result requirements remain part of those reservations.

A completed string mapping or normalization reserves one datum-allocate before materializing its immutable result. Its extent is m, the actual number of output scalars. The complete requirements include the string header, value slot, and space for up to 4 times m UTF-8 octets. They also include encoding work and any temporary storage used for materialization. The extent remains m when input length, decomposition capacity, or UTF-8 octet length differs. Extent zero still reserves an empty string result. Refusal publishes no partial string and refunds no earlier charge.

<a id="lispex.claim.v2.values.explicit-normalization"></a>

Claim: `lispex.claim.v2.values.explicit-normalization` · structural · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "normalization-call",
    "operations": [
      "string-normalize-nfc",
      "string-normalize-nfd",
      "string-normalize-nfkc",
      "string-normalize-nfkd"
    ]
  },
  "result": {
    "kind": "explicit-unicode-normalization",
    "unicodeVersion": "17.0.0",
    "annex15Revision": 57,
    "forms": [
      "NFC",
      "NFD",
      "NFKC",
      "NFKD"
    ],
    "arity": 1,
    "input": "string",
    "result": "string",
    "implicitNormalization": false,
    "caseConversion": false,
    "streamSafeInsertion": false,
    "partialResult": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require all Unicode 17.0.0 property, case, and normalization conformance cases. Cases must cover every supported engine and architecture, scalar boundaries, long combining sequences, and differing host locales and Unicode libraries. Resource boundary cases require the later cost model freeze."
  ]
}
```

<a id="lispex.example.v2.values.normalization-forms"></a>

### Choose canonical and compatibility normalization

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (string-normalize-nfc "é")
            (string-normalize-nfd "é")
            (string-normalize-nfc "①")
            (string-normalize-nfkc "①")
            (string-normalize-nfkd "ﬁ")
            (string-normalize-nfd "가")
            (string-normalize-nfc "가")
            (string-normalize-nfd "à̕")
            (string-normalize-nfc ""))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The forms produce the stated scalar sequences. Compatibility normalization changes the circled digit and ligature. Canonical normalization preserves the circled digit. Product invocation awaits its 2.0 adapter."
}
```

The case includes composition, decomposition, compatibility mapping, Hangul algorithms, combining-class order, and empty input.

Source evidence:

- [document: reports/tr15/tr15-57.html at Unicode-17.0.0](https://www.unicode.org/reports/tr15/tr15-57.html)

<a id="lispex.rule.v2.values.default-case-algorithms"></a>

### Use default simple and full case algorithms

Character case operations use simple mappings. String case operations use full mappings and the specified original-input contexts. Folding and folded comparisons use the fixed non-Turkic mappings. These operations perform no normalization or locale tailoring.

**Why**

Full mappings preserve expansions needed for string matching. Simple character mappings preserve the character result domain. Fixed context and folding rules reproduce these choices without host locale state.

Complete storage and work are assigned to the declared Unicode events. Original scalar counts, generated scalar counts, and typed result sites preserve reservation order across physical representations.

The unary case operations accept one value of the indicated type.

| Procedure | Input and result | Mapping |
| --- | --- | --- |
| `char-upcase` | Character to character | `Simple_Uppercase_Mapping` |
| `char-downcase` | Character to character | `Simple_Lowercase_Mapping` |
| `char-foldcase` | Character to character | `CaseFolding.txt` statuses `C` and `S` |
| `string-upcase` | String to string | Full `Uppercase_Mapping` |
| `string-downcase` | String to string | Full `Lowercase_Mapping` |
| `string-foldcase` | String to string | `CaseFolding.txt` statuses `C` and `F` |

Simple mappings always produce one scalar. A missing mapping returns the input scalar. A product must not truncate a full mapping to implement a character operation.

String case conversion uses [Default Case Conversion](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/). It combines `UnicodeData.txt` with `SpecialCasing.txt`. It applies unconditional mappings and language-independent conditions, including `Final_Sigma`. Every context is tested against the original string. Language-tagged mappings are excluded. Case folding excludes status `T` and uses one pass over the original scalars. The empty string maps to itself.

| Comparison names | Compared values |
| --- | --- |
| `char-ci=?` `char-ci<?` `char-ci>?` `char-ci<=?` `char-ci>=?` | Simple-folded scalars |
| `string-ci=?` `string-ci<?` `string-ci>?` `string-ci<=?` `string-ci>=?` | Full-folded scalar sequences |

Each comparison accepts at least two arguments of its own type. After type validation, it folds all arguments from left to right. It then compares adjacent pairs from left to right. For each folded string pair, comparison starts at index zero. At each position, inspect the left sequence and then the right. Decide whether to stop only after both reads. Stop that pair at unequal scalars or an end. The result is true exactly when every pair satisfies the named relation. The first false pair ends comparison. Scalar order is numeric code point order. String order is lexicographic scalar order with the shorter equal prefix first. Comparison does not apply normalization or locale collation.

Let n be the number of original input scalars. Full string mapping first scans all n scalars and the required end. It then maps the original scalars in ascending index order. Each unicode-map has extent n. The first map reserves one scratch buffer with capacity D times n scalars. D is 3 for uppercase, 2 for lowercase, and 3 for folding. That reservation succeeds before either scratch storage or the first mapped scalar is created. Later maps reuse that capacity. They reserve their own mapping work without another scratch allocation. An empty input performs its end scan and result allocation, with no map or mapping scratch reservation.

The map requirement includes exact bound calculation, table lookup, expansion, and retained scalar storage. These counts are mathematical integers. A host word width cannot add a domain limit or change the first failure.

Lowercasing keeps a preceding-cased state while visiting the original scalars. Case_Ignorable scalars leave that state unchanged, including a scalar that is also Cased. Every other original scalar sets the state to its Cased property. A U+03A3 map tests the state before that scalar updates it. If the state is true, inspect the original suffix in ascending index order. Skip Case_Ignorable before testing Cased. The first remaining scalar, or the required end, determines whether a following cased scalar exists. Final_Sigma selects U+03C2 exactly when the preceding state is true and no such following cased scalar exists. Otherwise U+03A3 maps to U+03C3.

The current map includes the preceding-state work and every required suffix visit in its complete requirements. At most n original scalars are visited for that map's context work. These visits create no additional text-scalar-scan events. Earlier mapped results never supply context.

All argument domain checks finish before folding or replacing any retained argument. Fold each argument in ascending argument order. Retain its completed folded value in the same logical operand-sequence position already reserved for that call. A character replacement belongs to its unicode-map. A string replacement belongs to its completed result allocation. This replacement changes no caller binding or immutable input value. It adds no argument-store or traversal-state event and requires no separate descriptor sequence. Every folded value remains available until comparison finishes or the call fails. Repeated references to the same input still perform each argument's full folding schedule and result reservation.

For a unary string transformation, the result allocation site is result(0). For a folded string comparison, the folded result of argument i is allocated at result(i) of the invoking comparison call. The site role is datum-allocate. All scans and maps continue to select the original argument(i) and its scalar positions.

After all folding and retention, each folded character pair performs one compare-scalar. For strings, each visited position performs one compare-scalar. Reserve before reading the left scalar or end, then the right scalar or end at that same position. Both reads belong to that event, including when the left sequence has ended. Only after both reads does the pair stop at unequal scalars or an end. No additional text-scalar-scan accompanies these folded reads. String comparison sites use field(compare), argument(i), scalar(j), where i is the left argument of the adjacent pair and j starts at zero for each pair. Character comparison selects field(compare), argument(i). The first false pair ends comparison after every argument has already been folded.

<a id="lispex.claim.v2.values.default-case-algorithms"></a>

Claim: `lispex.claim.v2.values.default-case-algorithms` · structural · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "unicode-case-call",
    "operations": [
      "char-upcase",
      "char-downcase",
      "char-foldcase",
      "string-upcase",
      "string-downcase",
      "string-foldcase",
      "char-ci=?",
      "char-ci<?",
      "char-ci>?",
      "char-ci<=?",
      "char-ci>=?",
      "string-ci=?",
      "string-ci<?",
      "string-ci>?",
      "string-ci<=?",
      "string-ci>=?"
    ]
  },
  "result": {
    "kind": "default-unicode-case",
    "unicodeVersion": "17.0.0",
    "characterMappings": "simple",
    "stringMappings": "full",
    "contextSource": "original-string",
    "caseFoldingStatuses": {
      "character": [
        "C",
        "S"
      ],
      "string": [
        "C",
        "F"
      ]
    },
    "turkicMappings": false,
    "localeTailoring": false,
    "implicitNormalization": false,
    "comparisonArityMinimum": 2,
    "argumentValidation": "all-left-to-right-before-folding",
    "foldingOrder": "all-arguments-left-to-right",
    "comparisonOrder": "adjacent-pairs-left-to-right",
    "scalarOrder": "code-point",
    "stringOrder": "lexicographic-scalars-shorter-prefix-first",
    "stringPairScan": {
      "startIndex": 0,
      "operandOrder": "left-before-right",
      "stopAt": "first-unequal-scalar-or-first-sequence-end"
    }
  },
  "pendingCases": [
    "Native, npm, and WASM products require all Unicode 17.0.0 property, case, and normalization conformance cases. Cases must cover every supported engine and architecture, scalar boundaries, long combining sequences, and differing host locales and Unicode libraries. Resource boundary cases require the later cost model freeze."
  ]
}
```

<a id="lispex.example.v2.values.case-algorithm-results"></a>

### Preserve full expansions and original context

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (string-upcase "Straße")
            (string-downcase "ΟΣ")
            (string-downcase "ΟΣΑ")
            (string-foldcase "ςΣ")
            (string-downcase "İI")
            (string-foldcase "Iİı")
            (char->integer (char-upcase (integer->char 223)))
            (char->integer (char-downcase (integer->char 304)))
            (char->integer (char-foldcase (integer->char 304)))
            (string-foldcase ""))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "String casing expands sharp s and applies final sigma in its original context. Dotted I retains its default full mapping. Character mappings return one scalar. Product invocation awaits its 2.0 adapter."
}
```

The sharp-s character has no simple uppercase mapping. Its character result stays U+00DF while string uppercase expands to two letters. Default folding does not select Turkic mappings.

Source evidence:

- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.folded-comparisons"></a>

### Compare explicitly folded scalar sequences

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (list (string-ci=? "Straße" "STRASSE")
            (string-ci=? "é" "é")
            (string-ci=? "İ" "i̇")
            (char-ci=? (integer->char 304) (integer->char 105))
            (char-ci=? (integer->char 931) (integer->char 962))
            (string-ci<? "a" "AA" "b")
            (string-ci>=? "B" "b" "A")
            (char-ci<=? (integer->char 65) (integer->char 97)))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "list",
        "items": []
      }
    }
  ],
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "Full and simple folding produce their specified equality and order results. Canonically equivalent spellings stay unequal without explicit normalization. Product invocation awaits its 2.0 adapter."
}
```

String comparisons use full folds and scalar lexicographic order. Character comparisons use simple folds. The two dotted-I comparisons demonstrate the difference.

Source evidence:

- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.unicode-scalar-result-event-traces"></a>

### Decimal digit result reservations

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (digit-value input)))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "arabic-indic-nine",
      "input": {
        "kind": "character",
        "value": "٩"
      }
    },
    {
      "case": "ascii-zero",
      "input": {
        "kind": "character",
        "value": "0"
      }
    },
    {
      "case": "superscript-is-not-decimal",
      "input": {
        "kind": "character",
        "value": "²"
      }
    },
    {
      "case": "digit-map-allocation-stop",
      "input": {
        "kind": "character",
        "value": "٩"
      },
      "resourceBoundary": {
        "event": "unicode-map",
        "fixtureSite": "digit-call",
        "path": [
          {
            "kind": "argument",
            "index": "0"
          },
          {
            "kind": "field",
            "name": "map"
          },
          {
            "kind": "scalar",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through every preceding event in the selected call trace",
        "selectedReservation": "insufficient remaining allocation for the complete digit-value map, including its exact integer and value slot",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "digit-call": "The digit-value call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "A digit result is created within the scalar map reservation. Decimal zero and nine use exact integers. Superscript two returns false. A refused map creates no integer or retained value slot. Product invocation awaits its 2.0 adapter."
}
```

A digit result is created within the scalar map reservation. Decimal zero and nine use exact integers. Superscript two returns false. A refused map creates no integer or retained value slot.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

arabic-indic-nine uses `digit-value` at `digit-call`.

UnicodeData U+0669 has General_Category Nd and Decimal_Digit_Value 9. One scan and one map return the exact integer 9. The map reserves its complete integer representation and value slot before either is created.

Arguments: `[{"kind":"character","value":"٩"}]`.

Mapping and context calculation: `{"generalCategory":"Nd","decimalDigitValue":"9"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"digit-value"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"C"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0669"}` | accepted |
| 6 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"digit-value","scalar":"U+0669","inputScalarCount":"1","query":"decimal-digit-value-or-false","resultShape":"exact integer zero through nine for Nd, otherwise Boolean","integerStorage":"complete exact integer and value slot within this map reservation"}` | accepted |
| 7 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"integer","value":"9"}}`.

ascii-zero uses `digit-value` at `digit-call`.

UnicodeData U+0030 has General_Category Nd and Decimal_Digit_Value 0. Zero is an exact integer result. It uses the same scalar map event and its complete storage reservation.

Arguments: `[{"kind":"character","value":"0"}]`.

Mapping and context calculation: `{"generalCategory":"Nd","decimalDigitValue":"0"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"digit-value"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"C"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0030"}` | accepted |
| 6 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"digit-value","scalar":"U+0030","inputScalarCount":"1","query":"decimal-digit-value-or-false","resultShape":"exact integer zero through nine for Nd, otherwise Boolean","integerStorage":"complete exact integer and value slot within this map reservation"}` | accepted |
| 7 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"integer","value":"0"}}`.

superscript-is-not-decimal uses `digit-value` at `digit-call`.

UnicodeData U+00B2 has General_Category No and no decimal digit value. Its Numeric_Value 2 does not satisfy Nd. The map returns the predefined Boolean false and adds no datum-allocate event.

Arguments: `[{"kind":"character","value":"²"}]`.

Mapping and context calculation: `{"generalCategory":"No","decimalDigitValue":null}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"digit-value"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"C"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00B2"}` | accepted |
| 6 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"digit-value","scalar":"U+00B2","inputScalarCount":"1","query":"decimal-digit-value-or-false","resultShape":"exact integer zero through nine for Nd, otherwise Boolean","integerStorage":"complete exact integer and value slot within this map reservation"}` | accepted |
| 7 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":false}}`.

digit-map-allocation-stop uses `digit-value` at `digit-call`.

The U+0669 map is the first refused event. The scan succeeds. The map has extent one and reserves both the exact integer and its value slot. Refusal creates neither and ends the call before call-return.

Arguments: `[{"kind":"character","value":"٩"}]`.

Mapping and context calculation: `{"generalCategory":"Nd","decimalDigitValue":"9"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"digit-value"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"C"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0669"}` | accepted |
| 6 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"digit-value","scalar":"U+0669","inputScalarCount":"1","query":"decimal-digit-value-or-false","resultShape":"exact integer zero through nine for Nd, otherwise Boolean","integerStorage":"complete exact integer and value slot within this map reservation"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"digit-value","event":"unicode-map","site":{"fixtureSite":"digit-call","role":"unicode-map","path":[{"kind":"argument","index":"0"},{"kind":"field","name":"map"},{"kind":"scalar","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)

<a id="lispex.example.v2.values.unicode-mapping-scratch-event-traces"></a>

### Full mapping scratch reservations

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (if (= (vector-ref input 0) 0)
                  (string-upcase (vector-ref input 1))
                  (if (= (vector-ref input 0) 1)
                      (string-downcase (vector-ref input 1))
                      (string-foldcase (vector-ref input 1))))))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "upper-expansion-then-scalar",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "ßa"
          }
        ]
      }
    },
    {
      "case": "lower-dotted-i-expansion",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "İA"
          }
        ]
      }
    },
    {
      "case": "fold-two-expansions",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "ßİ"
          }
        ]
      }
    },
    {
      "case": "upper-three-scalar-bound",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "ﬃ"
          }
        ]
      }
    },
    {
      "case": "fold-three-scalar-bound",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "ﬃ"
          }
        ]
      }
    },
    {
      "case": "empty-fold",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": ""
          }
        ]
      }
    },
    {
      "case": "first-map-scratch-stop",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "ßa"
          }
        ]
      },
      "resourceBoundary": {
        "event": "unicode-map",
        "fixtureSite": "upcase-call",
        "path": [
          {
            "kind": "argument",
            "index": "0"
          },
          {
            "kind": "field",
            "name": "map"
          },
          {
            "kind": "scalar",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through every preceding event in the selected call trace",
        "selectedReservation": "insufficient remaining allocation for the first map complete requirements, including the single D*n scratch buffer; no map effect or scratch creation occurs",
        "otherAxes": "sufficient"
      }
    },
    {
      "case": "mapped-result-stop",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "İA"
          }
        ]
      },
      "resourceBoundary": {
        "event": "datum-allocate",
        "fixtureSite": "downcase-call",
        "path": [
          {
            "kind": "result",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through every preceding event in the selected call trace",
        "selectedReservation": "insufficient remaining allocation for the complete result string; all prior maps remain charged and no result is exposed",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "upcase-call": "The string-upcase call in the result initializer.",
    "downcase-call": "The string-downcase call in the result initializer.",
    "foldcase-call": "The string-foldcase call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The first scalar map reserves the full expansion scratch after the original scan. Uppercase, lowercase, and folding use their distinct bounds. Empty input has no map. Scratch and result refusals stop at their separate events. Product invocation awaits its 2.0 adapter."
}
```

The first scalar map reserves the full expansion scratch after the original scan. Uppercase, lowercase, and folding use their distinct bounds. Empty input has no map. Scratch and result refusals stop at their separate events.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

upper-expansion-then-scalar uses `string-upcase` at `upcase-call`.

SpecialCasing maps U+00DF to U+0053 U+0053; UnicodeData maps U+0061 to U+0041. n=2, D=3, so the first map reserves one capacity-six scratch buffer. The second map reuses it. The output has m=3 scalars.

Arguments: `[{"kind":"string","value":"ßa"}]`.

Mapping and context calculation: `{"originalScalars":["U+00DF","U+0061"],"n":"2","D":"3","scratchScalarCapacity":"6","perOriginalScalarMappings":[["U+0053","U+0053"],["U+0041"]],"outputScalars":["U+0053","U+0053","U+0041"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-upcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0061"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-upcase","scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-upcase","scalar":"U+0061","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0053","U+0053","U+0041"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"SSA"}}`.

lower-dotted-i-expansion uses `string-downcase` at `downcase-call`.

The unconditional SpecialCasing mapping for U+0130 is U+0069 U+0307. Language-tagged alternatives are excluded. UnicodeData maps U+0041 to U+0061. n=2, D=2, scratch capacity=4, m=3.

Arguments: `[{"kind":"string","value":"İA"}]`.

Mapping and context calculation: `{"originalScalars":["U+0130","U+0041"],"n":"2","D":"2","scratchScalarCapacity":"4","perOriginalScalarMappings":[["U+0069","U+0307"],["U+0061"]],"outputScalars":["U+0069","U+0307","U+0061"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0130"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0041"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-downcase","scalar":"U+0130","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":true,"contextScalarVisitBound":"2"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-downcase","scalar":"U+0041","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":false,"contextScalarVisitBound":"2"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0069","U+0307","U+0061"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"i̇a"}}`.

fold-two-expansions uses `string-foldcase` at `foldcase-call`.

CaseFolding status F maps U+00DF to U+0073 U+0073 and U+0130 to U+0069 U+0307. The status T mapping of U+0130 is excluded. n=2, D=3, scratch capacity=6, m=4.

Arguments: `[{"kind":"string","value":"ßİ"}]`.

Mapping and context calculation: `{"originalScalars":["U+00DF","U+0130"],"n":"2","D":"3","scratchScalarCapacity":"6","perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"outputScalars":["U+0073","U+0073","U+0069","U+0307"],"m":"4","resultUtf8OctetCapacityBound":"16"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-foldcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-foldcase","scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-foldcase","scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ssi̇"}}`.

upper-three-scalar-bound uses `string-upcase` at `upcase-call`.

SpecialCasing U+FB03 has full uppercase U+0046 U+0046 U+0049. One original scalar fills the D=3 scratch bound exactly. n=1 and m=3; the result extent is three while the UTF-8 capacity bound is twelve.

Arguments: `[{"kind":"string","value":"ﬃ"}]`.

Mapping and context calculation: `{"originalScalars":["U+FB03"],"n":"1","D":"3","scratchScalarCapacity":"3","perOriginalScalarMappings":[["U+0046","U+0046","U+0049"]],"outputScalars":["U+0046","U+0046","U+0049"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-upcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+FB03"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 7 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-upcase","scalar":"U+FB03","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0046","U+0046","U+0049"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"FFI"}}`.

fold-three-scalar-bound uses `string-foldcase` at `foldcase-call`.

CaseFolding status F maps U+FB03 to U+0066 U+0066 U+0069. One original scalar fills the D=3 fold scratch bound exactly. The resulting m=3 scalars use their separate result reservation.

Arguments: `[{"kind":"string","value":"ﬃ"}]`.

Mapping and context calculation: `{"originalScalars":["U+FB03"],"n":"1","D":"3","scratchScalarCapacity":"3","perOriginalScalarMappings":[["U+0066","U+0066","U+0069"]],"outputScalars":["U+0066","U+0066","U+0069"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-foldcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+FB03"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 7 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-foldcase","scalar":"U+FB03","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0066","U+0066","U+0069"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ffi"}}`.

empty-fold uses `string-foldcase` at `foldcase-call`.

The original scan visits the required end at scalar index zero. There is no original scalar and therefore no map or mapping scratch reservation. One result allocation has extent zero and still reserves the complete empty string.

Arguments: `[{"kind":"string","value":""}]`.

Mapping and context calculation: `{"originalScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","perOriginalScalarMappings":[],"outputScalars":[],"m":"0","resultUtf8OctetCapacityBound":"0"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-foldcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 6 | `datum-allocate` | `result(0)` | 0 | `{"shape":"string","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 7 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":""}}`.

first-map-scratch-stop uses `string-upcase` at `upcase-call`.

Both input scalars and the required end are scanned first. The first map has extent n=2 and includes D*n=6 scratch scalar positions in its complete requirements. Its allocation refusal stops before any mapping or scratch creation; there is no second map or result allocation.

Arguments: `[{"kind":"string","value":"ßa"}]`.

Mapping and context calculation: `{"originalScalars":["U+00DF","U+0061"],"n":"2","D":"3","scratchScalarCapacity":"6","perOriginalScalarMappings":[["U+0053","U+0053"],["U+0041"]],"outputScalars":["U+0053","U+0053","U+0041"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-upcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0061"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-upcase","scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-upcase","event":"unicode-map","site":{"fixtureSite":"upcase-call","role":"unicode-map","path":[{"kind":"argument","index":"0"},{"kind":"field","name":"map"},{"kind":"scalar","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

mapped-result-stop uses `string-downcase` at `downcase-call`.

Both maps succeed in the reserved capacity-four scratch buffer. The result contains three scalars, so its refused allocation has extent m=3, with UTF-8 capacity bound twelve in its complete requirements. The refusal exposes no partial string and refunds no prior charge.

Arguments: `[{"kind":"string","value":"İA"}]`.

Mapping and context calculation: `{"originalScalars":["U+0130","U+0041"],"n":"2","D":"2","scratchScalarCapacity":"4","perOriginalScalarMappings":[["U+0069","U+0307"],["U+0061"]],"outputScalars":["U+0069","U+0307","U+0061"],"m":"3","resultUtf8OctetCapacityBound":"12"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0130"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0041"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-downcase","scalar":"U+0130","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":true,"contextScalarVisitBound":"2"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-downcase","scalar":"U+0041","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":false,"contextScalarVisitBound":"2"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0069","U+0307","U+0061"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-downcase","event":"datum-allocate","site":{"fixtureSite":"downcase-call","role":"datum-allocate","path":[{"kind":"result","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.unicode-context-event-traces"></a>

### Original Final_Sigma context reservations

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (string-downcase input)))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "final-sigma-at-end",
      "input": {
        "kind": "string",
        "value": "ΟΣ"
      }
    },
    {
      "case": "following-cased-prevents-final-sigma",
      "input": {
        "kind": "string",
        "value": "ΟΣΑ"
      }
    },
    {
      "case": "ignorable-on-both-sides",
      "input": {
        "kind": "string",
        "value": "ΌΣ́"
      }
    },
    {
      "case": "cased-after-ignorable-prevents-final-sigma",
      "input": {
        "kind": "string",
        "value": "ΟΣ́Α"
      }
    },
    {
      "case": "overlapping-property-is-no-preceding-witness",
      "input": {
        "kind": "string",
        "value": "ͅΣ"
      }
    },
    {
      "case": "overlapping-property-is-skipped-in-suffix",
      "input": {
        "kind": "string",
        "value": "AΣͅ"
      }
    }
  ],
  "fixtureSites": {
    "downcase-call": "The string-downcase call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "Final_Sigma reads original context within its map requirements. Following cased letters and Case_Ignorable scalars determine the result. Overlapping Cased and Case_Ignorable properties preserve the ignorable-first rule. Product invocation awaits its 2.0 adapter."
}
```

Final_Sigma reads original context within its map requirements. Following cased letters and Case_Ignorable scalars determine the result. Overlapping Cased and Case_Ignorable properties preserve the ignorable-first rule.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

final-sigma-at-end uses `string-downcase` at `downcase-call`.

U+039F is a preceding Cased scalar. U+03A3 has no following scalar, so Final_Sigma applies and returns U+03C2. U+039F lowers to U+03BF. All context comes from the original two-scalar string.

Arguments: `[{"kind":"string","value":"ΟΣ"}]`.

Mapping and context calculation: `{"originalScalars":["U+039F","U+03A3"],"n":"2","D":"2","scratchScalarCapacity":"4","perOriginalScalarMappings":[["U+03BF"],["U+03C2"]],"outputScalars":["U+03BF","U+03C2"],"m":"2","resultUtf8OctetCapacityBound":"8","originalContextEvaluation":[{"sigmaIndex":"1","precedingCased":true,"precedingWitness":"0","ignoredPrecedingIndices":[],"followingScalarVisits":[],"followingRequiredEnd":"2","followingCased":false,"Final_Sigma":true}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+039F"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+03A3"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-downcase","scalar":"U+039F","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":true,"contextScalarVisitBound":"2"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":false,"contextScalarVisitBound":"2"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 2 | `{"shape":"string","outputScalarCount":"2","outputScalars":["U+03BF","U+03C2"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ος"}}`.

following-cased-prevents-final-sigma uses `string-downcase` at `downcase-call`.

The preceding omicron is Cased, but the following original U+0391 is also Cased. Final_Sigma is false. UnicodeData supplies the ordinary U+03A3 to U+03C3 mapping; alpha lowers to U+03B1.

Arguments: `[{"kind":"string","value":"ΟΣΑ"}]`.

Mapping and context calculation: `{"originalScalars":["U+039F","U+03A3","U+0391"],"n":"3","D":"2","scratchScalarCapacity":"6","perOriginalScalarMappings":[["U+03BF"],["U+03C3"],["U+03B1"]],"outputScalars":["U+03BF","U+03C3","U+03B1"],"m":"3","resultUtf8OctetCapacityBound":"12","originalContextEvaluation":[{"sigmaIndex":"1","precedingCased":true,"precedingWitness":"0","ignoredPrecedingIndices":[],"followingScalarVisits":["2"],"followingRequiredEnd":null,"followingCased":true,"Final_Sigma":false}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+039F"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+03A3"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+0391"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"requiredEnd":"3","inputScalarCount":"3"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 3 | `{"operation":"string-downcase","scalar":"U+039F","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"3"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(1)` | 3 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"3"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(2)` | 3 | `{"operation":"string-downcase","scalar":"U+0391","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"3"}` | accepted |
| 12 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+03BF","U+03C3","U+03B1"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"οσα"}}`.

ignorable-on-both-sides uses `string-downcase` at `downcase-call`.

Both U+0301 scalars are Case_Ignorable. The preceding acute leaves the original omicron as the Cased witness. The following acute is skipped before the required end. Final_Sigma applies. The combining scalars stay in their original positions.

Arguments: `[{"kind":"string","value":"ΌΣ́"}]`.

Mapping and context calculation: `{"originalScalars":["U+039F","U+0301","U+03A3","U+0301"],"n":"4","D":"2","scratchScalarCapacity":"8","perOriginalScalarMappings":[["U+03BF"],["U+0301"],["U+03C2"],["U+0301"]],"outputScalars":["U+03BF","U+0301","U+03C2","U+0301"],"m":"4","resultUtf8OctetCapacityBound":"16","originalContextEvaluation":[{"sigmaIndex":"2","precedingCased":true,"precedingWitness":"0","ignoredPrecedingIndices":["1"],"followingScalarVisits":["3"],"followingRequiredEnd":"4","followingCased":false,"Final_Sigma":true}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+039F"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0301"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+03A3"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"scalar":"U+0301"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(4)` | — | `{"requiredEnd":"4","inputScalarCount":"4"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 4 | `{"operation":"string-downcase","scalar":"U+039F","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":true,"contextScalarVisitBound":"4"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(1)` | 4 | `{"operation":"string-downcase","scalar":"U+0301","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 12 | `unicode-map` | `argument(0), field(map), scalar(2)` | 4 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 13 | `unicode-map` | `argument(0), field(map), scalar(3)` | 4 | `{"operation":"string-downcase","scalar":"U+0301","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 14 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","outputScalarCount":"4","outputScalars":["U+03BF","U+0301","U+03C2","U+0301"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 15 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ός́"}}`.

cased-after-ignorable-prevents-final-sigma uses `string-downcase` at `downcase-call`.

The suffix visit first skips Case_Ignorable U+0301, then finds original Cased U+0391. Final_Sigma is false. Those suffix visits belong to the sigma map requirement; they add no scan event.

Arguments: `[{"kind":"string","value":"ΟΣ́Α"}]`.

Mapping and context calculation: `{"originalScalars":["U+039F","U+03A3","U+0301","U+0391"],"n":"4","D":"2","scratchScalarCapacity":"8","perOriginalScalarMappings":[["U+03BF"],["U+03C3"],["U+0301"],["U+03B1"]],"outputScalars":["U+03BF","U+03C3","U+0301","U+03B1"],"m":"4","resultUtf8OctetCapacityBound":"16","originalContextEvaluation":[{"sigmaIndex":"1","precedingCased":true,"precedingWitness":"0","ignoredPrecedingIndices":[],"followingScalarVisits":["2","3"],"followingRequiredEnd":null,"followingCased":true,"Final_Sigma":false}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+039F"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+03A3"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+0301"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"scalar":"U+0391"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(4)` | — | `{"requiredEnd":"4","inputScalarCount":"4"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 4 | `{"operation":"string-downcase","scalar":"U+039F","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":true,"contextScalarVisitBound":"4"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(1)` | 4 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 12 | `unicode-map` | `argument(0), field(map), scalar(2)` | 4 | `{"operation":"string-downcase","scalar":"U+0301","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 13 | `unicode-map` | `argument(0), field(map), scalar(3)` | 4 | `{"operation":"string-downcase","scalar":"U+0391","inputScalarCount":"4","mappingBound":"2","scratchScalarCapacity":"8","reserveScratch":false,"contextScalarVisitBound":"4"}` | accepted |
| 14 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","outputScalarCount":"4","outputScalars":["U+03BF","U+03C3","U+0301","U+03B1"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 15 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"οσ́α"}}`.

overlapping-property-is-no-preceding-witness uses `string-downcase` at `downcase-call`.

U+0345 is both Cased and Case_Ignorable. Case_Ignorable is tested first, so it does not establish a preceding Cased witness. Final_Sigma is false even at the end. U+0345 has no lowercase change and sigma uses U+03C3.

Arguments: `[{"kind":"string","value":"ͅΣ"}]`.

Mapping and context calculation: `{"originalScalars":["U+0345","U+03A3"],"n":"2","D":"2","scratchScalarCapacity":"4","perOriginalScalarMappings":[["U+0345"],["U+03C3"]],"outputScalars":["U+0345","U+03C3"],"m":"2","resultUtf8OctetCapacityBound":"8","originalContextEvaluation":[{"sigmaIndex":"1","precedingCased":false,"precedingWitness":null,"ignoredPrecedingIndices":["0"],"followingScalarVisits":[],"followingRequiredEnd":null,"followingCased":null,"Final_Sigma":false,"suffixRequired":false}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0345"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+03A3"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-downcase","scalar":"U+0345","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":true,"contextScalarVisitBound":"2"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"2","mappingBound":"2","scratchScalarCapacity":"4","reserveScratch":false,"contextScalarVisitBound":"2"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 2 | `{"shape":"string","outputScalarCount":"2","outputScalars":["U+0345","U+03C3"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ͅσ"}}`.

overlapping-property-is-skipped-in-suffix uses `string-downcase` at `downcase-call`.

Original U+0041 establishes the preceding Cased state. In the suffix, U+0345 is skipped as Case_Ignorable before testing Cased. The suffix then reaches its required end, so Final_Sigma applies. Neither the previous lowercase result nor a fold of U+0345 is consulted.

Arguments: `[{"kind":"string","value":"AΣͅ"}]`.

Mapping and context calculation: `{"originalScalars":["U+0041","U+03A3","U+0345"],"n":"3","D":"2","scratchScalarCapacity":"6","perOriginalScalarMappings":[["U+0061"],["U+03C2"],["U+0345"]],"outputScalars":["U+0061","U+03C2","U+0345"],"m":"3","resultUtf8OctetCapacityBound":"12","originalContextEvaluation":[{"sigmaIndex":"1","precedingCased":true,"precedingWitness":"0","ignoredPrecedingIndices":[],"followingScalarVisits":["2"],"followingRequiredEnd":"3","followingCased":false,"Final_Sigma":true}]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-downcase"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+03A3"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+0345"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"requiredEnd":"3","inputScalarCount":"3"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 3 | `{"operation":"string-downcase","scalar":"U+0041","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"3"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(1)` | 3 | `{"operation":"string-downcase","scalar":"U+03A3","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"3"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(2)` | 3 | `{"operation":"string-downcase","scalar":"U+0345","inputScalarCount":"3","mappingBound":"2","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"3"}` | accepted |
| 12 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+0061","U+03C2","U+0345"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"aςͅ"}}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.normalization-envelope-event-traces"></a>

### Normalization scratch and stable ordering

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((selector (vector-ref input 0))
            (text (vector-ref input 1)))
        (let ((result (if (= selector 0) (string-normalize-nfc text) (if (= selector 1) (string-normalize-nfd text) (string-normalize-nfkd text)))))
          result))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "empty-normalization",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": ""
          }
        ]
      }
    },
    {
      "case": "long-stable-combining-run",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "À́̀́̀́̀́̀́̀́̀́̀́̀́̀́̀́̕̕̕̕̕̕̕̕̕̕̕"
          }
        ]
      }
    },
    {
      "case": "hangul-decomposition",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "각"
          }
        ]
      }
    },
    {
      "case": "hangul-composition",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "각"
          }
        ]
      }
    },
    {
      "case": "longest-compatibility-decomposition",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "ﷺ"
          }
        ]
      }
    },
    {
      "case": "four-scalar-canonical-decomposition",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "ᾂ"
          }
        ]
      }
    },
    {
      "case": "normalization-scratch-refused",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "ﷺ"
          }
        ]
      },
      "resourceBoundary": {
        "event": "unicode-normalize",
        "fixtureSite": "nfkd-call",
        "path": [
          {
            "kind": "argument",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through the complete original scalar scan and its required end",
        "selectedReservation": "insufficient remaining allocation for the complete normalization reservation, including both eighteen-scalar scratch buffers and counter support",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "nfc-call": "The string-normalize-nfc call in the result initializer.",
    "nfd-call": "The string-normalize-nfd call in the result initializer.",
    "nfkd-call": "The string-normalize-nfkd call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "One normalization event reserves complete scratch before transformation. Stable combining-class order preserves equal classes through long combining sequences. Canonical and compatibility bounds cover Hangul and the longest compatibility decomposition. Product invocation awaits its 2.0 adapter."
}
```

One normalization event reserves complete scratch before transformation. Stable combining-class order preserves equal classes through long combining sequences. Canonical and compatibility bounds cover Hangul and the longest compatibility decomposition.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

empty-normalization uses `string-normalize-nfc` at `nfc-call`.

The empty original has n=0. The required end is visited, then the single normalization event reserves two zero-length scalar buffers and the fixed 256-counter support. The result allocation has m=0 and still reserves the empty immutable string requirements.

Arguments: `[{"kind":"string","value":""}]`.

Scalar and storage calculation: `{"originalScalars":[],"originalScalarCount":"0","outputScalars":[],"outputScalarCount":"0","utf8Octets":"0","utf8CapacityBound":"0"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"requiredEnd":"0"}` | accepted |
| 6 | `unicode-normalize` | `argument(0)` | 0 | `{"form":"NFC","decompositionBoundPerScalar":"4","scratchScalarCapacities":["0","0"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"0"}` | accepted |
| 7 | `datum-allocate` | `result(0)` | 0 | `{"shape":"string","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 8 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":""}}`.

long-stable-combining-run uses `string-normalize-nfd` at `nfd-call`.

The original has one starter and eleven copies of U+0315 U+0300 U+0301, so n=34. U+0315 has canonical combining class 232. U+0300 and U+0301 each have class 230. None has a decomposition. Stable counting order places the twenty-two class-230 scalars first, preserving the alternating grave/acute order, followed by eleven class-232 scalars. NFD does not compose. The output has the same 34 scalars and 67 UTF-8 octets. The run contains 33 nonstarters, and no Stream-Safe separator is inserted. Each scratch buffer reserves 4*34=136 scalar positions, with 256 counters.

Arguments: `[{"kind":"string","value":"À́̀́̀́̀́̀́̀́̀́̀́̀́̀́̀́̕̕̕̕̕̕̕̕̕̕̕"}]`.

Scalar and storage calculation: `{"originalScalars":["U+0041","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301","U+0315","U+0300","U+0301"],"originalScalarCount":"34","outputScalars":["U+0041","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315"],"outputScalarCount":"34","utf8Octets":"67","utf8CapacityBound":"136","steps":{"inputRecipe":"U+0041 followed by eleven copies of [U+0315,U+0300,U+0301]","outputRecipe":"U+0041 followed by eleven copies of [U+0300,U+0301], then eleven U+0315","decomposedLength":"34","nonstarterRunLengths":["33"],"scratchScalarCapacities":["136","136"]}}`.

Unicode source rows: `["UnicodeData.txt:66 U+0041 CCC=0","UnicodeData.txt:769 U+0300 CCC=230","UnicodeData.txt:770 U+0301 CCC=230","UnicodeData.txt:790 U+0315 CCC=232"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0315"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+0300"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"scalar":"U+0301"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(4)` | — | `{"scalar":"U+0315"}` | accepted |
| 10 | `text-scalar-scan` | `argument(0), field(scan), scalar(5)` | — | `{"scalar":"U+0300"}` | accepted |
| 11 | `text-scalar-scan` | `argument(0), field(scan), scalar(6)` | — | `{"scalar":"U+0301"}` | accepted |
| 12 | `text-scalar-scan` | `argument(0), field(scan), scalar(7)` | — | `{"scalar":"U+0315"}` | accepted |
| 13 | `text-scalar-scan` | `argument(0), field(scan), scalar(8)` | — | `{"scalar":"U+0300"}` | accepted |
| 14 | `text-scalar-scan` | `argument(0), field(scan), scalar(9)` | — | `{"scalar":"U+0301"}` | accepted |
| 15 | `text-scalar-scan` | `argument(0), field(scan), scalar(10)` | — | `{"scalar":"U+0315"}` | accepted |
| 16 | `text-scalar-scan` | `argument(0), field(scan), scalar(11)` | — | `{"scalar":"U+0300"}` | accepted |
| 17 | `text-scalar-scan` | `argument(0), field(scan), scalar(12)` | — | `{"scalar":"U+0301"}` | accepted |
| 18 | `text-scalar-scan` | `argument(0), field(scan), scalar(13)` | — | `{"scalar":"U+0315"}` | accepted |
| 19 | `text-scalar-scan` | `argument(0), field(scan), scalar(14)` | — | `{"scalar":"U+0300"}` | accepted |
| 20 | `text-scalar-scan` | `argument(0), field(scan), scalar(15)` | — | `{"scalar":"U+0301"}` | accepted |
| 21 | `text-scalar-scan` | `argument(0), field(scan), scalar(16)` | — | `{"scalar":"U+0315"}` | accepted |
| 22 | `text-scalar-scan` | `argument(0), field(scan), scalar(17)` | — | `{"scalar":"U+0300"}` | accepted |
| 23 | `text-scalar-scan` | `argument(0), field(scan), scalar(18)` | — | `{"scalar":"U+0301"}` | accepted |
| 24 | `text-scalar-scan` | `argument(0), field(scan), scalar(19)` | — | `{"scalar":"U+0315"}` | accepted |
| 25 | `text-scalar-scan` | `argument(0), field(scan), scalar(20)` | — | `{"scalar":"U+0300"}` | accepted |
| 26 | `text-scalar-scan` | `argument(0), field(scan), scalar(21)` | — | `{"scalar":"U+0301"}` | accepted |
| 27 | `text-scalar-scan` | `argument(0), field(scan), scalar(22)` | — | `{"scalar":"U+0315"}` | accepted |
| 28 | `text-scalar-scan` | `argument(0), field(scan), scalar(23)` | — | `{"scalar":"U+0300"}` | accepted |
| 29 | `text-scalar-scan` | `argument(0), field(scan), scalar(24)` | — | `{"scalar":"U+0301"}` | accepted |
| 30 | `text-scalar-scan` | `argument(0), field(scan), scalar(25)` | — | `{"scalar":"U+0315"}` | accepted |
| 31 | `text-scalar-scan` | `argument(0), field(scan), scalar(26)` | — | `{"scalar":"U+0300"}` | accepted |
| 32 | `text-scalar-scan` | `argument(0), field(scan), scalar(27)` | — | `{"scalar":"U+0301"}` | accepted |
| 33 | `text-scalar-scan` | `argument(0), field(scan), scalar(28)` | — | `{"scalar":"U+0315"}` | accepted |
| 34 | `text-scalar-scan` | `argument(0), field(scan), scalar(29)` | — | `{"scalar":"U+0300"}` | accepted |
| 35 | `text-scalar-scan` | `argument(0), field(scan), scalar(30)` | — | `{"scalar":"U+0301"}` | accepted |
| 36 | `text-scalar-scan` | `argument(0), field(scan), scalar(31)` | — | `{"scalar":"U+0315"}` | accepted |
| 37 | `text-scalar-scan` | `argument(0), field(scan), scalar(32)` | — | `{"scalar":"U+0300"}` | accepted |
| 38 | `text-scalar-scan` | `argument(0), field(scan), scalar(33)` | — | `{"scalar":"U+0301"}` | accepted |
| 39 | `text-scalar-scan` | `argument(0), field(scan), scalar(34)` | — | `{"requiredEnd":"34"}` | accepted |
| 40 | `unicode-normalize` | `argument(0)` | 34 | `{"form":"NFD","decompositionBoundPerScalar":"4","scratchScalarCapacities":["136","136"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"34"}` | accepted |
| 41 | `datum-allocate` | `result(0)` | 34 | `{"shape":"string","outputScalarCount":"34","outputScalars":["U+0041","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0300","U+0301","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315","U+0315"],"utf8CapacityBound":"136","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 42 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"À́̀́̀́̀́̀́̀́̀́̀́̀́̀́̀́̕̕̕̕̕̕̕̕̕̕̕"}}`.

hangul-decomposition uses `string-normalize-nfd` at `nfd-call`.

For U+AC01, SIndex=AC01-AC00=1. With NCount=21*28=588, LIndex=0, VIndex=0, TIndex=1. The Hangul algorithm yields U+1100, U+1161, and U+11A8. Each is three UTF-8 octets. Thus n=1, D=4, each scratch capacity is 4, m=3, and the result UTF-8 bound is 12.

Arguments: `[{"kind":"string","value":"각"}]`.

Scalar and storage calculation: `{"originalScalars":["U+AC01"],"originalScalarCount":"1","outputScalars":["U+1100","U+1161","U+11A8"],"outputScalarCount":"3","utf8Octets":"9","utf8CapacityBound":"12","steps":{"SBase":"U+AC00","LBase":"U+1100","VBase":"U+1161","TBase":"U+11A7","SIndex":"1","NCount":"588","LIndex":"0","VIndex":"0","TIndex":"1"}}`.

Unicode source rows: `["UnicodeData.txt:15238..15239 U+AC00..U+D7A3 Hangul Syllable range","UnicodeData.txt:3821 U+1100","UnicodeData.txt:3918 U+1161","UnicodeData.txt:3989 U+11A8"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+AC01"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFD","decompositionBoundPerScalar":"4","scratchScalarCapacities":["4","4"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 3 | `{"shape":"string","outputScalarCount":"3","outputScalars":["U+1100","U+1161","U+11A8"],"utf8CapacityBound":"12","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"각"}}`.

hangul-composition uses `string-normalize-nfc` at `nfc-call`.

The Hangul composition algorithm combines U+1100 with U+1161 to form U+AC00, then combines U+AC00 with U+11A8 to form U+AC01. The three original scalars all have combining class zero. Thus n=3, each canonical scratch capacity is 12, m=1, and the result uses three UTF-8 octets under bound 4.

Arguments: `[{"kind":"string","value":"각"}]`.

Scalar and storage calculation: `{"originalScalars":["U+1100","U+1161","U+11A8"],"originalScalarCount":"3","outputScalars":["U+AC01"],"outputScalarCount":"1","utf8Octets":"3","utf8CapacityBound":"4","steps":{"firstComposition":["U+1100","U+1161","U+AC00"],"secondComposition":["U+AC00","U+11A8","U+AC01"]}}`.

Unicode source rows: `["UnicodeData.txt:15238..15239 U+AC00..U+D7A3 Hangul Syllable range","UnicodeData.txt:3821 U+1100","UnicodeData.txt:3918 U+1161","UnicodeData.txt:3989 U+11A8"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+1100"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+1161"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"scalar":"U+11A8"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(3)` | — | `{"requiredEnd":"3"}` | accepted |
| 9 | `unicode-normalize` | `argument(0)` | 3 | `{"form":"NFC","decompositionBoundPerScalar":"4","scratchScalarCapacities":["12","12"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"3"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","outputScalarCount":"1","outputScalars":["U+AC01"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"각"}}`.

longest-compatibility-decomposition uses `string-normalize-nfkd` at `nfkd-call`.

UnicodeData gives U+FDFA the compatibility decomposition 0635 0644 0649 0020 0627 0644 0644 0647 0020 0639 0644 064A 0647 0020 0648 0633 0644 0645. These eighteen scalars have no further decomposition and all have combining class zero. There are fifteen two-octet Arabic letters and three one-octet spaces: 33 UTF-8 octets. Each scratch buffer reserves 18 positions for n=1; result extent is m=18 and the UTF-8 bound is 72.

Arguments: `[{"kind":"string","value":"ﷺ"}]`.

Scalar and storage calculation: `{"originalScalars":["U+FDFA"],"originalScalarCount":"1","outputScalars":["U+0635","U+0644","U+0649","U+0020","U+0627","U+0644","U+0644","U+0647","U+0020","U+0639","U+0644","U+064A","U+0647","U+0020","U+0648","U+0633","U+0644","U+0645"],"outputScalarCount":"18","utf8Octets":"33","utf8CapacityBound":"72"}`.

Unicode source rows: `["UnicodeData.txt:16500 U+FDFA <isolated> decomposition","UnicodeData.txt:33 U+0020 and 1538/1550/1552/1556/1567/1568/1570..1573 Arabic scalar rows"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfkd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+FDFA"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFKD","decompositionBoundPerScalar":"18","scratchScalarCapacities":["18","18"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 18 | `{"shape":"string","outputScalarCount":"18","outputScalars":["U+0635","U+0644","U+0649","U+0020","U+0627","U+0644","U+0644","U+0647","U+0020","U+0639","U+0644","U+064A","U+0647","U+0020","U+0648","U+0633","U+0644","U+0645"],"utf8CapacityBound":"72","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"صلى الله عليه وسلم"}}`.

four-scalar-canonical-decomposition uses `string-normalize-nfd` at `nfd-call`.

UnicodeData decomposes U+1F82 to U+1F02 U+0345, U+1F02 to U+1F00 U+0300, and U+1F00 to U+03B1 U+0313. Full canonical decomposition is U+03B1 U+0313 U+0300 U+0345. The classes are 0, 230, 230, 240. Stable order retains U+0313 before U+0300. Hence n=1, each scratch capacity is 4, m=4, and all four output scalars use two UTF-8 octets, for 8 octets under bound 16.

Arguments: `[{"kind":"string","value":"ᾂ"}]`.

Scalar and storage calculation: `{"originalScalars":["U+1F82"],"originalScalarCount":"1","outputScalars":["U+03B1","U+0313","U+0300","U+0345"],"outputScalarCount":"4","utf8Octets":"8","utf8CapacityBound":"16"}`.

Unicode source rows: `["UnicodeData.txt:7275 U+1F82","UnicodeData.txt:7161 U+1F02","UnicodeData.txt:7159 U+1F00","UnicodeData.txt:937 U+03B1","UnicodeData.txt:788 U+0313","UnicodeData.txt:769 U+0300","UnicodeData.txt:838 U+0345"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+1F82"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFD","decompositionBoundPerScalar":"4","scratchScalarCapacities":["4","4"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","outputScalarCount":"4","outputScalars":["U+03B1","U+0313","U+0300","U+0345"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"ᾂ"}}`.

normalization-scratch-refused uses `string-normalize-nfkd` at `nfkd-call`.

The fixed compatibility bound D=18 and original count n=1 require two eighteen-scalar buffers and 256 counters. Refusal of that complete normalization reservation performs no decomposition, ordering, composition, or result allocation. The raw U+FDFA row independently establishes the successful eighteen-scalar result.

Arguments: `[{"kind":"string","value":"ﷺ"}]`.

Scalar and storage calculation: `{"originalScalars":["U+FDFA"],"originalScalarCount":"1","outputScalars":["U+0635","U+0644","U+0649","U+0020","U+0627","U+0644","U+0644","U+0647","U+0020","U+0639","U+0644","U+064A","U+0647","U+0020","U+0648","U+0633","U+0644","U+0645"],"outputScalarCount":"18","utf8Octets":"33","utf8CapacityBound":"72"}`.

Unicode source rows: `["UnicodeData.txt:16500 U+FDFA <isolated> decomposition"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfkd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+FDFA"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFKD","decompositionBoundPerScalar":"18","scratchScalarCapacities":["18","18"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-normalize-nfkd","event":"unicode-normalize","site":{"fixtureSite":"nfkd-call","role":"unicode-normalize","path":[{"kind":"argument","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: reports/tr15/tr15-57.html at Unicode-17.0.0](https://www.unicode.org/reports/tr15/tr15-57.html)

<a id="lispex.example.v2.values.unicode-result-extent-event-traces"></a>

### Unicode result scalar extents

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((selector (vector-ref input 0))
            (text (vector-ref input 1)))
        (let ((result (if (= selector 0) (string-normalize-nfc text) (if (= selector 1) (string-normalize-nfd text) (string-normalize-nfkc text)))))
          result))))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "composed-output-count",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "é"
          }
        ]
      }
    },
    {
      "case": "decomposed-output-count",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "é"
          }
        ]
      }
    },
    {
      "case": "supplementary-scalar-count",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "😀"
          }
        ]
      }
    },
    {
      "case": "compatibility-output-count",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "ﷺ"
          }
        ]
      }
    },
    {
      "case": "normalized-result-refused",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "é"
          }
        ]
      },
      "resourceBoundary": {
        "event": "datum-allocate",
        "fixtureSite": "nfc-call",
        "path": [
          {
            "kind": "result",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through the complete original scan and the one normalization event",
        "selectedReservation": "insufficient remaining allocation for the complete one-scalar result string and its physical encoding support",
        "otherAxes": "sufficient"
      }
    },
    {
      "case": "empty-normalized-result-refused",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": ""
          }
        ]
      },
      "resourceBoundary": {
        "event": "datum-allocate",
        "fixtureSite": "nfc-call",
        "path": [
          {
            "kind": "result",
            "index": "0"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through the complete original scan and the one normalization event",
        "selectedReservation": "insufficient remaining allocation for the complete empty string result despite its zero scalar extent",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "nfc-call": "The string-normalize-nfc call in the result initializer.",
    "nfd-call": "The string-normalize-nfd call in the result initializer.",
    "nfkc-call": "The string-normalize-nfkc call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "String result extents count actual output scalars. Input counts, decomposition capacities, and UTF-8 octet lengths remain separate semantic or physical requirements. Empty output and refused output reservations keep their declared sites. Product invocation awaits its 2.0 adapter."
}
```

String result extents count actual output scalars. Input counts, decomposition capacities, and UTF-8 octet lengths remain separate semantic or physical requirements. Empty output and refused output reservations keep their declared sites.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

composed-output-count uses `string-normalize-nfc` at `nfc-call`.

UnicodeData gives U+00E9 the canonical decomposition U+0065 U+0301. U+00E9 is not composition-excluded. NFC composes the two input scalars into U+00E9. Thus original n=2, result m=1, actual UTF-8 octets=2, and capacity bound=4. Result extent is 1.

Arguments: `[{"kind":"string","value":"é"}]`.

Scalar and storage calculation: `{"originalScalars":["U+0065","U+0301"],"originalScalarCount":"2","outputScalars":["U+00E9"],"outputScalarCount":"1","utf8Octets":"2","utf8CapacityBound":"4"}`.

Unicode source rows: `["UnicodeData.txt:102 U+0065","UnicodeData.txt:234 U+00E9 -> 0065 0301","UnicodeData.txt:770 U+0301 CCC=230","CompositionExclusions.txt: U+00E9 absent"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0065"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0301"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2"}` | accepted |
| 8 | `unicode-normalize` | `argument(0)` | 2 | `{"form":"NFC","decompositionBoundPerScalar":"4","scratchScalarCapacities":["8","8"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"2"}` | accepted |
| 9 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","outputScalarCount":"1","outputScalars":["U+00E9"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 10 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"é"}}`.

decomposed-output-count uses `string-normalize-nfd` at `nfd-call`.

U+00E9 decomposes into U+0065 U+0301, already in canonical order. Thus original n=1, result m=2, actual UTF-8 octets=1+2=3, and capacity bound=8. Result extent is 2.

Arguments: `[{"kind":"string","value":"é"}]`.

Scalar and storage calculation: `{"originalScalars":["U+00E9"],"originalScalarCount":"1","outputScalars":["U+0065","U+0301"],"outputScalarCount":"2","utf8Octets":"3","utf8CapacityBound":"8"}`.

Unicode source rows: `["UnicodeData.txt:234 U+00E9 -> 0065 0301","UnicodeData.txt:102 U+0065 CCC=0","UnicodeData.txt:770 U+0301 CCC=230"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00E9"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFD","decompositionBoundPerScalar":"4","scratchScalarCapacities":["4","4"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 2 | `{"shape":"string","outputScalarCount":"2","outputScalars":["U+0065","U+0301"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"é"}}`.

supplementary-scalar-count uses `string-normalize-nfd` at `nfd-call`.

UnicodeData assigns U+1F600 no decomposition and combining class zero. NFD preserves this single supplementary scalar. Result extent is m=1, although its UTF-8 representation has four octets. The physical UTF-8 bound is also 4.

Arguments: `[{"kind":"string","value":"😀"}]`.

Scalar and storage calculation: `{"originalScalars":["U+1F600"],"originalScalarCount":"1","outputScalars":["U+1F600"],"outputScalarCount":"1","utf8Octets":"4","utf8CapacityBound":"4"}`.

Unicode source rows: `["UnicodeData.txt:38298 U+1F600"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfd"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+1F600"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFD","decompositionBoundPerScalar":"4","scratchScalarCapacities":["4","4"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"none","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","outputScalarCount":"1","outputScalars":["U+1F600"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"😀"}}`.

compatibility-output-count uses `string-normalize-nfkc` at `nfkc-call`.

UnicodeData gives U+FDFA the compatibility decomposition 0635 0644 0649 0020 0627 0644 0644 0647 0020 0639 0644 064A 0647 0020 0648 0633 0644 0645. These eighteen scalars have no further decomposition and all have combining class zero. There are fifteen two-octet Arabic letters and three one-octet spaces: 33 UTF-8 octets. Each scratch buffer reserves 18 positions for n=1; result extent is m=18 and the UTF-8 bound is 72. NFKC adds no composition: these class-zero Arabic letters and spaces do not form canonical composition pairs.

Arguments: `[{"kind":"string","value":"ﷺ"}]`.

Scalar and storage calculation: `{"originalScalars":["U+FDFA"],"originalScalarCount":"1","outputScalars":["U+0635","U+0644","U+0649","U+0020","U+0627","U+0644","U+0644","U+0647","U+0020","U+0639","U+0644","U+064A","U+0647","U+0020","U+0648","U+0633","U+0644","U+0645"],"outputScalarCount":"18","utf8Octets":"33","utf8CapacityBound":"72"}`.

Unicode source rows: `["UnicodeData.txt:16500 U+FDFA <isolated> decomposition","UnicodeData.txt:33 U+0020 and Arabic rows 1538/1550/1552/1556/1567/1568/1570..1573"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfkc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+FDFA"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1"}` | accepted |
| 7 | `unicode-normalize` | `argument(0)` | 1 | `{"form":"NFKC","decompositionBoundPerScalar":"18","scratchScalarCapacities":["18","18"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"1"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 18 | `{"shape":"string","outputScalarCount":"18","outputScalars":["U+0635","U+0644","U+0649","U+0020","U+0627","U+0644","U+0644","U+0647","U+0020","U+0639","U+0644","U+064A","U+0647","U+0020","U+0648","U+0633","U+0644","U+0645"],"utf8CapacityBound":"72","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"string","value":"صلى الله عليه وسلم"}}`.

normalized-result-refused uses `string-normalize-nfc` at `nfc-call`.

The complete original scan and normalization succeed. The actual output is one U+00E9 scalar, so the following allocation has extent 1. Refusing that event exposes no string and adds no call-return. The earlier normalization reservation remains charged.

Arguments: `[{"kind":"string","value":"é"}]`.

Scalar and storage calculation: `{"originalScalars":["U+0065","U+0301"],"originalScalarCount":"2","outputScalars":["U+00E9"],"outputScalarCount":"1","utf8Octets":"2","utf8CapacityBound":"4"}`.

Unicode source rows: `["UnicodeData.txt:234 U+00E9 -> 0065 0301","CompositionExclusions.txt: U+00E9 absent"]`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0065"}` | accepted |
| 6 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0301"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2"}` | accepted |
| 8 | `unicode-normalize` | `argument(0)` | 2 | `{"form":"NFC","decompositionBoundPerScalar":"4","scratchScalarCapacities":["8","8"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"2"}` | accepted |
| 9 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","outputScalarCount":"1","outputScalars":["U+00E9"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-normalize-nfc","event":"datum-allocate","site":{"fixtureSite":"nfc-call","role":"datum-allocate","path":[{"kind":"result","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

empty-normalized-result-refused uses `string-normalize-nfc` at `nfc-call`.

The empty scan end and normalization event succeed. The following datum-allocate still reserves the empty string header and result slot at extent 0. Refusing that reservation returns no partial result and no call-return.

Arguments: `[{"kind":"string","value":""}]`.

Scalar and storage calculation: `{"originalScalars":[],"originalScalarCount":"0","outputScalars":[],"outputScalarCount":"0","utf8Octets":"0","utf8CapacityBound":"0"}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-normalize-nfc"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"1"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"1","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"requiredEnd":"0"}` | accepted |
| 6 | `unicode-normalize` | `argument(0)` | 0 | `{"form":"NFC","decompositionBoundPerScalar":"4","scratchScalarCapacities":["0","0"],"combiningClassCounters":"256","ordering":"stable-counting-order-within-nonstarter-runs","composition":"in-place","inputScalarCount":"0"}` | accepted |
| 7 | `datum-allocate` | `result(0)` | 0 | `{"shape":"string","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-normalize-nfc","event":"datum-allocate","site":{"fixtureSite":"nfc-call","role":"datum-allocate","path":[{"kind":"result","index":"0"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: reports/tr15/tr15-57.html at Unicode-17.0.0](https://www.unicode.org/reports/tr15/tr15-57.html)

<a id="lispex.example.v2.values.unicode-fold-retention-event-traces"></a>

### Folded operand retention

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (string-ci=? (vector-ref input 0) (vector-ref input 1) (vector-ref input 2))))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "fold-third-argument-before-first-false-pair",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "string",
            "value": "B"
          },
          {
            "kind": "string",
            "value": "a"
          },
          {
            "kind": "string",
            "value": "ß"
          }
        ]
      }
    },
    {
      "case": "third-domain-failure-before-any-fold",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "string",
            "value": "B"
          },
          {
            "kind": "string",
            "value": "a"
          },
          {
            "kind": "integer",
            "value": "7"
          }
        ]
      }
    },
    {
      "case": "third-folded-result-stop-before-false-comparison",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "string",
            "value": "B"
          },
          {
            "kind": "string",
            "value": "a"
          },
          {
            "kind": "string",
            "value": "ß"
          }
        ]
      },
      "resourceBoundary": {
        "event": "datum-allocate",
        "fixtureSite": "retain-call",
        "path": [
          {
            "kind": "result",
            "index": "2"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through every preceding event in the selected call trace",
        "selectedReservation": "insufficient remaining allocation for the complete folded result of argument 2; no replacement for that position or later comparison occurs",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "retain-call": "The string-ci=? call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "All domains complete before each argument is folded and retained in its existing call position. Every fold precedes comparison, including when the first pair will be false. A later domain or result refusal keeps that earlier failure order. Product invocation awaits its 2.0 adapter."
}
```

All domains complete before each argument is folded and retained in its existing call position. Every fold precedes comparison, including when the first pair will be false. A later domain or result refusal keeps that earlier failure order.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

fold-third-argument-before-first-false-pair uses `string-ci=?` at `retain-call`.

The three domains complete first. B folds to b, a stays a, and sharp s folds to ss. Each completed folded string replaces only its own retained call operand. The third fold and result(2) complete before the first pair compares b with a and returns false. There is no comparison of arguments one and two.

Arguments: `[{"kind":"string","value":"B"},{"kind":"string","value":"a"},{"kind":"string","value":"ß"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0042"],"perOriginalScalarMappings":[["U+0062"]],"foldedScalars":["U+0062"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0061"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+00DF"],"perOriginalScalarMappings":[["U+0073","U+0073"]],"foldedScalars":["U+0073","U+0073"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"2","resultUtf8OctetCapacityBound":"8","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"1","outputScalars":["U+0062"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0061"}` | accepted |
| 12 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 13 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0061","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 14 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 15 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 16 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 17 | `unicode-map` | `argument(2), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 18 | `datum-allocate` | `result(2)` | 2 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"2","outputScalars":["U+0073","U+0073"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 19 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0062"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 20 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":false}}`.

third-domain-failure-before-any-fold uses `string-ci=?` at `retain-call`.

Argument two is an integer where a string is required. Its argument-check detects domain.type and the diagnostic payload is reserved at that argument path. No argument has been scanned, folded, or replaced, even though the first two strings would compare unequal.

Arguments: `[{"kind":"string","value":"B"},{"kind":"string","value":"a"},{"kind":"integer","value":"7"}]`.

Mapping and context calculation: `{"perArgument":[],"replacementOrder":[],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `diagnostic-payload` | `argument(2)` | — | `{"condition":{"phase":"evaluate","code":"domain.type","data":{"operation":"string-ci=?","argument":"2","path":[],"expected":"string","actual":"integer"}},"codec":"the selected complete diagnostic codec"}` | accepted |

Outcome: `{"kind":"language-failure","valueCount":0,"condition":{"phase":"evaluate","code":"domain.type","data":{"operation":"string-ci=?","argument":"2","path":[],"expected":"string","actual":"integer"}}}`.

third-folded-result-stop-before-false-comparison uses `string-ci=?` at `retain-call`.

The first two folded results have been retained. The third argument sharp s folds to ss, then result(2) refuses its extent-two allocation. The call stops there. The unequal b/a pair has not been compared, so false cannot bypass the third folded result reservation.

Arguments: `[{"kind":"string","value":"B"},{"kind":"string","value":"a"},{"kind":"string","value":"ß"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0042"],"perOriginalScalarMappings":[["U+0062"]],"foldedScalars":["U+0062"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0061"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+00DF"],"perOriginalScalarMappings":[["U+0073","U+0073"]],"foldedScalars":["U+0073","U+0073"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"2","resultUtf8OctetCapacityBound":"8","replacementEvent":"datum-allocate","replacementCommitted":false}],"replacementOrder":["0","1"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"1","outputScalars":["U+0062"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0061"}` | accepted |
| 12 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 13 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0061","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 14 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 15 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 16 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 17 | `unicode-map` | `argument(2), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 18 | `datum-allocate` | `result(2)` | 2 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"2","outputScalars":["U+0073","U+0073"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-ci=?","event":"datum-allocate","site":{"fixtureSite":"retain-call","role":"datum-allocate","path":[{"kind":"result","index":"2"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.unicode-fold-result-site-event-traces"></a>

### Folded string result sites

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (string-ci=? input input input)))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "same-input-three-result-sites",
      "input": {
        "kind": "string",
        "value": "ßİ"
      }
    },
    {
      "case": "same-empty-input-three-result-sites",
      "input": {
        "kind": "string",
        "value": ""
      }
    },
    {
      "case": "second-shared-result-site-stop",
      "input": {
        "kind": "string",
        "value": "ßİ"
      },
      "resourceBoundary": {
        "event": "datum-allocate",
        "fixtureSite": "shared-input-call",
        "path": [
          {
            "kind": "result",
            "index": "1"
          }
        ],
        "axis": "allocation",
        "earlierReservations": "succeed through every preceding event in the selected call trace",
        "selectedReservation": "insufficient remaining allocation for the complete folded result of argument 1; no replacement for that position or later comparison occurs",
        "otherAxes": "sufficient"
      }
    }
  ],
  "fixtureSites": {
    "shared-input-call": "The string-ci=? call with the same input in all three argument positions, in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "Each folded string result uses result(i) for its original argument position. Repeated handles and empty strings preserve all argument-specific result reservations. Refusal keeps the exact generated-result site. Product invocation awaits its 2.0 adapter."
}
```

Each folded string result uses result(i) for its original argument position. Repeated handles and empty strings preserve all argument-specific result reservations. Refusal keeps the exact generated-result site.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

same-input-three-result-sites uses `string-ci=?` at `shared-input-call`.

One input value supplies all three argument positions. Each occurrence still scans the original two scalars, reserves its own capacity-six scratch, folds to s s i U+0307, and allocates extent four at result(0), result(1), or result(2). Each adjacent comparison reads four equal scalars and both ends. Sharing neither skips an event nor changes the original input.

Arguments: `[{"kind":"string","value":"ßİ"},{"kind":"string","value":"ßİ"},{"kind":"string","value":"ßİ"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+00DF","U+0130"],"perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"foldedScalars":["U+0073","U+0073","U+0069","U+0307"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"4","resultUtf8OctetCapacityBound":"16","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+00DF","U+0130"],"perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"foldedScalars":["U+0073","U+0073","U+0069","U+0307"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"4","resultUtf8OctetCapacityBound":"16","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+00DF","U+0130"],"perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"foldedScalars":["U+0073","U+0073","U+0069","U+0307"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"4","resultUtf8OctetCapacityBound":"16","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 12 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 14 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 15 | `text-scalar-scan` | `argument(1), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 16 | `unicode-map` | `argument(1), field(map), scalar(0)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 17 | `unicode-map` | `argument(1), field(map), scalar(1)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 18 | `datum-allocate` | `result(1)` | 4 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 19 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 20 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 21 | `text-scalar-scan` | `argument(2), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 22 | `unicode-map` | `argument(2), field(map), scalar(0)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 23 | `unicode-map` | `argument(2), field(map), scalar(1)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 24 | `datum-allocate` | `result(2)` | 4 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 25 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0073"},"rightRead":{"kind":"scalar","scalar":"U+0073"}}` | accepted |
| 26 | `compare-scalar` | `field(compare), argument(0), scalar(1)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"scalar","scalar":"U+0073"},"rightRead":{"kind":"scalar","scalar":"U+0073"}}` | accepted |
| 27 | `compare-scalar` | `field(compare), argument(0), scalar(2)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"2","leftRead":{"kind":"scalar","scalar":"U+0069"},"rightRead":{"kind":"scalar","scalar":"U+0069"}}` | accepted |
| 28 | `compare-scalar` | `field(compare), argument(0), scalar(3)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"3","leftRead":{"kind":"scalar","scalar":"U+0307"},"rightRead":{"kind":"scalar","scalar":"U+0307"}}` | accepted |
| 29 | `compare-scalar` | `field(compare), argument(0), scalar(4)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"4","leftRead":{"kind":"end","scalarIndex":"4"},"rightRead":{"kind":"end","scalarIndex":"4"}}` | accepted |
| 30 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0073"},"rightRead":{"kind":"scalar","scalar":"U+0073"}}` | accepted |
| 31 | `compare-scalar` | `field(compare), argument(1), scalar(1)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"scalar","scalar":"U+0073"},"rightRead":{"kind":"scalar","scalar":"U+0073"}}` | accepted |
| 32 | `compare-scalar` | `field(compare), argument(1), scalar(2)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"2","leftRead":{"kind":"scalar","scalar":"U+0069"},"rightRead":{"kind":"scalar","scalar":"U+0069"}}` | accepted |
| 33 | `compare-scalar` | `field(compare), argument(1), scalar(3)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"3","leftRead":{"kind":"scalar","scalar":"U+0307"},"rightRead":{"kind":"scalar","scalar":"U+0307"}}` | accepted |
| 34 | `compare-scalar` | `field(compare), argument(1), scalar(4)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"4","leftRead":{"kind":"end","scalarIndex":"4"},"rightRead":{"kind":"end","scalarIndex":"4"}}` | accepted |
| 35 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

same-empty-input-three-result-sites uses `string-ci=?` at `shared-input-call`.

Each empty original input performs one required-end scan and one extent-zero result allocation at its own argument-indexed result site. There is no mapping scratch. Two compare-scalar events each read the left end and then the right end at scalar zero. The three empty-result reservations are distinct and still require their complete aggregate storage.

Arguments: `[{"kind":"string","value":""},{"kind":"string","value":""},{"kind":"string","value":""}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 0 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 10 | `datum-allocate` | `result(1)` | 0 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 12 | `datum-allocate` | `result(2)` | 0 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"end","scalarIndex":"0"},"rightRead":{"kind":"end","scalarIndex":"0"}}` | accepted |
| 14 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"end","scalarIndex":"0"},"rightRead":{"kind":"end","scalarIndex":"0"}}` | accepted |
| 15 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

second-shared-result-site-stop uses `string-ci=?` at `shared-input-call`.

Every domain succeeds. Argument zero completes its extent-four result(0). Argument one performs its own original scan and maps; result(1) then refuses extent four. Argument two has no scan or map, and no comparison begins. A shared input cannot reuse result(0) to avoid this refusal.

Arguments: `[{"kind":"string","value":"ßİ"},{"kind":"string","value":"ßİ"},{"kind":"string","value":"ßİ"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+00DF","U+0130"],"perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"foldedScalars":["U+0073","U+0073","U+0069","U+0307"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"4","resultUtf8OctetCapacityBound":"16","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+00DF","U+0130"],"perOriginalScalarMappings":[["U+0073","U+0073"],["U+0069","U+0307"]],"foldedScalars":["U+0073","U+0073","U+0069","U+0307"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"4","resultUtf8OctetCapacityBound":"16","replacementEvent":"datum-allocate","replacementCommitted":false}],"replacementOrder":["0"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 12 | `datum-allocate` | `result(0)` | 4 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+00DF"}` | accepted |
| 14 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"scalar":"U+0130"}` | accepted |
| 15 | `text-scalar-scan` | `argument(1), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 16 | `unicode-map` | `argument(1), field(map), scalar(0)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+00DF","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 17 | `unicode-map` | `argument(1), field(map), scalar(1)` | 2 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0130","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 18 | `datum-allocate` | `result(1)` | 4 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"4","outputScalars":["U+0073","U+0073","U+0069","U+0307"],"utf8CapacityBound":"16","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | refused |

Outcome: `{"kind":"resource-stop","valueCount":0,"terminal":true,"axis":"allocation","operation":"string-ci=?","event":"datum-allocate","site":{"fixtureSite":"shared-input-call","role":"datum-allocate","path":[{"kind":"result","index":"1"}]},"diagnosticIdentity":{"phase":"evaluate","code":"resource.exhausted"},"partialResult":false}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.example.v2.values.unicode-fold-comparison-event-traces"></a>

### Folded scalar and end comparisons

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      (let ((result
              (cond
                ((= (vector-ref input 0) 0) (string-ci<? (vector-ref input 1) (vector-ref input 2) (vector-ref input 3)))
                ((= (vector-ref input 0) 1) (string-ci>? (vector-ref input 1) (vector-ref input 2) (vector-ref input 3)))
                ((= (vector-ref input 0) 2) (string-ci=? (vector-ref input 1) (vector-ref input 2) (vector-ref input 3) (vector-ref input 4)))
                (else (char-ci=? (vector-ref input 1) (vector-ref input 2) (vector-ref input 3))))))
        result)))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ],
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "Unicode 17.0.0",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the complete request unless a case selects a refusal"
  },
  "requests": [
    {
      "case": "empty-left-still-reads-right",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": ""
          },
          {
            "kind": "string",
            "value": "A"
          },
          {
            "kind": "string",
            "value": "B"
          }
        ]
      }
    },
    {
      "case": "nonempty-left-reads-right-end",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "B"
          },
          {
            "kind": "string",
            "value": "A"
          },
          {
            "kind": "string",
            "value": ""
          }
        ]
      }
    },
    {
      "case": "shorter-prefix-and-next-pair-restart",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "0"
          },
          {
            "kind": "string",
            "value": "A"
          },
          {
            "kind": "string",
            "value": "Aa"
          },
          {
            "kind": "string",
            "value": "AB"
          }
        ]
      }
    },
    {
      "case": "longer-left-prefix-and-next-pair-restart",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "1"
          },
          {
            "kind": "string",
            "value": "AB"
          },
          {
            "kind": "string",
            "value": "A"
          },
          {
            "kind": "string",
            "value": ""
          }
        ]
      }
    },
    {
      "case": "four-arguments-stop-at-second-false-pair",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "2"
          },
          {
            "kind": "string",
            "value": "A"
          },
          {
            "kind": "string",
            "value": "a"
          },
          {
            "kind": "string",
            "value": "B"
          },
          {
            "kind": "string",
            "value": "a"
          }
        ]
      }
    },
    {
      "case": "three-character-simple-folds-before-comparison",
      "input": {
        "kind": "vector",
        "items": [
          {
            "kind": "integer",
            "value": "3"
          },
          {
            "kind": "character",
            "value": "A"
          },
          {
            "kind": "character",
            "value": "a"
          },
          {
            "kind": "character",
            "value": "B"
          }
        ]
      }
    }
  ],
  "fixtureSites": {
    "less-call": "The string-ci<? call in the result initializer.",
    "greater-call": "The string-ci>? call in the result initializer.",
    "equal-four-call": "The four-argument string-ci=? call in the result initializer.",
    "char-call": "The char-ci=? call in the result initializer."
  },
  "traceScope": {
    "start": "callable-check after completed operator and operand evaluation",
    "end": "call-return or the committed first failure",
    "selectedCalls": "all mapped calls are in the initializer of result and are nontail",
    "otherRequestEvents": "retain their declared reservations outside this call trace"
  }
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "Each folded comparison position reserves both reads in one compare-scalar event, left before right. Ends distinguish equality and prefixes. Each adjacent pair restarts at scalar zero and the first false pair stops comparison. Product invocation awaits its 2.0 adapter."
}
```

Each folded comparison position reserves both reads in one compare-scalar event, left before right. Ends distinguish equality and prefixes. Each adjacent pair restarts at scalar zero and the first false pair stops comparison.

Each table gives the complete selected call trace from callable-check after operand evaluation through call-return or the committed failure. Every selected call is nontail. Input decoding, module initialization, operand evaluation, the enclosing let, and result encoding retain their own events in the complete request.

The request maps each fixtureSite label to one original call occurrence. Every row uses that occurrence and its exact event name as the site role. The path column gives its complete typed suffix. Extent counts declared semantic components: one scalar for a scalar map, original n scalars for each full map or normalization, and actual m scalars for a string result. A dash means null, with the complete event reservation still required. Extent zero retains the complete empty-result or empty-transformation requirements. The selected model supplies every requirement vector. The table inputs and fixture labels are documentation notation, not additional canonical site fields.

The calculations use the frozen Unicode 17.0.0 raw data and the declared reservation rules. A refused event performs none of its proposed effects.

empty-left-still-reads-right uses `string-ci<?` at `less-call`.

All three values fold before comparison. The first compare-scalar reads the left end and the right scalar a at index zero, so the empty string sorts first. The next pair restarts at zero and reads a then b. Both adjacent less-than relations are true.

Arguments: `[{"kind":"string","value":""},{"kind":"string","value":"A"},{"kind":"string","value":"B"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0041"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+0042"],"perOriginalScalarMappings":[["U+0062"]],"foldedScalars":["U+0062"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci<?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 8 | `datum-allocate` | `result(0)` | 0 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 9 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 10 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 11 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 12 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 14 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 15 | `unicode-map` | `argument(2), field(map), scalar(0)` | 1 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 16 | `datum-allocate` | `result(2)` | 1 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"1","outputScalars":["U+0062"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 17 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci<?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"end","scalarIndex":"0"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 18 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci<?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0062"}}` | accepted |
| 19 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

nonempty-left-reads-right-end uses `string-ci>?` at `greater-call`.

B and A fold to b and a. The empty third argument still receives result(2) with extent zero. The first pair reads b then a. The second reads a then the right end at zero. Both greater-than relations are true.

Arguments: `[{"kind":"string","value":"B"},{"kind":"string","value":"A"},{"kind":"string","value":""}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0042"],"perOriginalScalarMappings":[["U+0062"]],"foldedScalars":["U+0062"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0041"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci>?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-ci>?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"1","outputScalars":["U+0062"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 12 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 13 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci>?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 14 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 15 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 16 | `datum-allocate` | `result(2)` | 0 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 17 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci>?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0062"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 18 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci>?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"end","scalarIndex":"0"}}` | accepted |
| 19 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

shorter-prefix-and-next-pair-restart uses `string-ci<?` at `less-call`.

The folded strings are a, aa, and ab. Pair zero reads equal a scalars, then the left end and right a. Pair one restarts at zero, reads equal a scalars, then a and b. The shorter equal prefix and the later unequal pair both satisfy less-than.

Arguments: `[{"kind":"string","value":"A"},{"kind":"string","value":"Aa"},{"kind":"string","value":"AB"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0041"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0041","U+0061"],"perOriginalScalarMappings":[["U+0061"],["U+0061"]],"foldedScalars":["U+0061","U+0061"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"2","resultUtf8OctetCapacityBound":"8","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+0041","U+0042"],"perOriginalScalarMappings":[["U+0061"],["U+0062"]],"foldedScalars":["U+0061","U+0062"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"2","resultUtf8OctetCapacityBound":"8","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci<?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 9 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 10 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 11 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 12 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"scalar":"U+0061"}` | accepted |
| 13 | `text-scalar-scan` | `argument(1), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 14 | `unicode-map` | `argument(1), field(map), scalar(0)` | 2 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 15 | `unicode-map` | `argument(1), field(map), scalar(1)` | 2 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0061","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 16 | `datum-allocate` | `result(1)` | 2 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"2","outputScalars":["U+0061","U+0061"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 17 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 18 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"scalar":"U+0042"}` | accepted |
| 19 | `text-scalar-scan` | `argument(2), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 20 | `unicode-map` | `argument(2), field(map), scalar(0)` | 2 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 21 | `unicode-map` | `argument(2), field(map), scalar(1)` | 2 | `{"operation":"string-ci<?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 22 | `datum-allocate` | `result(2)` | 2 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"2","outputScalars":["U+0061","U+0062"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 23 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci<?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 24 | `compare-scalar` | `field(compare), argument(0), scalar(1)` | — | `{"operation":"string-ci<?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"end","scalarIndex":"1"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 25 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci<?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 26 | `compare-scalar` | `field(compare), argument(1), scalar(1)` | — | `{"operation":"string-ci<?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0062"}}` | accepted |
| 27 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

longer-left-prefix-and-next-pair-restart uses `string-ci>?` at `greater-call`.

The folded strings are ab, a, and empty. Pair zero reads equal a scalars, then b and the right end. Pair one restarts at zero and reads a then the right end. Both greater-than relations are true, with both reads inside each compare-scalar reservation.

Arguments: `[{"kind":"string","value":"AB"},{"kind":"string","value":"A"},{"kind":"string","value":""}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0041","U+0042"],"perOriginalScalarMappings":[["U+0061"],["U+0062"]],"foldedScalars":["U+0061","U+0062"],"n":"2","D":"3","scratchScalarCapacity":"6","m":"2","resultUtf8OctetCapacityBound":"8","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0041"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":[],"perOriginalScalarMappings":[],"foldedScalars":[],"n":"0","D":"3","scratchScalarCapacity":"0","m":"0","resultUtf8OctetCapacityBound":"0","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci>?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"scalar":"U+0042"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(2)` | — | `{"requiredEnd":"2","inputScalarCount":"2"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 2 | `{"operation":"string-ci>?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 11 | `unicode-map` | `argument(0), field(map), scalar(1)` | 2 | `{"operation":"string-ci>?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"2","mappingBound":"3","scratchScalarCapacity":"6","reserveScratch":false,"contextScalarVisitBound":"0"}` | accepted |
| 12 | `datum-allocate` | `result(0)` | 2 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"2","outputScalars":["U+0061","U+0062"],"utf8CapacityBound":"8","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 13 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 14 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 15 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci>?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 16 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 17 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"requiredEnd":"0","inputScalarCount":"0"}` | accepted |
| 18 | `datum-allocate` | `result(2)` | 0 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"0","outputScalars":[],"utf8CapacityBound":"0","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 19 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci>?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 20 | `compare-scalar` | `field(compare), argument(0), scalar(1)` | — | `{"operation":"string-ci>?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"scalar","scalar":"U+0062"},"rightRead":{"kind":"end","scalarIndex":"1"}}` | accepted |
| 21 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci>?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"end","scalarIndex":"0"}}` | accepted |
| 22 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":true}}`.

four-arguments-stop-at-second-false-pair uses `string-ci=?` at `equal-four-call`.

All four folds and result allocations complete first. Pair zero reads a/a and then both ends, so it is equal. Pair one restarts at zero and reads a/b, so the call returns false. Pair two is never compared, although its right argument was already folded and retained.

Arguments: `[{"kind":"string","value":"A"},{"kind":"string","value":"a"},{"kind":"string","value":"B"},{"kind":"string","value":"a"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0041"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"1","originalScalars":["U+0061"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"2","originalScalars":["U+0042"],"perOriginalScalarMappings":[["U+0062"]],"foldedScalars":["U+0062"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true},{"argument":"3","originalScalars":["U+0061"],"perOriginalScalarMappings":[["U+0061"]],"foldedScalars":["U+0061"],"n":"1","D":"3","scratchScalarCapacity":"3","m":"1","resultUtf8OctetCapacityBound":"4","replacementEvent":"datum-allocate","replacementCommitted":true}],"replacementOrder":["0","1","2","3"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"string-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"4"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"4","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"T"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"T"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"T"}` | accepted |
| 7 | `argument-check` | `argument(3)` | — | `{"domain":"T"}` | accepted |
| 8 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 9 | `text-scalar-scan` | `argument(0), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 10 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0041","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 11 | `datum-allocate` | `result(0)` | 1 | `{"shape":"string","retainedOperandPosition":"0","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 12 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0061"}` | accepted |
| 13 | `text-scalar-scan` | `argument(1), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 14 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0061","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 15 | `datum-allocate` | `result(1)` | 1 | `{"shape":"string","retainedOperandPosition":"1","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 16 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 17 | `text-scalar-scan` | `argument(2), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 18 | `unicode-map` | `argument(2), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0042","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 19 | `datum-allocate` | `result(2)` | 1 | `{"shape":"string","retainedOperandPosition":"2","outputScalarCount":"1","outputScalars":["U+0062"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 20 | `text-scalar-scan` | `argument(3), field(scan), scalar(0)` | — | `{"scalar":"U+0061"}` | accepted |
| 21 | `text-scalar-scan` | `argument(3), field(scan), scalar(1)` | — | `{"requiredEnd":"1","inputScalarCount":"1"}` | accepted |
| 22 | `unicode-map` | `argument(3), field(map), scalar(0)` | 1 | `{"operation":"string-ci=?","mapping":"full-fold","statuses":["C","F"],"scalar":"U+0061","inputScalarCount":"1","mappingBound":"3","scratchScalarCapacity":"3","reserveScratch":true,"contextScalarVisitBound":"0"}` | accepted |
| 23 | `datum-allocate` | `result(3)` | 1 | `{"shape":"string","retainedOperandPosition":"3","outputScalarCount":"1","outputScalars":["U+0061"],"utf8CapacityBound":"4","completeStorage":"immutable string header, value slot, encoding work, and temporary materialization storage"}` | accepted |
| 24 | `compare-scalar` | `field(compare), argument(0), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 25 | `compare-scalar` | `field(compare), argument(0), scalar(1)` | — | `{"operation":"string-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"scalarIndex":"1","leftRead":{"kind":"end","scalarIndex":"1"},"rightRead":{"kind":"end","scalarIndex":"1"}}` | accepted |
| 26 | `compare-scalar` | `field(compare), argument(1), scalar(0)` | — | `{"operation":"string-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"scalarIndex":"0","leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0062"}}` | accepted |
| 27 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":false}}`.

three-character-simple-folds-before-comparison uses `char-ci=?` at `char-call`.

CaseFolding status C maps A to a and B to b; a has no mapping and stays a. All three scalar scans and maps finish before comparison. Each map replaces its original call operand position. Character pairs each use one compare-scalar at field(compare), argument(left index), with no scalar suffix and no result allocation.

Arguments: `[{"kind":"character","value":"A"},{"kind":"character","value":"a"},{"kind":"character","value":"B"}]`.

Mapping and context calculation: `{"perArgument":[{"argument":"0","originalScalars":["U+0041"],"foldedScalars":["U+0061"],"replacementEvent":"unicode-map"},{"argument":"1","originalScalars":["U+0061"],"foldedScalars":["U+0061"],"replacementEvent":"unicode-map"},{"argument":"2","originalScalars":["U+0042"],"foldedScalars":["U+0062"],"replacementEvent":"unicode-map"}],"replacementOrder":["0","1","2"],"allArgumentsValidatedBeforeReplacement":true,"callerValuesUnchanged":true,"comparisonPairsVisited":[0,1]}`.

| Order | Event | Site path | Extent | Reservation input | Reservation |
| --- | --- | --- | --- | --- | --- |
| 1 | `callable-check` | `field(operator)` | — | `{"procedure":"char-ci=?"}` | accepted |
| 2 | `arity-check` | `empty` | — | `{"suppliedArguments":"3"}` | accepted |
| 3 | `call` | `empty` | — | `{"suppliedArguments":"3","tail":false}` | accepted |
| 4 | `argument-check` | `argument(0)` | — | `{"domain":"C"}` | accepted |
| 5 | `argument-check` | `argument(1)` | — | `{"domain":"C"}` | accepted |
| 6 | `argument-check` | `argument(2)` | — | `{"domain":"C"}` | accepted |
| 7 | `text-scalar-scan` | `argument(0), field(scan), scalar(0)` | — | `{"scalar":"U+0041"}` | accepted |
| 8 | `unicode-map` | `argument(0), field(map), scalar(0)` | 1 | `{"operation":"char-ci=?","mapping":"simple-fold","statuses":["C","S"],"scalar":"U+0041","inputScalarCount":"1","retainedOperandPosition":"0"}` | accepted |
| 9 | `text-scalar-scan` | `argument(1), field(scan), scalar(0)` | — | `{"scalar":"U+0061"}` | accepted |
| 10 | `unicode-map` | `argument(1), field(map), scalar(0)` | 1 | `{"operation":"char-ci=?","mapping":"simple-fold","statuses":["C","S"],"scalar":"U+0061","inputScalarCount":"1","retainedOperandPosition":"1"}` | accepted |
| 11 | `text-scalar-scan` | `argument(2), field(scan), scalar(0)` | — | `{"scalar":"U+0042"}` | accepted |
| 12 | `unicode-map` | `argument(2), field(map), scalar(0)` | 1 | `{"operation":"char-ci=?","mapping":"simple-fold","statuses":["C","S"],"scalar":"U+0042","inputScalarCount":"1","retainedOperandPosition":"2"}` | accepted |
| 13 | `compare-scalar` | `field(compare), argument(0)` | — | `{"operation":"char-ci=?","leftArgument":"0","rightArgument":"1","readOrder":["left","right"],"leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0061"}}` | accepted |
| 14 | `compare-scalar` | `field(compare), argument(1)` | — | `{"operation":"char-ci=?","leftArgument":"1","rightArgument":"2","readOrder":["left","right"],"leftRead":{"kind":"scalar","scalar":"U+0061"},"rightRead":{"kind":"scalar","scalar":"U+0062"}}` | accepted |
| 15 | `call-return` | `empty` | — | `{"valueCount":"1"}` | accepted |

Outcome: `{"kind":"value","valueCount":1,"datum":{"kind":"boolean","value":false}}`.

Source evidence:

- [document: reports/tr44/tr44-36.html at Unicode-17.0.0](https://www.unicode.org/reports/tr44/tr44-36.html)
- [document: versions/Unicode17.0.0/core-spec/chapter-3/ at Unicode-17.0.0](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/)

<a id="lispex.section.v2.values.record-mapping"></a>

## Record mapping

A host record is a collection of named fields supplied by the calling application. A profile can map it to an immutable association list. An association list is an ordinary list of pairs whose first component is a key and whose second component is the associated value.

The example below explicitly selects string keys and association-list mapping in its documentation request. It does not introduce a separate guest map kind or establish a public codec. The [profiles chapter](/v2.0/en/docs/profiles/) owns the concrete admission and interchange forms.

<a id="lispex.rule.v2.values.record-key-order"></a>

### Map admitted records in canonical key order

Apply the [host record conversion rule](/v2.0/en/docs/profiles#lispex.rule.v2.profiles.host-record-conversion) when a caller selects record admission.
That rule defines exact key preservation, duplicate checks, and canonical ordering.
The resulting value is ordinary association data under the Datum definition here.
The [record input contract](/v2.0/en/docs/profiles#lispex.rule.v2.profiles.record-input) fixes the separate host account and later evaluator decode.

**Why**

A record must produce the same data regardless of insertion order or host map storage. Duplicate rejection prevents the host from silently choosing one value for a repeated key.

<a id="lispex.claim.v2.values.record-key-order"></a>

Claim: `lispex.claim.v2.values.record-key-order` · boundary · coverage partial · verification not-run

- language: `lispex`
- languageVersion: `2.0`

```json
{
  "predicate": {
    "kind": "host-record-mapping",
    "admission": "profile-defined",
    "canonicalKeyOrder": "utf8-byte-lexicographic"
  },
  "result": {
    "kind": "deterministic-record-data",
    "exactKeys": true,
    "duplicates": "reject",
    "hostIterationChangesMeaning": false,
    "newGuestMapKind": false
  },
  "pendingCases": [
    "Native, npm, and WASM products require cases across every supported engine and architecture for each admitted key type, duplicate keys, UTF-8 ordering boundaries, insertion orders, and mapping size limits."
  ]
}
```

<a id="lispex.example.v2.values.record-key-cases"></a>

### Order exact keys and reject duplicates

Mode: illustrative. Stage: semantic-request. Verification: not-run.

- language: `lispex`
- languageVersion: `2.0`

File: `source.scm`

```lispex
(module main
  (import)
  (export rule)
  (entry rule)
  (define rule
    (lambda (input)
      input))
)
```

File: `request.json`

```lispex
{
  "notation": "documentation-request",
  "source": "source.scm",
  "semantics": {
    "language": "Lispex 2.0",
    "standardLibrary": "one fixed library identity",
    "unicode": "one fixed Unicode semantics version",
    "resourceModel": "one fixed finite resource model"
  },
  "limits": {
    "prepare": "finite values sufficient to prepare this source",
    "evaluate": "finite values sufficient for the stated finite calculation"
  },
  "requests": [
    {
      "input": {
        "kind": "host-record",
        "fields": [
          {
            "key": "b",
            "value": {
              "kind": "integer",
              "value": "2"
            }
          },
          {
            "key": "a",
            "value": {
              "kind": "integer",
              "value": "1"
            }
          }
        ]
      }
    },
    {
      "input": {
        "kind": "host-record",
        "fields": [
          {
            "key": "a",
            "value": {
              "kind": "integer",
              "value": "1"
            }
          },
          {
            "key": "a",
            "value": {
              "kind": "integer",
              "value": "2"
            }
          }
        ]
      }
    },
    {
      "input": {
        "kind": "host-record",
        "fields": [
          {
            "key": "é",
            "value": {
              "kind": "integer",
              "value": "1"
            }
          },
          {
            "key": "é",
            "value": {
              "kind": "integer",
              "value": "2"
            }
          },
          {
            "key": "A",
            "value": {
              "kind": "integer",
              "value": "3"
            }
          },
          {
            "key": "a",
            "value": {
              "kind": "integer",
              "value": "4"
            }
          }
        ]
      }
    }
  ],
  "recordMapping": {
    "admission": "this profile admits string-keyed host records",
    "datumRepresentation": "immutable association list of string-keyed pairs",
    "keyComparison": "exact Unicode scalar sequence",
    "keyOrder": "ascending unsigned UTF-8 bytes",
    "duplicateKeys": "reject before entry evaluation"
  },
  "rootModule": "main",
  "moduleSources": [
    {
      "name": "main",
      "source": "source.scm"
    }
  ]
}
```

Fixture inputs and environment:

```json
{
  "entry": "source.scm",
  "argv": [],
  "stdin": "",
  "cwd": ".",
  "environment": [],
  "wrapper": null,
  "packageRef": null,
  "lockRef": null,
  "generatedBindingRefs": {
    "knowledgeState": "not-applicable",
    "values": []
  }
}
```

#### Expected result

```json
{
  "status": "unspecified",
  "reason": "The first record becomes an association list ordered by a then b. The duplicate-key record is rejected before the entry runs. The last record preserves all four exact keys in UTF-8 order. Product invocation awaits its 2.0 adapter."
}
```

The request selects one admitted association-list mapping. Composed and decomposed keys remain distinct. Condition field names here describe meaning and do not freeze the wire format.

See [Canonical codec bytes](/v2.0/en/docs/profiles#lispex.rule.v2.profiles.datum-byte-format), [Concrete profile declarations](/v2.0/en/docs/profiles#lispex.rule.v2.profiles.profile-declarations).

<a id="lispex.section.v2.values.related"></a>

## Related chapters

[Exact numbers](/v2.0/en/docs/language/numbers)

[Procedures](/v2.0/en/docs/language/procedures)

[Standard library](/v2.0/en/docs/library)

[Profiles and value interchange](/v2.0/en/docs/profiles)

<a id="lispex.pending.v2.resources.model-numbers"></a>

### Pending · Resource model numbers

The 2.0 tariff coefficients, logical allocation units, bit-size accounting, detailed frame accounting, finite defaults, representation limits, and physical memory envelopes remain open. This includes preparation, calls, values, exact arithmetic, equality, text, record conversion, and canonical encoding.

Profile host budget coefficients and defaults remain separate from language preparation and evaluation budgets. Trace capacity, reservation sizes, and host memory requirements retain their separate reporting scope. Each budget retains its own identity and accounting boundary.

Implementation and attack tests must support these choices. [Resource event declarations](/v2.0/en/docs/language/resources#lispex.rule.v2.resources.event-catalog) and [native kernel membership](/v2.0/en/docs/library#lispex.pending.v2.standard-library.kernel-and-cost-model) remain separate contracts.

<a id="lispex.pending.v2.standard-library.kernel-and-cost-model"></a>

### Pending · Native kernel membership

The final native kernel list and count remain open. Implementation and product attack tests must support these choices. [Tariff coefficients, allocation units, finite defaults, and physical envelopes](/v2.0/en/docs/language/resources#lispex.pending.v2.resources.model-numbers) are tracked once with the resource numbers.

## Related

[Exact numbers](/v2.0/en/docs/language/numbers)

[Procedures](/v2.0/en/docs/language/procedures)

[Standard library](/v2.0/en/docs/library)

[Profiles and value interchange](/v2.0/en/docs/profiles)
