Spaces:
Running
Running
Download web/packages/a11oy-connection/src/tetrad_field.ts from SZLHOLDINGS/a11oy: direct link, hf CLI and curl.
- Browser
- Download file 1.86 kB
-
https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/6d65e6a965d7a18f8a275ac6e9c7d8e7e4ccf20d/web/packages/a11oy-connection/src/tetrad_field.ts
- Command line
-
hf download hf://spaces/SZLHOLDINGS/a11oy@6d65e6a965d7a18f8a275ac6e9c7d8e7e4ccf20d/web/packages/a11oy-connection/src/tetrad_field.ts
-
curl -L -o tetrad_field.ts https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/6d65e6a965d7a18f8a275ac6e9c7d8e7e4ccf20d/web/packages/a11oy-connection/src/tetrad_field.ts
1.86 kB
| /** | |
| * Tetrad Field (gauge connection over the policy manifold) | |
| * | |
| * Source: Wald (1984), General Relativity §3.4 (tetrad / vierbein | |
| * formalism). Penrose & Rindler (1984), Spinors and Space-Time vol.1, | |
| * Cambridge UP, §3.1. | |
| * | |
| * A tetrad is an orthonormal frame field eₐ^μ on a manifold. For | |
| * governance policy, the four legs are: (1) capability tier, (2) data | |
| * sensitivity, (3) action reversibility, (4) blast radius. The tetrad | |
| * lets us evaluate any decision in either frame (intrinsic vs extrinsic) | |
| * — the Bohr complementarity engine consumes this object. | |
| */ | |
| export type TetradLeg = { | |
| axis: 'capability_tier' | 'data_sensitivity' | 'action_reversibility' | 'blast_radius'; | |
| unit: string; | |
| value: number; | |
| }; | |
| export type TetradFrame = { | |
| /** Always exactly four legs (orthonormal frame). */ | |
| legs: [TetradLeg, TetradLeg, TetradLeg, TetradLeg]; | |
| }; | |
| export function makeTetrad(values: { | |
| capability_tier: number; | |
| data_sensitivity: number; | |
| action_reversibility: number; | |
| blast_radius: number; | |
| }): TetradFrame { | |
| return { | |
| legs: [ | |
| { axis: 'capability_tier', unit: 'tier', value: values.capability_tier }, | |
| { axis: 'data_sensitivity', unit: 'sensitivityLevel', value: values.data_sensitivity }, | |
| { axis: 'action_reversibility', unit: 'reversibilityScore', value: values.action_reversibility }, | |
| { axis: 'blast_radius', unit: 'affectedUserCount', value: values.blast_radius }, | |
| ], | |
| }; | |
| } | |
| /** | |
| * Inner product in the orthonormal frame (Euclidean metric η = diag(1,1,1,1) | |
| * since the frame is orthonormal by construction). | |
| */ | |
| export function tetradInner(a: TetradFrame, b: TetradFrame): number { | |
| let s = 0; | |
| for (let i = 0; i < 4; i++) { | |
| s += a.legs[i].value * b.legs[i].value; | |
| } | |
| return s; | |
| } | |
| export function tetradNorm(a: TetradFrame): number { | |
| return Math.sqrt(tetradInner(a, a)); | |
| } | |