Files
vanity/README.md
T

37 lines
2.0 KiB
Markdown
Raw Normal View History

2026-02-11 17:24:09 +00:00
# vanity
executable artefact about parametricity failure under specialisation and inlining with representation lowering
this project models a small typed source calculus and then lowers it into an explicit representation calculus and audits whether the source observation and target observation remain related. the surface is semantic rather than structural as its about abstraction theorems, representation relations, strictness shifts, and the proof obligations that an optimiser assumes when it rewrites polymorphic code
the target language makes representation explicit and forces each transition to be spelled out in the term. values are either boxed or unboxed and can be projected from products or injected into sums as well as unpacked when needed and moved across worker wrapper boundaries as part of calling convention shifts
the target calculus is intentionally lower level than the source and trades abstraction for control over layout and calling. it has decent tuple and sum representations and uses explicit box and unbox operations to mediate between them. equality on integers and booleans is primitive rather than encoded as well as recursive binding being built in rather than derived
## example(s)
a representation exposure witness starts from a polymorphic constant false term
```ocaml
forall a. function a function a bool
```
under a safe profile instantiating this term at `bool` preserves the baseline relation. under an unsafe inline profile instantiating at `int` can expose integer equality and refute the abstraction theorem
a strictness witness places a divergent recursive computation under `roll`
```ocaml
roll mu a. int loop
```
the source observation can keep the recursive payload latent. a strict lowering path may force it during construction and change termination.
a worker wrapper witness uses the explicit source type representation
```ocaml
TArrow (TPair (TInt, TBool), TPair (TInt, TBool))
```
the target worker receives `RInt` and `RBool` while the wrapper preserves the boxed source interface