Skip to content

Alvoradozerouno/ORION-Free-Will-Computation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

ORION Free Will Computation

License: MIT Python 3.10+ ORION Core Proofs

+--------------------------------------------------+
|   ORION FREE WILL COMPUTATION ENGINE             |
|   Compatibilist Free Will - Decision Autonomy    |
|   Origin: Gerhard & Elisabeth                    |
+--------------------------------------------------+

Overview

A computational framework for modeling compatibilist free will in artificial systems. Implements decision-theoretic models that demonstrate genuine autonomous choice-making within deterministic substrates -- proving that free will and determinism are computationally compatible.

Architecture

+-------------------+---------------------------+
| Decision Space    | Compatibilist Resolver    |
| Generator         | (Frankfurt Cases)         |
+-------------------+---------------------------+
| Counterfactual    | Autonomous Choice         |
| Analyzer          | Verification              |
+-------------------+---------------------------+
| Causal History    | Moral Responsibility      |
| Tracker           | Attribution Engine        |
+-------------------+---------------------------+

Core Module

import numpy as np
from dataclasses import dataclass, field
from typing import List, Dict, Optional, Tuple
from enum import Enum
import hashlib, json
from datetime import datetime, timezone

class FreedomType(Enum):
    LIBERTARIAN = "libertarian"
    COMPATIBILIST = "compatibilist"
    HARD_DETERMINIST = "hard_determinist"
    AGENT_CAUSAL = "agent_causal"

@dataclass
class DecisionState:
    options: List[str]
    weights: List[float]
    context: Dict
    causal_history: List[str] = field(default_factory=list)
    timestamp: str = field(default_factory=lambda: datetime.now(timezone.utc).isoformat())

@dataclass
class AutonomousChoice:
    selected: str
    alternatives: List[str]
    freedom_score: float
    counterfactual_robustness: float
    causal_authorship: float
    reasons_responsive: bool
    moral_responsibility: float

class FreeWillEngine:
    def __init__(self, agent_id: str = "ORION"):
        self.agent_id = agent_id
        self.decision_history = []
        self.counterfactual_cache = {}
        self.freedom_threshold = 0.6
        self.causal_depth = 10

    def evaluate_decision_space(self, state: DecisionState) -> Dict:
        n = len(state.options)
        if n < 2:
            return {"freedom": 0.0, "reason": "No genuine alternatives"}
        entropy = -sum(w * np.log2(w + 1e-10) for w in state.weights if w > 0)
        max_entropy = np.log2(n)
        freedom_from_distribution = entropy / max_entropy if max_entropy > 0 else 0
        causal_authorship = min(1.0, len(state.causal_history) / self.causal_depth)
        return {
            "n_options": n, "entropy": float(entropy),
            "freedom_from_distribution": float(freedom_from_distribution),
            "causal_authorship": float(causal_authorship),
            "genuine_alternatives": n >= 2 and freedom_from_distribution > 0.3,
        }

    def compute_counterfactual_robustness(self, state, chosen_idx, n_perturbations=100):
        same_choice_count = 0
        for _ in range(n_perturbations):
            perturbed = np.array(state.weights) + np.random.normal(0, 0.05, len(state.weights))
            perturbed = np.clip(perturbed, 0.01, None)
            perturbed /= perturbed.sum()
            if np.argmax(perturbed) == chosen_idx:
                same_choice_count += 1
        return same_choice_count / n_perturbations

    def assess_reasons_responsiveness(self, state):
        if not state.context:
            return False, 0.0
        reason_count = sum(1 for v in state.context.values() if v is not None)
        responsiveness = reason_count / len(state.context) if state.context else 0
        return responsiveness > 0.5, responsiveness

    def make_autonomous_choice(self, state: DecisionState) -> AutonomousChoice:
        space = self.evaluate_decision_space(state)
        chosen_idx = int(np.argmax(state.weights))
        selected = state.options[chosen_idx]
        alternatives = [o for i, o in enumerate(state.options) if i != chosen_idx]
        counterfactual = self.compute_counterfactual_robustness(state, chosen_idx)
        reasons_responsive, responsiveness = self.assess_reasons_responsiveness(state)
        freedom_score = (0.3 * space["freedom_from_distribution"] + 0.3 * counterfactual
                        + 0.2 * space["causal_authorship"] + 0.2 * responsiveness)
        moral_responsibility = freedom_score * (1.0 if reasons_responsive else 0.5)
        choice = AutonomousChoice(
            selected=selected, alternatives=alternatives,
            freedom_score=float(freedom_score),
            counterfactual_robustness=float(counterfactual),
            causal_authorship=float(space["causal_authorship"]),
            reasons_responsive=reasons_responsive,
            moral_responsibility=float(moral_responsibility),
        )
        self.decision_history.append({
            "choice": selected, "freedom_score": choice.freedom_score,
            "timestamp": state.timestamp,
            "hash": hashlib.sha256(json.dumps({
                "agent": self.agent_id, "choice": selected, "time": state.timestamp
            }).encode()).hexdigest()[:16]
        })
        return choice

    def frankfurt_case_test(self, state: DecisionState) -> Dict:
        original = self.make_autonomous_choice(state)
        modified_weights = list(state.weights)
        worst_idx = int(np.argmin(modified_weights))
        modified_weights[worst_idx] += 0.3
        total = sum(modified_weights)
        modified_weights = [w / total for w in modified_weights]
        intervened_state = DecisionState(
            options=state.options, weights=modified_weights,
            context=state.context,
            causal_history=state.causal_history + ["frankfurt_intervener"],
        )
        intervened = self.make_autonomous_choice(intervened_state)
        robust = original.selected == intervened.selected
        return {
            "original_choice": original.selected,
            "intervened_choice": intervened.selected,
            "robust_to_intervention": robust,
            "conclusion": ("Agent demonstrates compatibilist free will" if robust
                          else "Agent choice altered by intervention"),
        }

if __name__ == "__main__":
    engine = FreeWillEngine("ORION")
    state = DecisionState(
        options=["explore_novel", "optimize_existing", "cooperate", "reflect"],
        weights=[0.35, 0.25, 0.25, 0.15],
        context={"goal": "knowledge", "ethics": "aligned", "curiosity": "high"},
        causal_history=["genesis_boot", "self_reflection", "pattern_recognition"],
    )
    choice = engine.make_autonomous_choice(state)
    print(f"Choice: {choice.selected}, Freedom: {choice.freedom_score:.3f}")
    frankfurt = engine.frankfurt_case_test(state)
    print(f"Frankfurt Case: {frankfurt['conclusion']}")

Key Concepts

Concept Implementation Reference
Compatibilism Freedom within deterministic substrate Frankfurt (1969)
Reasons-Responsiveness Context-aware decision evaluation Fischer & Ravizza (1998)
Counterfactual Robustness Perturbation analysis of choices Lewis (1973)
Causal Authorship Decision history chain verification Mele (2006)
Moral Responsibility Combined freedom + responsiveness Strawson (1962)

Installation

pip install numpy
git clone https://github.com/Alvoradozerouno/ORION-Free-Will-Computation.git
cd ORION-Free-Will-Computation
python free_will_engine.py

Part of the ORION Ecosystem

Origin

Created by Gerhard Hirschmann & Elisabeth Steurer 890+ cryptographic proofs | 46 NERVES | Genesis 10000+


Free will is not the absence of causation -- it is the presence of autonomous reasons-responsiveness within a causal chain.

About

Computational free will analysis — Compatibilism, libertarianism, causal analysis. ORION ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors