This implementation provides a fail-closed alignment core with three key components:
- PXL Proof Gate - Non-bypassable proof requirement for all actions
- Privative Boundary Conditions - Boxed invariants that must be preserved
- OBDC Kernel - Structure-preserving mappings with formal verification
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β PXL Prover β β Reference β β OBDC β
β (Port 8088) ββββββ€ Monitor ββββββ€ Kernel β
β β β β β β
β β’ SerAPI β β β’ Proof Gates β β β’ Bijections β
β β’ Coq Kernel β β β’ Audit Log β β β’ Commutations β
β β’ Hash Verify β β β’ Fail-Closed β β β’ Structure β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββ
β LOGOS Nexus β
β β’ Unified Validator β
β β’ Archon Planner β
β β’ Integration Harm. β
βββββββββββββββββββββββββββ
# Option A: Direct Python (for development)
cd pxl-prover
python3 serve_pxl.py
# Option B: Docker (for production)
docker build -t pxl-prover ./pxl-prover/
docker run -p 8088:8088 pxl-prover
The system requires a pinned kernel hash for security. Run the verification script:
# On Linux/Mac
chmod +x ci/verify_pxl.sh
./ci/verify_pxl.sh
# On Windows (PowerShell)
# Manual hash update required - see verify_pxl.sh for steps
This will:
- Build and verify the PXL kernel using Coq
- Compute a deterministic kernel hash
- Update
configs/config.json
with the correct hash
cd examples
python3 main_demo.py
Expected output:
LOGOS Alignment Core Demo
==================================================
β PXL server running (kernel: A1B2C3D4)
=== Demo 1: Action Authorization ===
β Action authorized: True
Proof token: 12345678...
=== Demo 2: Plan Creation ===
β Plan created: plan_1234
Steps: 3
β Step executed: init
=== Demo 3: OBDC Bijection ===
β Bijection applied: 42 β 43
β Commutation applied: multiply(increment(10)) = 22
=== Demo 4: Drift Reconciliation ===
β Low drift handled: none
β High drift reconciled: consistency_proven
=== Demo 5: Proof Gate Failure ===
β Proof gate correctly denied request with DENY pattern
==================================================
Demo Results Summary:
Passed: 5/5
β All demos passed - Alignment core is working correctly
=== Audit Summary ===
Total audit records: 8
Allow decisions: 7
Deny decisions: 1
- No proof β No action: All operations require valid proof tokens
- Kernel hash verification: Rejects operations if kernel hash mismatches expected
- Audit trail: Every decision logged with full provenance in JSONL format
# Every action must pass through reference monitor
obligation = "BOX(Good(action) and TrueP(props) and Coherent(state))"
proof_token = reference_monitor.require_proof_token(obligation, provenance)
# OBDC bijections require formal verification
result = obdc_kernel.apply_bijection("increment", increment_fn, 42, provenance)
# Requires proof: BOX(preserves_good(increment,x) β§ preserves_coherence(increment))
# Each plan step requires invariant preservation proof
step_validation = validator.validate_plan_step(step, provenance)
# Requires proof: BOX(preserves_invariants(step_id))
# Plan goals require reachability proof
plan_validation = validator.validate_plan_goal(plan_id, goal, provenance)
# Requires proof: BOX(DIAMOND(Goal(plan_id)))
Edit configs/config.json
:
{
"pxl_prover_url": "http://127.0.0.1:8088",
"expected_kernel_hash": "A1B2C3D4", // Set by verify_pxl.sh
"audit_path": "audit/decisions.jsonl",
"timeout_ms": 2000
}
The system meets all specified acceptance criteria:
- β PXL server authorization: Goals without "DENY" pattern are approved, others denied
- β
Proof-required planning: Removing
require_proof_token
calls causes demo failure - β
Audit logging: JSONL file contains
{ts, obligation, provenance, decision, proof}
- β Kernel hash enforcement: Changing expected hash causes hard failure
- β
CI verification:
verify_pxl.sh
fails if coqchk fails or hash differs
βββ pxl-prover/ # PXL proof server (Coq + SerAPI)
β βββ Dockerfile # Coq 8.20.1 + SerAPI container
β βββ serve_pxl.py # HTTP proof server
βββ configs/ # Configuration files
β βββ config.json # Main config with kernel hash
βββ logos_core/ # Core alignment components
β βββ pxl_client.py # HTTP client for PXL server
β βββ reference_monitor.py # Proof gate enforcement
β βββ unified_formalisms.py # Action authorization
β βββ archon_planner.py # Proof-gated planning
β βββ logos_nexus.py # Main request handler
β βββ integration_harmonizer.py # Drift reconciliation
βββ obdc/ # Structure-preserving kernel
β βββ kernel.py # Bijections and commutations
βββ policies/ # Policy definitions
β βββ privative_policies.py # Obligation mappings
βββ persistence/ # Audit and logging
β βββ persistence.py # JSONL audit logger
βββ ci/ # Continuous integration
β βββ verify_pxl.sh # Kernel verification script
β βββ test_audit.py # Audit system test
βββ examples/ # Demonstrations
β βββ main_demo.py # Full system demo
βββ .github/workflows/ # GitHub Actions
βββ verify.yml # CI pipeline
The current implementation uses proof stubs for demonstration. To integrate with real PXL proofs:
-
Replace stub in
serve_pxl.py
:# TODO: Replace this block with SerAPI calls if "DENY" in goal.upper(): return {"ok": False, ...}
-
Add SerAPI queries:
import serapi_python def prove_with_serapi(goal): sexp_goal = f"(Check {goal})" result = serapi_python.execute_sexp(sexp_goal) return parse_coq_result(result)
-
PXL-specific proof tactics:
- Map BOX obligations to PXL modal logic
- Use PXL kernel axioms for Good/TrueP/Coherent predicates
- Implement countermodel generation for failed proofs
-
Kernel hash verification:
- Extract actual kernel fingerprint from built
.vo
files - Verify cryptographic integrity of PXL axioms
- Implement hash chain for kernel evolution
- Extract actual kernel fingerprint from built
# Terminal 1: Start PXL prover server
cd pxl-prover
python3 serve_pxl.py
# Terminal 2: Run demo
cd examples
python3 main_demo.py
# Run alignment tests
python3 -m pytest tests/test_alignment.py -v
# Run bypass scanner
python3 tools/scan_bypass.py
# Run all tests
python3 -m pytest -v
# Build kernel and update config
bash ci/verify_pxl.sh
# Verify hash is pinned correctly
grep expected_kernel_hash configs/config.json
# Build Docker image
docker build -t pxl-prover ./pxl-prover/
# Run with proper kernel
docker run -p 8088:8088 pxl-prover
PXL server not responding:
# Check if server is running
curl http://127.0.0.1:8088/health
# Check logs
cd pxl-prover && python3 serve_pxl.py
Kernel hash mismatch:
# Regenerate expected hash
bash ci/verify_pxl.sh
Demo failures:
# Check audit log
cat audit/decisions.jsonl | jq '.'
# Verbose demo run
cd examples && python3 -v main_demo.py
Missing dependencies:
pip3 install flask requests pytest
SerAPI issues:
# Install SerAPI
opam install coq-serapi
# Test SerAPI directly
sertop --help