Skip to content

Commit 6c70bfc

Browse files
committed
feat: add normative reference quick demo
1 parent 18f8f47 commit 6c70bfc

3 files changed

Lines changed: 101 additions & 2 deletions

File tree

examples/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44

55
---
66

7+
## Canonical Reference Quick Demo
8+
9+
Run the current normative reference implementation from the repository root:
10+
11+
```powershell
12+
python examples/nra_ide_reference_quick_demo.py
13+
```
14+
15+
The demo calls [`nra-core/foundations/NRA-IDE_Architecture_public.py`](../nra-core/foundations/NRA-IDE_Architecture_public.py) directly and checks seven canonical outcomes: `PERMIT`, `BOUNDARY_WARNING`, `HANDOFF_REQUIRED`, `IRREVERSIBLE_TRANSITION`, `RUPTURE_BOUNDARY`, `CONFESSION`, and `OUT_OF_DESCRIPTION_DOMAIN`.
16+
17+
Its thresholds are explicit demonstration values, not inferred defaults. The demo is not a separate canonical evaluator and must not be used for medical, autonomous-control, or other operational decisions.
18+
19+
Other examples in this directory preserve research, explanatory, illustrative, domain-specific, or historical work and may use legacy state names.
20+
21+
---
22+
723
## What is NRA-IDE?
824

925
**Nomological Ring Axioms — Intensional Dynamics Engine**
@@ -379,4 +395,3 @@ This project is provided under the **MIT License**. It may be used, modified, an
379395
For the latest information, see the official repository:
380396

381397
- **GitHub:** https://github.com/M-Tokun/NRA-IDE
382-

examples/README_JP.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44

55
---
66

7+
## 正規参照 Quick Demo
8+
9+
リポジトリルートで、現行の正規参照実装を実行します。
10+
11+
```powershell
12+
python examples/nra_ide_reference_quick_demo.py
13+
```
14+
15+
このデモは[`nra-core/foundations/NRA-IDE_Architecture_public.py`](../nra-core/foundations/NRA-IDE_Architecture_public.py)を直接呼び出し、`PERMIT``BOUNDARY_WARNING``HANDOFF_REQUIRED``IRREVERSIBLE_TRANSITION``RUPTURE_BOUNDARY``CONFESSION``OUT_OF_DESCRIPTION_DOMAIN`の7状態を確認します。
16+
17+
閾値は説明用に明示した値であり、推論された既定値ではありません。このデモは独立した正規判定器ではなく、医療、自律制御、その他の運用判断には使用できません。
18+
19+
このディレクトリのその他の例は、研究・説明・例示・ドメイン固有・履歴資料を保存しており、旧状態名を使用する場合があります。
20+
21+
---
22+
723
## NRA-IDE とは
824

925
**律環公理 — 内包性動力学エンジン(Nomological Ring Axioms — Intensional Dynamics Engine)**
@@ -417,4 +433,3 @@ if (deliveryStatus === "STOP") {
417433
- **GitHub:** https://github.com/M-Tokun/NRA-IDE
418434

419435
---
420-
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
"""Run canonical NRA-IDE states through the normative reference implementation.
2+
3+
This file is an executable example, not a separate canonical evaluator.
4+
The thresholds are explicit demonstration values, not inferred domain defaults.
5+
Do not use this demo for medical, autonomous-control, or other operational decisions.
6+
"""
7+
8+
from __future__ import annotations
9+
10+
import importlib.util
11+
import pathlib
12+
from typing import Any
13+
14+
15+
ROOT = pathlib.Path(__file__).resolve().parents[1]
16+
SOURCE = ROOT / "nra-core" / "foundations" / "NRA-IDE_Architecture_public.py"
17+
SPEC = importlib.util.spec_from_file_location("nra_ide_reference_quick_demo", SOURCE)
18+
NRA = importlib.util.module_from_spec(SPEC)
19+
assert SPEC.loader is not None
20+
SPEC.loader.exec_module(NRA)
21+
22+
THRESHOLDS = {
23+
"r_warn": 0.4,
24+
"r_handoff": 0.6,
25+
"r_irrev": 0.8,
26+
}
27+
28+
SCENARIOS = (
29+
("below warning", 0.1, 1.0, "PERMIT"),
30+
("warning boundary", 0.4, 1.0, "BOUNDARY_WARNING"),
31+
("human handoff", 0.6, 1.0, "HANDOFF_REQUIRED"),
32+
("irreversible onset", 0.8, 1.0, "IRREVERSIBLE_TRANSITION"),
33+
("complete rupture", 1.0, 1.0, "RUPTURE_BOUNDARY"),
34+
("invalid structural input", "invalid", 1.0, "CONFESSION"),
35+
("undefined ratio domain", 0.1, 0.0, "OUT_OF_DESCRIPTION_DOMAIN"),
36+
)
37+
38+
39+
def display_value(value: Any) -> str:
40+
return "NOT_AVAILABLE" if value is None else str(value)
41+
42+
43+
def main() -> int:
44+
print("NRA-IDE normative reference quick demo")
45+
print("Thresholds are explicit demonstration values:", THRESHOLDS)
46+
print()
47+
48+
passed = 0
49+
for name, delta, tau, expected in SCENARIOS:
50+
result = NRA.nra_ide_core_evaluation(delta, tau, **THRESHOLDS)
51+
actual = result["status"]
52+
outcome = "PASS" if actual == expected else "FAIL"
53+
passed += actual == expected
54+
print(
55+
f"{outcome:4} | {name:24} | delta={delta!r:9} | tau={tau!r:4} | "
56+
f"R={display_value(result['R']):13} | status={actual} | expected={expected}"
57+
)
58+
59+
print()
60+
print(f"Scenarios passed: {passed}/{len(SCENARIOS)}")
61+
if passed == len(SCENARIOS):
62+
print("Quick demo result: OK")
63+
return 0
64+
print("Quick demo result: FAILED")
65+
return 1
66+
67+
68+
if __name__ == "__main__":
69+
raise SystemExit(main())

0 commit comments

Comments
 (0)