diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8aff812..088dfe2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,8 +2,8 @@ git clone https://github.com/hyperpolymath/betlangiser.git cd betlangiser -# Using Nix (recommended for reproducibility) -nix develop +# Using Guix (recommended for reproducibility) +guix develop # Or using toolbox/distrobox toolbox create betlangiser-dev @@ -45,7 +45,7 @@ betlangiser/ ├── MAINTAINERS.md ├── README.adoc ├── SECURITY.md -├── flake.nix # Nix flake — fallback (Perimeter 1) +├── flake.guix # Guix flake — fallback (Perimeter 1) ├── guix.scm # Guix package — primary (Perimeter 1) └── Justfile # Task runner (Perimeter 1) ``` diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6e2bea9..678e4a4 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -33,7 +33,7 @@ ## Banned Languages -- No TypeScript (use ReScript) +- No TypeScript (use AffineScript) - No Node.js / npm / bun (use Deno) - No Go (use Rust) - No Python (use Julia or Rust) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d5cd4e9..045cb8f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -41,8 +41,8 @@ updates: schedule: interval: "weekly" - # Nix flakes - - package-ecosystem: "nix" + # Guix flakes + - package-ecosystem: "guix" directory: "/" schedule: interval: "weekly" diff --git a/.machine_readable/ai/PLACEHOLDERS.adoc b/.machine_readable/ai/PLACEHOLDERS.adoc index 8d4f786..b764b07 100644 --- a/.machine_readable/ai/PLACEHOLDERS.adoc +++ b/.machine_readable/ai/PLACEHOLDERS.adoc @@ -48,8 +48,8 @@ sed -i "s/{{CURRENT_DATE}}/$(date +%Y-%m-%d)/g" $(grep -rl '{{CURRENT_DATE}}' .) | Placeholder | Description | Example | Files | |---|---|---|---| -| `{{PROJECT_NAME}}` | Human-readable project name | `My Project` | SECURITY.md, CODE_OF_CONDUCT.md, TOPOLOGY.md, STATE.a2ml, Justfile, GOVERNANCE.md, MAINTAINERS.md, flake.nix, devcontainer.json | -| `{{PROJECT_DESCRIPTION}}` | One-line description | `A tool for X` | flake.nix | +| `{{PROJECT_NAME}}` | Human-readable project name | `My Project` | SECURITY.md, CODE_OF_CONDUCT.md, TOPOLOGY.md, STATE.a2ml, Justfile, GOVERNANCE.md, MAINTAINERS.md, flake.guix, devcontainer.json | +| `{{PROJECT_DESCRIPTION}}` | One-line description | `A tool for X` | flake.guix | | `{{PROJECT}}` | Uppercase identifier (for Idris2 modules, C macros) | `MY_PROJECT` | ABI-FFI-README.md, src/interface/abi/*.idr, src/interface/ffi/*.zig | | `{{project}}` | Lowercase identifier (for C symbols, filenames) | `my_project` | ABI-FFI-README.md, src/interface/ffi/*.zig | | `betlangiser` | Repository name (slug) | `my-project` | CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, cliff.toml | @@ -133,7 +133,7 @@ After replacing all placeholders, verify none remain: ```bash grep -rn '{{' . --include='*.md' --include='*.adoc' --include='*.a2ml' \ --include='*.scm' --include='*.idr' --include='*.zig' --include='*.res' \ - --include='Justfile' --include='*.nix' --include='*.toml' --include='*.yml' \ + --include='Justfile' --include='*.guix' --include='*.toml' --include='*.yml' \ --include='*.yaml' --include='*.hs' --include='*.ncl' --include='*.txt' \ --include='*.json' --include='Containerfile' --include='dep5' \ | grep -v 'PLACEHOLDERS.md' | grep -v 'node_modules' diff --git a/.machine_readable/contractiles/lust/Intentfile.a2ml b/.machine_readable/contractiles/lust/Intentfile.a2ml index 66ab49d..10a5b85 100644 --- a/.machine_readable/contractiles/lust/Intentfile.a2ml +++ b/.machine_readable/contractiles/lust/Intentfile.a2ml @@ -16,7 +16,7 @@ design philosophy — not current state, but target state. ### reproducible-builds - description: Builds should be bit-for-bit reproducible -- target: Guix + Nix + Containerfile +- target: Guix + Guix + Containerfile - status: aspiration ### zero-dangerous-patterns diff --git a/.machine_readable/policies/MAINTENANCE-CHECKLIST.a2ml b/.machine_readable/policies/MAINTENANCE-CHECKLIST.a2ml index eaee720..698f4d0 100644 --- a/.machine_readable/policies/MAINTENANCE-CHECKLIST.a2ml +++ b/.machine_readable/policies/MAINTENANCE-CHECKLIST.a2ml @@ -67,7 +67,7 @@ compliance-seams-check = true exception-register-required = true exception-bounded-scope-required = true policy-drift-contamination-check = true -example-drift-risk = "single TypeScript exception causing broad ReScript->TypeScript migration" +example-drift-risk = "single TypeScript exception causing broad AffineScript->TypeScript migration" compliance-tooling = "panic-attack" effects-tooling = "ecological checking with sustainabot guidance" diff --git a/CODE_OF_CONDUCT.adoc b/CODE_OF_CONDUCT.adoc new file mode 100644 index 0000000..bd2a83c --- /dev/null +++ b/CODE_OF_CONDUCT.adoc @@ -0,0 +1,24 @@ +== Contributor Covenant Code of Conduct + +=== Our Pledge + +We pledge to make participation a harassment-free experience for +everyone. + +=== Our Standards + +*Positive behavior:* * Using welcoming language * Being respectful of +differing viewpoints * Accepting constructive criticism * Focusing on +what is best for the community + +*Unacceptable behavior:* * Harassment, trolling, or personal attacks * +Publishing private information without permission + +=== Enforcement + +Report issues to the maintainers. All complaints will be reviewed. + +=== Attribution + +Adapted from https://www.contributor-covenant.org/[Contributor Covenant] +v2.1. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index caeda1c..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Contributor Covenant Code of Conduct - -## Our Pledge - -We pledge to make participation a harassment-free experience for everyone. - -## Our Standards - -**Positive behavior:** -* Using welcoming language -* Being respectful of differing viewpoints -* Accepting constructive criticism -* Focusing on what is best for the community - -**Unacceptable behavior:** -* Harassment, trolling, or personal attacks -* Publishing private information without permission - -## Enforcement - -Report issues to the maintainers. All complaints will be reviewed. - -## Attribution - -Adapted from [Contributor Covenant](https://www.contributor-covenant.org/) v2.1. - diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc new file mode 100644 index 0000000..dd089ae --- /dev/null +++ b/CONTRIBUTING.adoc @@ -0,0 +1,71 @@ +== Contributing + +Thank you for your interest in contributing! We follow a "`Dual-Track`" +architecture where human-readable documentation lives in the root and +machine-readable policies live in `+.machine_readable/+`. + +=== How to Contribute + +We welcome contributions in many forms: + +* *Code:* Improving the core stack or extensions +* *Documentation:* Enhancing docs or AI manifests +* *Testing:* Adding property-based tests or formal proofs +* *Bug reports:* Filing clear, reproducible issues + +=== Getting Started + +[arabic] +. *Read the AI Manifest:* Start with `+0-AI-MANIFEST.a2ml+` (if present) +to understand the repository structure. +. *Environment:* Use `+guix develop+` or `+direnv allow+` to set up your +tools. +. *Task Runner:* Use `+just+` to see available commands +(`+just --list+`). + +=== Development Workflow + +==== Branch Naming + +.... +docs/short-description # Documentation +test/what-added # Test additions +feat/short-description # New features +fix/issue-number-description # Bug fixes +refactor/what-changed # Code improvements +security/what-fixed # Security fixes +.... + +==== Commit Messages + +We follow https://www.conventionalcommits.org/[Conventional Commits]: + +.... +(): + +[optional body] + +[optional footer] +.... + +Types: `+feat+`, `+fix+`, `+docs+`, `+test+`, `+refactor+`, `+ci+`, +`+chore+`, `+security+` + +=== Reporting Bugs + +Before reporting: 1. Search existing issues 2. Check if it’s already +fixed in `+main+` + +When reporting, include: - Clear, descriptive title - Environment +details (OS, versions, toolchain) - Steps to reproduce - Expected vs +actual behaviour + +=== Code of Conduct + +All contributors are expected to adhere to our +link:CODE_OF_CONDUCT.md[Code of Conduct]. + +=== License + +By contributing, you agree that your contributions will be licensed +under the same license as the project (see LICENSE). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 80ecdac..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Contributing - -Thank you for your interest in contributing! We follow a "Dual-Track" architecture where human-readable documentation lives in the root and machine-readable policies live in `.machine_readable/`. - -## How to Contribute - -We welcome contributions in many forms: - -- **Code:** Improving the core stack or extensions -- **Documentation:** Enhancing docs or AI manifests -- **Testing:** Adding property-based tests or formal proofs -- **Bug reports:** Filing clear, reproducible issues - -## Getting Started - -1. **Read the AI Manifest:** Start with `0-AI-MANIFEST.a2ml` (if present) to understand the repository structure. -2. **Environment:** Use `nix develop` or `direnv allow` to set up your tools. -3. **Task Runner:** Use `just` to see available commands (`just --list`). - -## Development Workflow - -### Branch Naming - -``` -docs/short-description # Documentation -test/what-added # Test additions -feat/short-description # New features -fix/issue-number-description # Bug fixes -refactor/what-changed # Code improvements -security/what-fixed # Security fixes -``` - -### Commit Messages - -We follow [Conventional Commits](https://www.conventionalcommits.org/): - -``` -(): - -[optional body] - -[optional footer] -``` - -Types: `feat`, `fix`, `docs`, `test`, `refactor`, `ci`, `chore`, `security` - -## Reporting Bugs - -Before reporting: -1. Search existing issues -2. Check if it's already fixed in `main` - -When reporting, include: -- Clear, descriptive title -- Environment details (OS, versions, toolchain) -- Steps to reproduce -- Expected vs actual behaviour - -## Code of Conduct - -All contributors are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md). - -## License - -By contributing, you agree that your contributions will be licensed under the same license as the project (see [LICENSE](LICENSE)). diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..c370a3b --- /dev/null +++ b/README.adoc @@ -0,0 +1,163 @@ +https://github.com/sponsors/hyperpolymath[image:https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github[Sponsor]] + +== What Is This? + +Betlangiser analyses deterministic code, identifies values that should +be probabilistic, wraps them in *Betlang distributions*, and generates +*uncertainty-propagating code*. Turn `+price+` `+=+` `+100+` into +`+price+` `+=+` `+Normal(100,+` `+5)+` with automatic propagation +through arithmetic and control flow — without rewriting your codebase. + +Betlang is a ternary probabilistic programming language where every +boolean becomes *true / false / unknown*, enabling reasoning under +genuine uncertainty rather than forcing premature binary decisions. + +== How It Works + +[arabic] +. You write a `+betlangiser.toml+` manifest declaring which values are +uncertain +. Betlangiser *analyses your deterministic source* to find numeric +values, boolean conditions, and decision points +. The *Idris2 ABI layer* proves that distribution compositions are +mathematically correct (Kolmogorov axioms, support bounds, parameter +validity) +. The *Zig FFI bridge* provides zero-overhead C-ABI sampling and +combination +. The *codegen engine* emits Betlang wrappers with ternary bet semantics +. You get *probability distributions*, not point estimates + +== Key Value + +* *Retrofit uncertainty* — add probabilistic modelling to existing code +without a rewrite +* *Ternary logic* — every boolean becomes true/false/unknown, +propagating uncertainty through conditionals and loops +* *Distribution types* — Normal, Uniform, Beta, Bernoulli, and custom +distributions as first-class values +* *Proven correctness* — Idris2 dependent types prove distribution +composition obeys Kolmogorov axioms at compile time +* *14 number systems* — from exact rationals to fuzzy intervals, matched +to precision requirements +* *Automatic propagation* — uncertainty flows through arithmetic, +comparisons, and control flow without manual instrumentation + +== Use Cases + +* *Financial modelling* — model price uncertainty, risk distributions, +portfolio Monte Carlo +* *Sensor fusion* — combine noisy readings with known error +distributions +* *Risk assessment* — propagate uncertainty through decision trees +* *Monte Carlo pipelines* — generate full simulation harnesses from +deterministic code +* *Scientific computing* — add measurement uncertainty to numerical +models + +== Architecture + +Follows the hyperpolymath *-iser pattern*: + +.... +betlangiser.toml (manifest) + -> Deterministic source analysis + -> Idris2 ABI (proves distribution correctness) + -> Zig FFI (C-ABI sampling bridge) + -> Betlang codegen (uncertainty-propagating wrappers) +.... + +=== Idris2 ABI Layer + +* `+Types.idr+` — Distribution, TernaryBool, ProbabilityValue, +ConfidenceInterval, SamplingStrategy +* `+Layout.idr+` — Distribution struct memory layout, sample buffer +layout +* `+Foreign.idr+` — Distribution creation, sampling, combination, +ternary logic FFI declarations + +=== Zig FFI Bridge + +* `+main.zig+` — Distribution allocation, sampling engine, combination +operators, ternary logic evaluation +* `+build.zig+` — Shared/static library build, cross-compilation +* `+test/integration_test.zig+` — ABI compliance tests + +Part of the https://github.com/hyperpolymath/iseriser[-iser family]. + +== CLI Commands + +[source,bash] +---- +# Initialise a new manifest +betlangiser init + +# Validate manifest +betlangiser validate -m betlangiser.toml + +# Generate Betlang wrappers and FFI bridge +betlangiser generate -m betlangiser.toml -o generated/betlangiser + +# Build generated artifacts +betlangiser build -m betlangiser.toml --release + +# Run the workload +betlangiser run -m betlangiser.toml + +# Show manifest info +betlangiser info -m betlangiser.toml +---- + +== Example Manifest + +[source,toml] +---- +[workload] +name = "pricing-model" +description = "Add uncertainty to deterministic pricing" + +[sources] +paths = ["src/pricing.rs"] + +[distributions] +# Wrap a deterministic value in a normal distribution +[[distributions.wrap]] +target = "base_price" +distribution = "Normal" +params = { mean = 100.0, stddev = 5.0 } + +[[distributions.wrap]] +target = "demand_factor" +distribution = "Uniform" +params = { low = 0.8, high = 1.2 } + +[[distributions.wrap]] +target = "is_peak_season" +distribution = "Bernoulli" +params = { p = 0.3 } + +[propagation] +strategy = "monte-carlo" +samples = 10000 +confidence = 0.95 + +[output] +format = "betlang" +ternary-logic = true +---- + +== Building + +[source,bash] +---- +cargo build --release +cargo test +---- + +== Status + +*Pre-alpha.* Architecture defined, CLI scaffolded, ABI definitions in +progress. Codegen engine pending. + +== License + +SPDX-License-Identifier: CC-BY-SA-4.0 diff --git a/README.md b/README.md deleted file mode 100644 index 5c6f557..0000000 --- a/README.md +++ /dev/null @@ -1,180 +0,0 @@ - - -[![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/hyperpolymath) - -# What Is This? - -Betlangiser analyses deterministic code, identifies values that should -be probabilistic, wraps them in **Betlang distributions**, and generates -**uncertainty-propagating code**. Turn `price` `=` `100` into `price` -`=` `Normal(100,` `5)` with automatic propagation through arithmetic and -control flow — without rewriting your codebase. - -Betlang is a ternary probabilistic programming language where every -boolean becomes **true / false / unknown**, enabling reasoning under -genuine uncertainty rather than forcing premature binary decisions. - -# How It Works - -1. You write a `betlangiser.toml` manifest declaring which values are - uncertain - -2. Betlangiser **analyses your deterministic source** to find numeric - values, boolean conditions, and decision points - -3. The **Idris2 ABI layer** proves that distribution compositions are - mathematically correct (Kolmogorov axioms, support bounds, parameter - validity) - -4. The **Zig FFI bridge** provides zero-overhead C-ABI sampling and - combination - -5. The **codegen engine** emits Betlang wrappers with ternary bet - semantics - -6. You get **probability distributions**, not point estimates - -# Key Value - -- **Retrofit uncertainty** — add probabilistic modelling to existing - code without a rewrite - -- **Ternary logic** — every boolean becomes true/false/unknown, - propagating uncertainty through conditionals and loops - -- **Distribution types** — Normal, Uniform, Beta, Bernoulli, and custom - distributions as first-class values - -- **Proven correctness** — Idris2 dependent types prove distribution - composition obeys Kolmogorov axioms at compile time - -- **14 number systems** — from exact rationals to fuzzy intervals, - matched to precision requirements - -- **Automatic propagation** — uncertainty flows through arithmetic, - comparisons, and control flow without manual instrumentation - -# Use Cases - -- **Financial modelling** — model price uncertainty, risk distributions, - portfolio Monte Carlo - -- **Sensor fusion** — combine noisy readings with known error - distributions - -- **Risk assessment** — propagate uncertainty through decision trees - -- **Monte Carlo pipelines** — generate full simulation harnesses from - deterministic code - -- **Scientific computing** — add measurement uncertainty to numerical - models - -# Architecture - -Follows the hyperpolymath **-iser pattern**: - - betlangiser.toml (manifest) - -> Deterministic source analysis - -> Idris2 ABI (proves distribution correctness) - -> Zig FFI (C-ABI sampling bridge) - -> Betlang codegen (uncertainty-propagating wrappers) - -## Idris2 ABI Layer - -- `Types.idr` — Distribution, TernaryBool, ProbabilityValue, - ConfidenceInterval, SamplingStrategy - -- `Layout.idr` — Distribution struct memory layout, sample buffer layout - -- `Foreign.idr` — Distribution creation, sampling, combination, ternary - logic FFI declarations - -## Zig FFI Bridge - -- `main.zig` — Distribution allocation, sampling engine, combination - operators, ternary logic evaluation - -- `build.zig` — Shared/static library build, cross-compilation - -- `test/integration_test.zig` — ABI compliance tests - -Part of the [-iser family](https://github.com/hyperpolymath/iseriser). - -# CLI Commands - -```bash -# Initialise a new manifest -betlangiser init - -# Validate manifest -betlangiser validate -m betlangiser.toml - -# Generate Betlang wrappers and FFI bridge -betlangiser generate -m betlangiser.toml -o generated/betlangiser - -# Build generated artifacts -betlangiser build -m betlangiser.toml --release - -# Run the workload -betlangiser run -m betlangiser.toml - -# Show manifest info -betlangiser info -m betlangiser.toml -``` - -# Example Manifest - -```toml -[workload] -name = "pricing-model" -description = "Add uncertainty to deterministic pricing" - -[sources] -paths = ["src/pricing.rs"] - -[distributions] -# Wrap a deterministic value in a normal distribution -[[distributions.wrap]] -target = "base_price" -distribution = "Normal" -params = { mean = 100.0, stddev = 5.0 } - -[[distributions.wrap]] -target = "demand_factor" -distribution = "Uniform" -params = { low = 0.8, high = 1.2 } - -[[distributions.wrap]] -target = "is_peak_season" -distribution = "Bernoulli" -params = { p = 0.3 } - -[propagation] -strategy = "monte-carlo" -samples = 10000 -confidence = 0.95 - -[output] -format = "betlang" -ternary-logic = true -``` - -# Building - -```bash -cargo build --release -cargo test -``` - -# Status - -**Pre-alpha.** Architecture defined, CLI scaffolded, ABI definitions in -progress. Codegen engine pending. - -# License - -SPDX-License-Identifier: CC-BY-SA-4.0 diff --git a/ROADMAP.adoc b/ROADMAP.adoc index 3d89c0c..331968d 100644 --- a/ROADMAP.adoc +++ b/ROADMAP.adoc @@ -17,7 +17,7 @@ * [ ] Boolean condition detector -- find if/else, match, ternary expressions * [ ] Decision point mapper -- trace control flow that depends on uncertain values * [ ] Value dependency graph -- which outputs depend on which inputs -* [ ] Language adapters -- Rust, ReScript, Gleam source parsing +* [ ] Language adapters -- Rust, AffineScript, Gleam source parsing * [ ] Integration tests with real-world codebases == Phase 2: Distribution Wrapping diff --git a/SECURITY.md b/SECURITY.adoc similarity index 58% rename from SECURITY.md rename to SECURITY.adoc index 3b7723d..7ae5b6e 100644 --- a/SECURITY.md +++ b/SECURITY.adoc @@ -1,21 +1,24 @@ -# Security Policy +== Security Policy -## Supported Versions +=== Supported Versions -| Version | Supported | -|---------|-----------| -| 0.1.x | ✅ | +[cols=",",options="header",] +|=== +|Version |Supported +|0.1.x |✅ +|=== -## Reporting a Vulnerability +=== Reporting a Vulnerability Please report security vulnerabilities to: j.d.a.jewell@open.ac.uk Do NOT open a public issue for security vulnerabilities. -## Response Time +=== Response Time -We aim to respond within 48 hours and provide a fix within 7 days for critical issues. +We aim to respond within 48 hours and provide a fix within 7 days for +critical issues. -## Scope +=== Scope This policy covers the betlangiser CLI tool and its generated artifacts. diff --git a/TEST-NEEDS.adoc b/TEST-NEEDS.adoc new file mode 100644 index 0000000..56e4385 --- /dev/null +++ b/TEST-NEEDS.adoc @@ -0,0 +1,34 @@ +== TEST-NEEDS.md — betlangiser + +=== CRG Grade: C — ACHIEVED 2026-04-04 + +=== Current Test State + +[cols=",,",options="header",] +|=== +|Category |Count |Notes +|Test directories |2 |Location(s): /tests, /verification/tests +|CI workflows |22 |Running tests on GitHub Actions +|Unit tests |Built-in |Rust/cargo test framework +|Integration tests |Configured |Via integration/ directory +|=== + +=== What’s Covered + +* [x] Rust unit test suite (cargo test) +* [x] Documentation tests +* [x] Example programs with tests + +=== Still Missing (for CRG B+) + +* [ ] Code coverage reports (codecov integration) +* [ ] Detailed test documentation in CONTRIBUTING.md +* [ ] Integration tests beyond unit tests +* [ ] Performance benchmarking suite + +=== Run Tests + +[source,bash] +---- +cargo test +---- diff --git a/TEST-NEEDS.md b/TEST-NEEDS.md deleted file mode 100644 index 68596ba..0000000 --- a/TEST-NEEDS.md +++ /dev/null @@ -1,31 +0,0 @@ -# TEST-NEEDS.md — betlangiser - -## CRG Grade: C — ACHIEVED 2026-04-04 - -## Current Test State - -| Category | Count | Notes | -|----------|-------|-------| -| Test directories | 2 | Location(s): /tests, /verification/tests | -| CI workflows | 22 | Running tests on GitHub Actions | -| Unit tests | Built-in | Rust/cargo test framework | -| Integration tests | Configured | Via integration/ directory | - -## What's Covered - -- [x] Rust unit test suite (cargo test) -- [x] Documentation tests -- [x] Example programs with tests - -## Still Missing (for CRG B+) - -- [ ] Code coverage reports (codecov integration) -- [ ] Detailed test documentation in CONTRIBUTING.md -- [ ] Integration tests beyond unit tests -- [ ] Performance benchmarking suite - -## Run Tests - -```bash -cargo test -``` diff --git a/TOPOLOGY.md b/TOPOLOGY.adoc similarity index 80% rename from TOPOLOGY.md rename to TOPOLOGY.adoc index 7b2bf20..fe87562 100644 --- a/TOPOLOGY.md +++ b/TOPOLOGY.adoc @@ -1,17 +1,15 @@ - - -# TOPOLOGY — betlangiser +== TOPOLOGY — betlangiser -## Purpose +=== Purpose -Betlangiser adds ternary probabilistic modelling to deterministic code via -Betlang. It analyses source code, identifies values that should be +Betlangiser adds ternary probabilistic modelling to deterministic code +via Betlang. It analyses source code, identifies values that should be probabilistic, wraps them in distributions, and generates uncertainty-propagating code with ternary logic (true/false/unknown). -## Directory Map +=== Directory Map -``` +.... betlangiser/ ├── 0-AI-MANIFEST.a2ml # AI agent entry point ├── README.adoc # Project overview @@ -76,11 +74,11 @@ betlangiser/ │ └── CONTRIBUTING.md ├── docs/ # Documentation └── container/ # Stapeln container ecosystem -``` +.... -## Data Flow +=== Data Flow -``` +.... betlangiser.toml (user manifest) | v @@ -103,25 +101,36 @@ betlangiser.toml (user manifest) | ternary bet semantics v generated/betlangiser/ (output) -``` +.... -## Key Types +=== Key Types -| Type | Module | Purpose | -|------|--------|---------| -| `Distribution` | Types.idr | Sum type: Normal, Uniform, Beta, Bernoulli, Custom | -| `TernaryBool` | Types.idr | True / False / Unknown with Kleene logic | -| `ProbabilityValue` | Types.idr | Value in [0,1] with dependent type proof | -| `ConfidenceInterval` | Types.idr | Lower/upper bounds at confidence level | -| `SamplingStrategy` | Types.idr | MonteCarlo / Analytical / Hybrid | +[width="100%",cols="27%,34%,39%",options="header",] +|=== +|Type |Module |Purpose +|`+Distribution+` |Types.idr |Sum type: Normal, Uniform, Beta, +Bernoulli, Custom -## Integration Points +|`+TernaryBool+` |Types.idr |True / False / Unknown with Kleene logic -| System | Relationship | -|--------|-------------| -| **iseriser** | Meta-framework; can scaffold new -iser repos | -| **proven** | Shared Idris2 verified library (distribution proofs) | -| **typell** | Type theory engine (ternary logic foundations) | -| **boj-server** | Cartridge for CLI invocation via MCP | -| **PanLL** | Monte Carlo visualisation and distribution comparison panels | -| **VeriSimDB** | Backing store for simulation results | +|`+ProbabilityValue+` |Types.idr |Value in [0,1] with dependent type +proof + +|`+ConfidenceInterval+` |Types.idr |Lower/upper bounds at confidence +level + +|`+SamplingStrategy+` |Types.idr |MonteCarlo / Analytical / Hybrid +|=== + +=== Integration Points + +[width="100%",cols="39%,61%",options="header",] +|=== +|System |Relationship +|*iseriser* |Meta-framework; can scaffold new -iser repos +|*proven* |Shared Idris2 verified library (distribution proofs) +|*typell* |Type theory engine (ternary logic foundations) +|*boj-server* |Cartridge for CLI invocation via MCP +|*PanLL* |Monte Carlo visualisation and distribution comparison panels +|*VeriSimDB* |Backing store for simulation results +|=== diff --git a/docs/RSR_OUTLINE.adoc b/docs/RSR_OUTLINE.adoc index 8faf3bb..83e1c15 100644 --- a/docs/RSR_OUTLINE.adoc +++ b/docs/RSR_OUTLINE.adoc @@ -204,8 +204,8 @@ project/ === Language Tiers -* **Tier 1** (Gold): Rust, Elixir, Zig, Ada, Haskell, ReScript, Gleam -* **Tier 2** (Silver): Nickel, Guile Scheme, Nix, Idris2, OCaml +* **Tier 1** (Gold): Rust, Elixir, Zig, Ada, Haskell, AffineScript, Gleam +* **Tier 2** (Silver): Nickel, Guile Scheme, Guix, Idris2, OCaml * **Infrastructure**: Guix channels, derivations, Julia batch scripts === Required Files @@ -219,12 +219,12 @@ project/ * `.well-known/security.txt` * `.well-known/ai.txt` * `.well-known/humans.txt` -* `guix.scm` OR `flake.nix` +* `guix.scm` OR `flake.guix` === Prohibited * Python outside `salt/` directory -* TypeScript/JavaScript (use ReScript) +* TypeScript/JavaScript (use AffineScript) * CUE (use Guile/Nickel) * `Dockerfile` (use `Containerfile`) * npm, Bun, pnpm, yarn (use Deno) diff --git a/docs/STATE-VISUALIZER.adoc b/docs/STATE-VISUALIZER.adoc index 4be8d44..7746b12 100644 --- a/docs/STATE-VISUALIZER.adoc +++ b/docs/STATE-VISUALIZER.adoc @@ -46,7 +46,7 @@ ┌─────────────────────────────────────────┐ │ PLATFORM INTEGRATION │ │ ┌───────────┐ ┌───────────┐ ┌───────┐│ - │ │ GitHub │ │ GitLab │ │ Nix / ││ + │ │ GitHub │ │ GitLab │ │ Guix / ││ │ │ Workflows │ │ CI/CD │ │ Guix ││ │ └───────────┘ └───────────┘ └───────┘│ └─────────────────────────────────────────┘ @@ -88,7 +88,7 @@ CONTAINER ECOSYSTEM (Phase 2) REPO INFRASTRUCTURE .machine_readable/ ██████████ 100% STATE/META/ECOSYSTEM active Governance & License ██████████ 100% MPL-2.0 & Ethical use verified - Development Shells (Nix/Guix) ██████████ 100% Reproducible env stable + Development Shells (Guix/Guix) ██████████ 100% Reproducible env stable ───────────────────────────────────────────────────────────────────────────── OVERALL: ██████████ 100% RSR Template Stable & Certified diff --git a/docs/developer/ABI-FFI-README.adoc b/docs/developer/ABI-FFI-README.adoc index fe01f12..dd5db7a 100644 --- a/docs/developer/ABI-FFI-README.adoc +++ b/docs/developer/ABI-FFI-README.adoc @@ -44,7 +44,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design: ▼ ┌─────────────────────────────────────────────┐ │ Any Language via C ABI │ -│ - Rust, ReScript, Julia, Python, etc. │ +│ - Rust, AffineScript, Julia, Python, etc. │ └─────────────────────────────────────────────┘ ``` @@ -76,7 +76,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design: │ └── bindings/ # Language-specific wrappers (optional) ├── rust/ - ├── rescript/ + ├── affinescript/ └── julia/ ``` diff --git a/docs/governance/MAINTENANCE-CHECKLIST.a2ml b/docs/governance/MAINTENANCE-CHECKLIST.a2ml index eaee720..698f4d0 100644 --- a/docs/governance/MAINTENANCE-CHECKLIST.a2ml +++ b/docs/governance/MAINTENANCE-CHECKLIST.a2ml @@ -67,7 +67,7 @@ compliance-seams-check = true exception-register-required = true exception-bounded-scope-required = true policy-drift-contamination-check = true -example-drift-risk = "single TypeScript exception causing broad ReScript->TypeScript migration" +example-drift-risk = "single TypeScript exception causing broad AffineScript->TypeScript migration" compliance-tooling = "panic-attack" effects-tooling = "ecological checking with sustainabot guidance" diff --git a/docs/practice/AI-CONVENTIONS.adoc b/docs/practice/AI-CONVENTIONS.adoc index 58e132b..6a3636b 100644 --- a/docs/practice/AI-CONVENTIONS.adoc +++ b/docs/practice/AI-CONVENTIONS.adoc @@ -53,7 +53,7 @@ MAINTENANCE-CHECKLIST.a2ml, or SOFTWARE-DEVELOPMENT-APPROACH.a2ml in the reposit | Banned | Use Instead | |---------------------|--------------------| -| TypeScript | ReScript | +| TypeScript | AffineScript | | Node.js / npm / bun | Deno | | Go | Rust | | Python | Julia / Rust | diff --git a/examples/web-project-deno.json b/examples/web-project-deno.json index 5ddd3bd..ee775a4 100644 --- a/examples/web-project-deno.json +++ b/examples/web-project-deno.json @@ -1,17 +1,17 @@ { - "// NOTE": "Example deno.json for ReScript web projects", + "// NOTE": "Example deno.json for AffineScript web projects", "tasks": { - "build": "deno run -A npm:rescript", - "clean": "deno run -A npm:rescript clean", - "watch": "deno run -A npm:rescript -w", + "build": "deno run -A npm:affinescript", + "clean": "deno run -A npm:affinescript clean", + "watch": "deno run -A npm:affinescript -w", "serve": "deno run -A jsr:@std/http/file-server .", "test": "deno test --allow-all" }, "imports": { - "rescript": "^12.0.0", - "@rescript/core": "npm:@rescript/core@^1.6.0", - "safe-dom/": "https://raw.githubusercontent.com/hyperpolymath/rescript-dom-mounter/main/src/", - "proven/": "../proven/bindings/rescript/src/" + "affinescript": "^12.0.0", + "@affinescript/core": "npm:@affinescript/core@^1.6.0", + "safe-dom/": "https://raw.githubusercontent.com/hyperpolymath/affinescript-dom-mounter/main/src/", + "proven/": "../proven/bindings/affinescript/src/" }, "compilerOptions": { "allowJs": true, diff --git a/llm-warmup-dev.adoc b/llm-warmup-dev.adoc new file mode 100644 index 0000000..436663f --- /dev/null +++ b/llm-warmup-dev.adoc @@ -0,0 +1,19 @@ +== LLM Warmup — betlangiser (Developer) + +=== What is betlangiser? + +See README.adoc for overview. + +=== Key Commands + +* `+just setup+` — set up development environment +* `+just build+` — build the project +* `+just test+` — run tests +* `+just doctor+` — diagnose issues +* `+just heal+` — attempt auto-repair + +=== Quick Context + +* License: MPL-2.0 +* Part of hyperpolymath ecosystem +* See EXPLAINME.adoc for architecture diff --git a/llm-warmup-dev.md b/llm-warmup-dev.md deleted file mode 100644 index 5229d43..0000000 --- a/llm-warmup-dev.md +++ /dev/null @@ -1,16 +0,0 @@ -# LLM Warmup — betlangiser (Developer) - -## What is betlangiser? -See README.adoc for overview. - -## Key Commands -- `just setup` — set up development environment -- `just build` — build the project -- `just test` — run tests -- `just doctor` — diagnose issues -- `just heal` — attempt auto-repair - -## Quick Context -- License: MPL-2.0 -- Part of hyperpolymath ecosystem -- See EXPLAINME.adoc for architecture diff --git a/llm-warmup-user.adoc b/llm-warmup-user.adoc new file mode 100644 index 0000000..ffb624c --- /dev/null +++ b/llm-warmup-user.adoc @@ -0,0 +1,19 @@ +== LLM Warmup — betlangiser (User) + +=== What is betlangiser? + +See README.adoc for overview. + +=== Key Commands + +* `+just setup+` — set up development environment +* `+just build+` — build the project +* `+just test+` — run tests +* `+just doctor+` — diagnose issues +* `+just heal+` — attempt auto-repair + +=== Quick Context + +* License: MPL-2.0 +* Part of hyperpolymath ecosystem +* See EXPLAINME.adoc for architecture diff --git a/llm-warmup-user.md b/llm-warmup-user.md deleted file mode 100644 index 5d46c0c..0000000 --- a/llm-warmup-user.md +++ /dev/null @@ -1,16 +0,0 @@ -# LLM Warmup — betlangiser (User) - -## What is betlangiser? -See README.adoc for overview. - -## Key Commands -- `just setup` — set up development environment -- `just build` — build the project -- `just test` — run tests -- `just doctor` — diagnose issues -- `just heal` — attempt auto-repair - -## Quick Context -- License: MPL-2.0 -- Part of hyperpolymath ecosystem -- See EXPLAINME.adoc for architecture