|
| 1 | +[](https://github.com/sponsors/hyperpolymath) |
| 2 | + |
| 3 | +// SPDX-License-Identifier: MPL-2.0 |
| 4 | +// SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 5 | + |
| 6 | += Axiology.jl |
| 7 | +Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 8 | +:toc: |
| 9 | + |
| 10 | +image:https://img.shields.io/badge/OpenSSF-Best_Practices-green?logo=opensourcesecurity[OpenSSF Best Practices,link="https://www.bestpractices.dev/en/projects/new?repo_url=https://github.com/hyperpolymath/Axiology.jl"] |
| 11 | +image:https://img.shields.io/badge/License-PMPL--1.0-blue.svg[License: PMPL-1.0,link="https://github.com/hyperpolymath/palimpsest-license"] |
| 12 | +image:https://api.thegreenwebfoundation.org/greencheckimage/github.com[Green Web,link="https://www.thegreenwebfoundation.org/green-web-check/?url=github.com"] |
| 13 | + |
| 14 | +== Overview |
| 15 | + |
| 16 | +**Axiology.jl** is a fully functional Julia library for value theory in machine learning and automated reasoning systems. |
| 17 | + |
| 18 | +image:https://img.shields.io/badge/Project-Topology-9558B2[Topology,link="TOPOLOGY.md"] |
| 19 | +image:https://img.shields.io/badge/Completion-65%25-yellow[65%,link="TOPOLOGY.md"] |
| 20 | + |
| 21 | +> **Status**: ✅ **Alpha - Core value system functional, integration APIs planned** - 1,088 lines of code, 43/45 tests passing |
| 22 | +
|
| 23 | +> Axiology (from Greek ἀξία _axiā_ "value") is the philosophical study of value. This library brings axiology into computational form, enabling ML systems to reason about and verify value-aligned behavior. |
| 24 | +
|
| 25 | +== The Value Alignment Problem |
| 26 | + |
| 27 | +Machine learning systems optimize objective functions, but: |
| 28 | + |
| 29 | +* **Misalignment Risk**: Optimizing the wrong metric leads to harmful behavior |
| 30 | +* **Multi-Objective Tradeoffs**: Real systems balance competing values (fairness, efficiency, safety) |
| 31 | +* **Implicit Values**: ML decisions encode ethical choices whether acknowledged or not |
| 32 | + |
| 33 | +Axiology.jl makes values **explicit, verifiable, and composable**. |
| 34 | + |
| 35 | +== Core Concepts |
| 36 | + |
| 37 | +=== Value Types |
| 38 | + |
| 39 | +Axiology.jl provides a hierarchy of value types: |
| 40 | + |
| 41 | +[source,julia] |
| 42 | +---- |
| 43 | +abstract type Value end |
| 44 | + |
| 45 | +struct Fairness <: Value end |
| 46 | +struct Welfare <: Value end |
| 47 | +struct Profit <: Value end |
| 48 | +struct Efficiency <: Value end |
| 49 | +struct Safety <: Value end |
| 50 | +---- |
| 51 | + |
| 52 | +=== Value Operations |
| 53 | + |
| 54 | +**Satisfy**: Check if a system state satisfies a value criterion |
| 55 | + |
| 56 | +[source,julia] |
| 57 | +---- |
| 58 | +satisfy(value::Value, state::SystemState) -> Bool |
| 59 | +---- |
| 60 | + |
| 61 | +**Maximize**: Optimize a system to maximize a value |
| 62 | + |
| 63 | +[source,julia] |
| 64 | +---- |
| 65 | +maximize(value::Value, system::System) -> OptimizedSystem |
| 66 | +---- |
| 67 | + |
| 68 | +**Verify**: Formally verify value alignment |
| 69 | + |
| 70 | +[source,julia] |
| 71 | +---- |
| 72 | +verify_value(value::Value, proof::Proof) -> Verified | Failed |
| 73 | +---- |
| 74 | + |
| 75 | +== Installation |
| 76 | + |
| 77 | +From Julia REPL: |
| 78 | + |
| 79 | +[source,julia] |
| 80 | +---- |
| 81 | +using Pkg |
| 82 | +Pkg.add("Axiology") |
| 83 | +---- |
| 84 | + |
| 85 | +== Usage Examples |
| 86 | + |
| 87 | +=== Fairness-Aware ML |
| 88 | + |
| 89 | +[source,julia] |
| 90 | +---- |
| 91 | +using Axiology, MLJ |
| 92 | + |
| 93 | +# Define fairness criterion |
| 94 | +fairness = Fairness( |
| 95 | + protected_attribute = :gender, |
| 96 | + metric = :demographic_parity, |
| 97 | + threshold = 0.05 # Max 5% disparity |
| 98 | +) |
| 99 | + |
| 100 | +# Train model with fairness constraint |
| 101 | +model = train(algorithm, data, constraints=[fairness]) |
| 102 | + |
| 103 | +# Verify fairness post-hoc |
| 104 | +@assert satisfy(fairness, model) |
| 105 | +---- |
| 106 | + |
| 107 | +=== Multi-Objective Optimization |
| 108 | + |
| 109 | +[source,julia] |
| 110 | +---- |
| 111 | +using Axiology |
| 112 | + |
| 113 | +# Define competing values |
| 114 | +values = [ |
| 115 | + Welfare(metric=:utility_sum, weight=0.4), |
| 116 | + Fairness(metric=:gini_coefficient, weight=0.3), |
| 117 | + Efficiency(metric=:computation_time, weight=0.3) |
| 118 | +] |
| 119 | + |
| 120 | +# Pareto-optimal solutions |
| 121 | +solutions = pareto_frontier(system, values) |
| 122 | + |
| 123 | +# Select solution with value tradeoff |
| 124 | +chosen = select_solution(solutions, preference=:balanced) |
| 125 | +---- |
| 126 | + |
| 127 | +=== Formal Value Verification |
| 128 | + |
| 129 | +[source,julia] |
| 130 | +---- |
| 131 | +using Axiology, ECHIDNA |
| 132 | + |
| 133 | +# Define value invariant |
| 134 | +safety = Safety( |
| 135 | + invariant = "∀ state. system(state) ⟹ safe(state)", |
| 136 | + prover = :Lean |
| 137 | +) |
| 138 | + |
| 139 | +# Generate formal proof |
| 140 | +proof = prove(safety.invariant, system) |
| 141 | + |
| 142 | +# Verify with theorem prover |
| 143 | +verification = verify_value(safety, proof) |
| 144 | + |
| 145 | +if verification isa Verified |
| 146 | + println("System formally proven safe ✓") |
| 147 | +else |
| 148 | + println("Safety violation: $(verification.counterexample)") |
| 149 | +end |
| 150 | +---- |
| 151 | + |
| 152 | +== API Reference |
| 153 | + |
| 154 | +=== Value Types |
| 155 | + |
| 156 | +`Fairness`:: |
| 157 | +Encodes fairness criteria (demographic parity, equalized odds, etc.) |
| 158 | + |
| 159 | +`Welfare`:: |
| 160 | +Utilitarian welfare measures (sum, mean, or weighted utility) |
| 161 | + |
| 162 | +`Profit`:: |
| 163 | +Economic value (revenue, cost, ROI) |
| 164 | + |
| 165 | +`Efficiency`:: |
| 166 | +Resource efficiency (time, memory, energy) |
| 167 | + |
| 168 | +`Safety`:: |
| 169 | +Safety constraints (invariants, preconditions, postconditions) |
| 170 | + |
| 171 | +=== Core Functions |
| 172 | + |
| 173 | +`satisfy(value, state) -> Bool`:: |
| 174 | +Check if `state` satisfies `value` criterion. |
| 175 | + |
| 176 | +`maximize(value, system) -> OptimizedSystem`:: |
| 177 | +Optimize `system` to maximize `value` while preserving constraints. |
| 178 | + |
| 179 | +`verify_value(value, proof) -> Verified | Failed`:: |
| 180 | +Formally verify that `proof` demonstrates value alignment. |
| 181 | + |
| 182 | +`pareto_frontier(system, values) -> Vector{Solution}`:: |
| 183 | +Compute Pareto-optimal solutions for multi-objective value optimization. |
| 184 | + |
| 185 | +`select_solution(solutions, preference) -> Solution`:: |
| 186 | +Select solution from Pareto frontier based on value preferences. |
| 187 | + |
| 188 | +== Theoretical Foundations |
| 189 | + |
| 190 | +Axiology.jl draws from: |
| 191 | + |
| 192 | +* **Moral Philosophy**: Utilitarianism, deontology, virtue ethics |
| 193 | +* **Welfare Economics**: Pareto efficiency, social welfare functions |
| 194 | +* **Game Theory**: Nash equilibria, cooperative games, mechanism design |
| 195 | +* **Formal Methods**: Model checking, theorem proving, contract verification |
| 196 | +* **ML Fairness**: Demographic parity, equalized odds, individual fairness |
| 197 | + |
| 198 | +== Integration with ECHIDNA |
| 199 | + |
| 200 | +Axiology.jl is designed for tight integration with ECHIDNA: |
| 201 | + |
| 202 | +* **Formal Verification**: Use ECHIDNA's 17 theorem provers to verify value invariants |
| 203 | +* **Neural Guidance**: Train ML models to predict value-aligned actions |
| 204 | +* **Multi-Prover Consensus**: Cross-validate value proofs across multiple provers |
| 205 | +* **Explainability**: Generate natural language explanations of value tradeoffs |
| 206 | + |
| 207 | +=== Example: Verified Fairness |
| 208 | + |
| 209 | +[source,julia] |
| 210 | +---- |
| 211 | +using Axiology, ECHIDNA |
| 212 | + |
| 213 | +# Define fairness as formal invariant |
| 214 | +fairness = Fairness( |
| 215 | + invariant = "∀ (x₁ x₂ : Input). |
| 216 | + protected_attr(x₁) ≠ protected_attr(x₂) ⟹ |
| 217 | + |P(Ŷ=1|X=x₁) - P(Ŷ=1|X=x₂)| < ε", |
| 218 | + prover = :Lean |
| 219 | +) |
| 220 | + |
| 221 | +# Generate proof with ECHIDNA |
| 222 | +proof = ECHIDNA.prove(fairness.invariant, |
| 223 | + model=my_classifier, |
| 224 | + prover=:Lean) |
| 225 | + |
| 226 | +# Verify |
| 227 | +result = verify_value(fairness, proof) |
| 228 | +---- |
| 229 | + |
| 230 | +== Development Status |
| 231 | + |
| 232 | +Current Version: **0.1.0** (Initial Release) |
| 233 | + |
| 234 | +* [x] Core value type hierarchy |
| 235 | +* [x] Basic satisfy/maximize/verify API |
| 236 | +* [x] Initial test suite |
| 237 | +* [x] RSR compliance |
| 238 | +* [ ] Multi-objective optimization |
| 239 | +* [ ] Formal verification integration with ECHIDNA |
| 240 | +* [ ] ML fairness library integration (FairLearn, AIF360) |
| 241 | +* [ ] Comprehensive documentation |
| 242 | + |
| 243 | +See link:ROADMAP.adoc[ROADMAP.adoc] for development plans. |
| 244 | + |
| 245 | +== Use Cases |
| 246 | + |
| 247 | +=== Healthcare AI |
| 248 | +* **Safety**: Verify medical AI never recommends contraindicated treatments |
| 249 | +* **Fairness**: Ensure diagnostic models don't discriminate by race/gender |
| 250 | +* **Welfare**: Optimize for patient outcomes, not just hospital metrics |
| 251 | + |
| 252 | +=== Financial Systems |
| 253 | +* **Fairness**: Prevent algorithmic discrimination in lending |
| 254 | +* **Profit**: Balance returns with stakeholder welfare |
| 255 | +* **Efficiency**: Optimize execution speed without market manipulation |
| 256 | + |
| 257 | +=== Autonomous Vehicles |
| 258 | +* **Safety**: Formally prove collision avoidance under all conditions |
| 259 | +* **Welfare**: Balance passenger and pedestrian safety |
| 260 | +* **Efficiency**: Optimize routes without compromising safety |
| 261 | + |
| 262 | +=== Public Policy |
| 263 | +* **Welfare**: Evaluate policy impact with social welfare functions |
| 264 | +* **Fairness**: Detect and mitigate disparate impact |
| 265 | +* **Efficiency**: Balance effectiveness with resource constraints |
| 266 | + |
| 267 | +== License |
| 268 | + |
| 269 | +Dual licensed under: |
| 270 | + |
| 271 | +* **MIT License** - link:LICENSE-MIT[LICENSE-MIT] |
| 272 | +* **Palimpsest Meta-Project License 1.0** - link:LICENSE-PMPL[LICENSE-PMPL] |
| 273 | + |
| 274 | +Choose either license for use, modification, and distribution. |
| 275 | + |
| 276 | +== Contributing |
| 277 | + |
| 278 | +See link:CONTRIBUTING.md[CONTRIBUTING.md] for contribution guidelines. |
| 279 | + |
| 280 | +Priority areas: |
| 281 | + |
| 282 | +* **Formal Methods**: Integration with Lean, Coq, Isabelle |
| 283 | +* **ML Fairness**: Wrappers for existing fairness libraries |
| 284 | +* **Case Studies**: Real-world value alignment applications |
| 285 | +* **Visualization**: Tools for value tradeoff exploration |
| 286 | + |
| 287 | +== Citation |
| 288 | + |
| 289 | +If you use Axiology.jl in research, please cite: |
| 290 | + |
| 291 | +[source,bibtex] |
| 292 | +---- |
| 293 | +@software{axiology2026, |
| 294 | + author = {Jewell, Jonathan D.A.}, |
| 295 | + title = {Axiology.jl: Value Theory for Machine Learning}, |
| 296 | + year = {2026}, |
| 297 | + version = {0.1.0}, |
| 298 | + url = {https://github.com/hyperpolymath/Axiology.jl} |
| 299 | +} |
| 300 | +---- |
| 301 | + |
| 302 | +== References |
| 303 | + |
| 304 | +* **AI Alignment**: Russell, S. (2019). _Human Compatible: AI and the Problem of Control_ |
| 305 | +* **ML Fairness**: Barocas, S., Hardt, M., & Narayanan, A. (2023). _Fairness and Machine Learning_ |
| 306 | +* **Formal Methods**: Hoare, T. (1969). "An Axiomatic Basis for Computer Programming" |
| 307 | +* **Value Theory**: Korsgaard, C. (1983). "Two Distinctions in Goodness" |
| 308 | +* **Welfare Economics**: Sen, A. (1970). _Collective Choice and Social Welfare_ |
| 309 | + |
| 310 | +== Contact |
| 311 | + |
| 312 | +* **Author:** Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 313 | +* **GitHub:** https://github.com/hyperpolymath/Axiology.jl |
| 314 | +* **Issues:** https://github.com/hyperpolymath/Axiology.jl/issues |
0 commit comments