Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# v4 TS Algebra Inhabitance Widening Worksheet

> **Status:** L0 complete on `main` (implementation PR #4155).
> **Lane:** ALPHA/PREVIEW, not release-minimum.
> **Purpose:** provide stable TypeScript algebra fact IDs for leaf-model R2a/R2b claims, mirroring the Python #4117 pattern.

## Receipt

```text
Migration class:
TS-ALGEBRA-INHABITANCE-WIDENING

Representative failure:
TypeScript algebra inhabitance existed only as functions over `ts_facts_*`.
Leaf-model claim rows could not name a stable subject without duplicating
`AlgebraInhabitanceDecl` shapes.

Forbidden local patch:
Add TypeScript-specific Subject coproduct arms or hand-copy algebra
declarations into claim files.

DFS path:
std authority:
src/v4/std/model_core.dag - AlgebraInhabitanceDecl
extdeps authority:
src/v4/extdeps/languages/typescript.dag - exported fact rows
claim consumers:
src/v4/test/claim/language_model/typescript_r2a.dag
src/v4/test/claim/language_model/typescript_r2b.dag

Systemic fix:
Export top-level TypeScript fact rows from `typescript.dag`:
ts_number_algebra_inhabitance_ts_facts_number
ts_bigint_algebra_inhabitance_ts_facts_bigint
ts_bool_algebra_inhabitance_ts_facts_boolean
ts_string_algebra_inhabitance_ts_facts_string
```

## Claim Wiring

| Stable fact ID | Modeled algebra | L0 consumer |
| --- | --- | --- |
| `ts_number_algebra_inhabitance_ts_facts_number` | ECMA `number` / IEEE-754 approximate field | R2a |
| `ts_bigint_algebra_inhabitance_ts_facts_bigint` | ECMA `bigint` exact integer arithmetic | R2b |
| `ts_bool_algebra_inhabitance_ts_facts_boolean` | ECMA `boolean` Boolean algebra | follow-on claim surface |
| `ts_string_algebra_inhabitance_ts_facts_string` | UTF-16 string code-unit sequence | follow-on claim surface |

## L0 Acceptance

- `typescript_r2a.dag` references `ts_number_algebra_inhabitance_ts_facts_number`.
- `typescript_r2b.dag` references `ts_bigint_algebra_inhabitance_ts_facts_bigint`.
- No TypeScript-only Subject/Expectation coproduct was introduced.
- Downstream host receipts stay temporary under T-PB-B / `pb_rust_tests_outside_residual_zero`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# v4 TS Leaf-Model R2a / R2b / R3-external Worksheet

> **Status:** L0 complete on `main` (implementation PR #4157).
> **Lane:** ALPHA/PREVIEW, not release-minimum per Wave F F3.
> **Pattern:** mirrors Python #4117: modeled claim rows plus interim host runners and an SG-0 hand-test receipt.

## Receipt

```text
Migration class:
TS-LEAF-MODEL-R2-R3-EXTERNAL

Representative failure:
TypeScript numeric and Symbol facts were modeled, but no leaf-model
claim plus falsification runner exercised them against tsc/Node.

Forbidden local patch:
Hand-author TypeScript snippets in Rust tests without modeled claim IDs,
stable TypeScript fact IDs, and paired falsification probes.

DFS path:
std authority:
src/v4/std/leaf_model_verification.dag
extdeps authority:
src/v4/extdeps/languages/typescript.dag
fixture authority:
src/v4/lens/leaf_model_verification.dag
claim corpus:
src/v4/test/claim/language_model/typescript_r2a.dag
src/v4/test/claim/language_model/typescript_r2b.dag
src/v4/test/claim/language_model/typescript_r3_external.dag
interim host runners:
scripts/v4-leaf-model-typescript-r2a-verify.sh
scripts/v4-leaf-model-typescript-r2b-verify.sh
scripts/v4-leaf-model-typescript-r3-external-verify.sh

Systemic fix:
Three L0 TypeScript leaf-model claims with happy and falsification fixtures.
The hand-Rust boundary harness is temporary and paired with the SG-0 census
receipt, exactly like #4117.
```

## Claim Inventory

| Claim ID | Subject fact | Happy exercise | Falsification |
| --- | --- | --- | --- |
| `leaf_model_claim_ts_r2a_number_algebra_operations` | `ts_number_algebra_inhabitance_ts_facts_number` | `number` addition and comparison accepted by `tsc --strict` | `a.log2_exact()` rejected with TS2339 |
| `leaf_model_claim_ts_r2b_bigint_beyond_safe_integer` | `ts_bigint_algebra_inhabitance_ts_facts_bigint` | Node proves bigint add beyond `2**63` is exact | `number` lane demonstrates IEEE-754 precision divergence |
| `leaf_model_claim_ts_r3_external_symbol_projection` | `ts_atom_realization_symbol` | `const s: symbol = Symbol("x");` accepted | `new Symbol("x")` rejected as non-constructable |

## L0 Acceptance

- `src/v4/lens/leaf_model_verification.dag` owns the fixture source strings.
- The three `typescript_r*.dag` claim files reference TypeScript fact IDs by Symbol equality.
- `src/v3/compiler/tests/boundary/v4_leaf_model_typescript_r2_r3_external_test.rs` pins fixture bytes to the `.dag` authority and executes `tsc`/Node.
- `src/v3/compiler/tests/integration/sg0_census_test.rs` carries the net +1 hand-authored test receipt.
- `scripts/ci-merge/sg0-pr-body-append.4157.txt` records the P5(b) pairing and T-PB-B dissolution path.

## Non-Goals

- R1 primitive surface-spelling inventory.
- R3-internal row mutation receipts.
- TypeScript package/module layout modeling.
- Replacing the interim host runners before T-22 modeled `run_target_verification` owns target verdicts.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# v4 TS TargetAtomRealization Worksheet

> **Status:** L0 complete on `main` (implementation PR #4189).
> **Lane:** ALPHA/PREVIEW, not release-minimum.
> **Shared carrier authority:** `src/v4/std/target_model.dag` owns `TargetAtomRealization`; `typescript.dag` owns only the TypeScript rows.

## Receipt

```text
SG class:
TS-ATOM-REALIZATION

Representative failure:
TypeScript type and value emission for kernel atoms could invent shapes
independently when no per-target atom realization row existed.

Forbidden local patch:
Add TypeScript string-keyed Symbol/Bool/String branches in translate or
redefine the shared atom carrier in `typescript.dag`.

DFS path:
std authority:
src/v4/std/target_model.dag - TargetAtomRealization and catalog edge
extdeps authority:
src/v4/extdeps/languages/typescript.dag - TS rows and catalog
consumer:
src/v4/compiler/06_translate.dag - reads TargetModel realization data

Systemic fix:
Add TypeScript TargetAtomRealization rows for:
ts_target_atom_realization_symbol
ts_target_atom_realization_bool
ts_target_atom_realization_string
and expose them through `ts_target_atom_realization_catalog`.
```

## PM Mapping

| Shared/Rust anchor | TypeScript realization | L0 disposition |
| --- | --- | --- |
| Symbol | ECMA `symbol`, produced by `Symbol(description?)`, not `new Symbol` | required |
| Bool | `boolean` | required |
| Char | no TS primitive Char; substitute structural String | required substitution |
| Int | split across `number` and `bigint` facts | deferred as atom row |

## L0 Acceptance

- `ts_target_atom_realization_symbol` uses `symbol_kernel_type_node()` and `ValueSymbolIdentityPassthrough`.
- `ts_target_atom_realization_bool` uses `bool_node()` and `ValueBoolLiteral`.
- `ts_target_atom_realization_string` uses the structural string carrier and `ValueStringLiteral`.
- Each row's `type_form` consumes `ts_type_expression_projection().atom_form`.
- The TypeScript catalog is exposed through the target model atom-realizations edge.
- The smoke test `v4_typescript_language_model_declares_target_atom_realization_rows` covers Symbol/Bool/String rows and rejects a copied Rust Char row.

## Dissolution Path

The host smoke remains temporary under T-PB-B / `pb_rust_tests_outside_residual_zero`. It dissolves when `.dag` TestClaim execution and generated target verification cover the same TypeScript TargetModel catalog facts.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# v4 TS TargetTypeExpressionProjection Worksheet

> **Status:** L0 complete on `main` (implementation PR #4176).
> **Lane:** ALPHA/PREVIEW, not release-minimum.
> **Shared carrier authority:** `src/v4/std/target_model.dag` owns `TargetTypeExpressionProjection`; `typescript.dag` owns only the TypeScript row.

## Receipt

```text
SG class:
TS-TYPE-EXPRESSION-PROJECTION

Representative failure:
Generic TypeScript type emission could fall back to name-keyed compiler
branches for carriers such as Outcome<T> or Witness<C>.

Forbidden local patch:
Add Outcome/Witness/FooBar special cases to `06_translate.dag` for TypeScript.

DFS path:
std authority:
src/v4/std/target_model.dag - TargetTypeExpressionProjection
src/v4/std/node.dag - Node connective vocabulary
extdeps authority:
src/v4/extdeps/languages/typescript.dag - ts_type_expression_projection()
compiler consumer:
src/v4/compiler/06_translate.dag - projection readers and type-expression emit

Systemic fix:
Author `ts_type_expression_projection()` and attach its bundle edge to the
TypeScript TargetModel so type-expression emission derives syntax from row
data instead of target-name branches.
```

## Connective Mapping

| Connective | L0 TypeScript surface | Notes |
| --- | --- | --- |
| Atom | identifier or keyword primitive | `number`, `string`, `boolean`, `bigint`, `symbol` |
| Conj | `{ ... }` generic record surface | field-label fidelity remains gated |
| Disj | `A | B` | TypeScript union surface |
| Arrow | `(T) => U` structural function type | parameter-name fidelity remains gated |
| Cardinality | `Head<args>` generic collection | uses angle-bracket generic apply |
| Instantiation | `Foo<Bar, Baz>` | no Rust `::<>` syntax |

## L0 Acceptance

- `ts_type_expression_projection()` defines per-connective forms in `typescript.dag`.
- `ts_type_expression_projection_bundle_node()` serializes the row as named edges for the TargetModel bundle.
- `ts_sg2_type_expr_target_model_node()` attaches `target_model_edge_type_expression_projection`.
- `v4_std_target_realization_dag_smoke_test.rs` covers the shared carrier, Rust precedent, and TypeScript same-path expansion.
- No name-keyed Outcome/Witness/Refined TypeScript branch is introduced.

## Known Gated Gaps

- `target-function-type-named-param-binding`: the shared function-type carrier lacks parameter-name slots, so L0 does not claim faithful `(a: T) => U`.
- `target-record-field-label-binding`: the shared record carrier and serializer do not yet emit named field labels, so L0 does not claim faithful `{ id: T }`.

These gaps are explicitly bounded in `src/v4/extdeps/languages/typescript.dag` and must dissolve through shared carrier changes, not TypeScript-only row redefinition.
Loading