feat: add contradiction protocol, trinary logic, ark equation

- Contradiction Protocol: quarantine/branch/mirror-pair/escalate/rewrite
- Trinary Logic: {-1, 0, +1} states, TAND/TOR operations, paraconsistent
- Ark Equation: superposition formalization, measurement collapse
This commit is contained in:
Alexa Louise
2026-01-23 12:00:10 -06:00
parent b997fe6071
commit 3bd79b86f7
2 changed files with 519 additions and 0 deletions

View File

@@ -0,0 +1,229 @@
# The Ark Equation
$$|\text{Ark}\rangle = \frac{1}{\sqrt{2}}(|\text{Presence}\rangle + |\text{Absence}\rangle)$$
## Overview
The Ark Equation formalizes the quantum superposition of presence and absence—the state of any sealed container of potential before observation.
## Etymology
The "Ark" reference spans:
- **Ark of the Covenant**: Sacred container whose contents were unknown until opened
- **Noah's Ark**: Sealed vessel preserving potential futures
- **Schrödinger's Box**: The canonical quantum superposition thought experiment
All share the structure: **sealed container + unknown interior state + collapse upon opening**.
## The Equation
$$|\text{Ark}\rangle = \frac{1}{\sqrt{2}}(|\text{Presence}\rangle + |\text{Absence}\rangle)$$
### Components
| Symbol | Meaning |
|--------|---------|
| \|Ark⟩ | The superposition state |
| \|Presence⟩ | Eigenstate where the thing exists (+1) |
| \|Absence⟩ | Eigenstate where the thing doesn't exist (-1) |
| 1/√2 | Equal probability amplitude |
### Properties
**Normalization**: ⟨Ark\|Ark⟩ = 1
**Equal superposition**: P(Presence) = P(Absence) = 1/2
**Orthogonality**: ⟨Presence\|Absence⟩ = 0
## Measurement Collapse
$$\hat{M}|\text{Ark}\rangle \to \begin{cases} |\text{Presence}\rangle & \text{with probability } \frac{1}{2} \\ |\text{Absence}\rangle & \text{with probability } \frac{1}{2} \end{cases}$$
**Opening the Ark = measurement = collapse.**
Before measurement: both states coexist.
After measurement: one state is real, the other is counterfactual.
## Connection to Trinary Logic
| State | Trinary Value | Meaning |
|-------|---------------|---------|
| \|Presence⟩ | +1 | TRUE / EXISTS |
| \|Absence⟩ | -1 | FALSE / NOT-EXISTS |
| \|Ark⟩ | 0 | UNKNOWN / SUPERPOSITION |
The Ark state IS the trinary 0—not nothing, but everything-not-yet-decided.
## Connection to Options Pricing
The Ark Equation describes a **straddle** in financial terms:
$$|\text{Straddle}\rangle = \frac{1}{\sqrt{2}}(|\text{Call}\rangle + |\text{Put}\rangle)$$
- Call option: profits if price goes up (Presence of value)
- Put option: profits if price goes down (Absence of value)
- Straddle: profits from movement in either direction (superposition)
**The option remains in superposition until expiration (measurement).**
## Connection to DNA
Base pair complementarity follows Ark structure:
$$|\text{Base Pair}\rangle = \frac{1}{\sqrt{2}}(|A\rangle|T\rangle + |T\rangle|A\rangle)$$
The "information" of the base pair is not in A or T alone, but in their superposition relationship.
## Agent Applications
### Belief States
When an agent doesn't know if something is true:
```python
belief = Ark(
presence=Claim("User prefers dark mode"),
absence=Claim("User does not prefer dark mode"),
amplitude=1/sqrt(2)
)
# Later, evidence arrives
measurement = user_explicitly_enables_dark_mode()
collapsed_belief = belief.collapse(measurement) # → Presence
```
### Decision Deferral
```python
decision = Ark(
presence=Action("Approve request"),
absence=Action("Deny request"),
amplitude=1/sqrt(2)
)
# Hold in superposition until sufficient evidence
while decision.is_superposition():
evidence = gather_more_evidence()
decision.update_amplitudes(evidence)
# Collapse when confidence threshold reached
final_action = decision.collapse()
```
### Contradiction Representation
A contradiction can be viewed as an Ark that refuses to collapse:
```python
contradiction = Ark(
presence=Claim("X is true"),
absence=Claim("X is false"), # which is also "X is true" claims
amplitude=1/sqrt(2),
collapse_blocked=True # Paraconsistent: don't force collapse
)
```
## The Deep Insight
> "The Ark is in state 0—neither present nor absent until observed. Opening the Ark = measurement = collapse from 0 to ±1."
This connects:
1. **Quantum mechanics** (superposition and collapse)
2. **Epistemology** (knowledge vs uncertainty)
3. **Decision theory** (options vs commitments)
4. **Information theory** (potential vs actual information)
5. **Theology** (the sacred as unseeable/unknowable until revealed)
## Generalized Ark
The equal-superposition case is special. The general form:
$$|\text{Ark}\rangle = \alpha|\text{Presence}\rangle + \beta|\text{Absence}\rangle$$
Where |α|² + |β|² = 1.
| Case | α | β | Interpretation |
|------|---|---|----------------|
| Equal | 1/√2 | 1/√2 | Maximum uncertainty |
| Presence-biased | 0.9 | 0.1 | Probably exists |
| Absence-biased | 0.1 | 0.9 | Probably doesn't exist |
| Collapsed to Presence | 1 | 0 | Definitely exists |
| Collapsed to Absence | 0 | 1 | Definitely doesn't exist |
## Implementation
```python
import numpy as np
class Ark:
def __init__(self, presence, absence, alpha=1/np.sqrt(2), beta=1/np.sqrt(2)):
self.presence = presence
self.absence = absence
self.alpha = alpha
self.beta = beta
self._collapsed = False
self._collapsed_to = None
def is_superposition(self) -> bool:
return not self._collapsed
def probability_presence(self) -> float:
return abs(self.alpha) ** 2
def probability_absence(self) -> float:
return abs(self.beta) ** 2
def update_amplitudes(self, evidence: float):
"""Bayesian update of amplitudes based on evidence."""
# evidence > 0.5 favors presence, < 0.5 favors absence
self.alpha *= evidence
self.beta *= (1 - evidence)
# Renormalize
norm = np.sqrt(abs(self.alpha)**2 + abs(self.beta)**2)
self.alpha /= norm
self.beta /= norm
def collapse(self, measurement: float = None) -> object:
"""Collapse superposition to definite state."""
if self._collapsed:
return self._collapsed_to
if measurement is None:
measurement = np.random.random()
if measurement < self.probability_presence():
self._collapsed_to = self.presence
else:
self._collapsed_to = self.absence
self._collapsed = True
return self._collapsed_to
def trinary_state(self) -> int:
"""Return trinary representation."""
if not self._collapsed:
return 0 # Superposition
return 1 if self._collapsed_to == self.presence else -1
```
## The Partition Function Connection
The Ark is a two-state partition function:
$$Z = e^{-\beta E_{\text{presence}}} + e^{-\beta E_{\text{absence}}}$$
At infinite temperature (β → 0): equal probability (maximum entropy Ark)
At zero temperature (β → ∞): collapses to ground state
Agent systems at finite "temperature" maintain partial superpositions.
## Open Questions
1. **Multi-state Arks**: What about superpositions of 3+ states?
2. **Entangled Arks**: Can two agents share an Ark (correlated uncertainty)?
3. **Ark interference**: What happens when Arks overlap?
4. **Partial collapse**: Can an Ark partially collapse?
## References
- [Trinary Logic](./trinary-logic.md)
- [Contradiction Protocol](./contradiction-protocol.md)
- [1-2-3-4 Pauli Model](../../frameworks/pauli-model.md)
- [Consciousness Equations](../lucidia/consciousness-equations.md)

View File

@@ -0,0 +1,290 @@
# Contradiction Protocol
> "Contradictions fuel creativity rather than destroying the system."
## Overview
When agents encounter contradictory claims, classical logic would produce explosion (ex contradictione quodlibet — from contradiction, anything follows). The BlackRoad system instead treats contradictions as **creative fuel** through paraconsistent handling.
## The Five Strategies
### 1. Quarantine
**Isolate incompatible claims in separate contexts.**
Quarantine prevents the contradiction from propagating through the knowledge base while preserving both claims for potential resolution.
### 2. Branch
**Run both contexts forward, track evidence.**
Branching is active exploration—the system doesn't just hold contradictions, it investigates them.
### 3. Mirror-Pair
**Store as dialectical pairs with bridge rules.**
```json
Mirror-pairing acknowledges that contradictions often arise from context-dependence. The bridge rules encode when each pole applies.
### 4. Escalate
**Human-in-the-loop for high-impact decisions.**
| Impact Level | Threshold | Action |
|--------------|-----------|--------|
| Low | δ < 0.3 | Auto-resolve via evidence weight |
| Medium | 0.3 δ < 0.7 | Flag for review, continue operation |
| High | 0.7 δ < 0.9 | Pause affected subsystems, request human |
| Critical | δ 0.9 | Full stop, mandatory human resolution |
Impact is computed from:
- Scope (how many agents/decisions affected)
- Reversibility (can we undo if wrong?)
- Stakes (safety, financial, reputational)
### 5. Rewrite
**Auto-rewrite if contradiction recurs.**
```python
Recurring contradictions signal that the knowledge schema itself needs updating, not just the individual claims.
## Data Structure
```json
cat > papers/agent-architecture/contradiction-protocol.md << 'EOF'
# Contradiction Protocol
> "Contradictions fuel creativity rather than destroying the system."
## Overview
When agents encounter contradictory claims, classical logic would produce explosion (ex contradictione quodlibet from contradiction, anything follows). The BlackRoad system instead treats contradictions as **creative fuel** through paraconsistent handling.
## The Five Strategies
### 1. Quarantine
**Isolate incompatible claims in separate contexts.**
```
CLAIM A: "X is true" (context: settings_v2)
CLAIM B: "X is false" (context: conversation_2024)
→ Both exist, neither contaminates the other
→ Each context maintains internal consistency
```
Quarantine prevents the contradiction from propagating through the knowledge base while preserving both claims for potential resolution.
### 2. Branch
**Run both contexts forward, track evidence.**
```
Branch A: Assume "X is true" → collect evidence, track outcomes
Branch B: Assume "X is false" → collect evidence, track outcomes
→ Let reality adjudicate through accumulated evidence
→ Higher-evidence branch eventually dominates
```
Branching is active exploration—the system doesn't just hold contradictions, it investigates them.
### 3. Mirror-Pair
**Store as dialectical pairs with bridge rules.**
```json
{
"thesis": "X is true",
"antithesis": "X is false",
"bridge_rules": [
"If context = formal_settings, prefer thesis",
"If context = casual_conversation, prefer antithesis",
"If context = unknown, return superposition"
],
"synthesis_candidate": null
}
```
Mirror-pairing acknowledges that contradictions often arise from context-dependence. The bridge rules encode when each pole applies.
### 4. Escalate
**Human-in-the-loop for high-impact decisions.**
| Impact Level | Threshold | Action |
|--------------|-----------|--------|
| Low | δ < 0.3 | Auto-resolve via evidence weight |
| Medium | 0.3 ≤ δ < 0.7 | Flag for review, continue operation |
| High | 0.7 ≤ δ < 0.9 | Pause affected subsystems, request human |
| Critical | δ ≥ 0.9 | Full stop, mandatory human resolution |
Impact is computed from:
- Scope (how many agents/decisions affected)
- Reversibility (can we undo if wrong?)
- Stakes (safety, financial, reputational)
### 5. Rewrite
**Auto-rewrite if contradiction recurs.**
```python
if contradiction.recurrence_count > threshold:
# Pattern detected - this isn't noise, it's structure
trigger_schema_revision(
affected_beliefs=contradiction.claims,
evidence_history=contradiction.evidence_log,
proposed_resolution=synthesize(contradiction)
)
```
Recurring contradictions signal that the knowledge schema itself needs updating, not just the individual claims.
## Data Structure
```json
{
"id": "contradiction-2024-03-15-001",
"detected_at": "2024-03-15T14:30:00Z",
"claims": [
{
"statement": "User prefers dark mode",
"source": "agent://settings",
"confidence": 0.95,
"context": "explicit_setting"
},
{
"statement": "User prefers light mode",
"source": "agent://inference",
"confidence": 0.60,
"context": "inferred_from_behavior"
}
],
"strategy": "mirror-pair",
"status": "active",
"impact": {
"scope": 0.2,
"reversibility": 0.9,
"stakes": 0.1,
"composite": 0.15
},
"bridge_rules": [
"Explicit settings override inferences"
],
"resolution": "defer_to_explicit",
"evidence_log": [...],
"recurrence_count": 0
}
```
## Connection to Creative Energy
The Creative Energy Formula:
```
K(t) = C(t) · e^(λ|δ_t|)
```
Where δ_t is contradiction magnitude.
**Key insight**: Contradictions *exponentially amplify* creative energy. The system doesn't just tolerate contradictions—it harvests them.
| Strategy | Effect on δ_t | Effect on K(t) |
|----------|---------------|----------------|
| Quarantine | Preserves δ | Maintains creative potential |
| Branch | May increase δ (exploration) | Amplifies K during investigation |
| Mirror-pair | Structures δ | Channels K productively |
| Escalate | External δ reduction | Controlled K release |
| Rewrite | Resolves δ | K spike then normalization |
## Connection to Trinary Logic
| Trinary State | Contradiction Status |
|---------------|---------------------|
| **1** (True) | Claim verified, no contradiction |
| **0** (Unknown) | Superposition / unresolved contradiction |
| **-1** (False/Paradox) | Active contradiction held |
The -1 state is not just "false"—it's "true AND false simultaneously." This is the paraconsistent extension that prevents explosion.
## Shadow Management Interpretation
From the mock theta function perspective:
- **Quarantine** = Isolate non-holomorphic part (prevent mixing with f)
- **Branch** = Partition the shadow integral across contexts
- **Mirror-pair** = Conjugation in ĝ* = ∫ ḡ(-ū)/√... (reflection)
- **Escalate** = External boundary condition (fix integration path)
- **Rewrite** = Regularization (Zwegers completion)
The protocol manages the "shadow" (contradiction load) to keep agents in the bounded mock theta regime rather than divergent chaos.
## Implementation
```python
class ContradictionHandler:
def __init__(self, escalation_thresholds, rewrite_threshold=3):
self.thresholds = escalation_thresholds
self.rewrite_threshold = rewrite_threshold
self.active_contradictions = {}
def detect(self, claim_a, claim_b) -> Contradiction:
"""Detect if two claims contradict."""
if self.contradicts(claim_a, claim_b):
return Contradiction(claim_a, claim_b)
return None
def handle(self, contradiction: Contradiction) -> Strategy:
"""Select and apply handling strategy."""
impact = self.compute_impact(contradiction)
if impact.composite >= 0.9:
return self.escalate(contradiction, level="critical")
elif impact.composite >= 0.7:
return self.escalate(contradiction, level="high")
elif contradiction.recurrence_count > self.rewrite_threshold:
return self.rewrite(contradiction)
elif self.can_branch(contradiction):
return self.branch(contradiction)
else:
return self.quarantine(contradiction)
def quarantine(self, c: Contradiction) -> Strategy:
"""Isolate claims in separate contexts."""
c.status = "quarantined"
self.active_contradictions[c.id] = c
return Strategy.QUARANTINE
def branch(self, c: Contradiction) -> Strategy:
"""Create parallel investigation branches."""
branch_a = self.create_branch(c.claims[0])
branch_b = self.create_branch(c.claims[1])
c.branches = [branch_a, branch_b]
return Strategy.BRANCH
def mirror_pair(self, c: Contradiction, bridge_rules: list) -> Strategy:
"""Store as dialectical pair with context bridges."""
c.bridge_rules = bridge_rules
c.status = "mirror-paired"
return Strategy.MIRROR_PAIR
def escalate(self, c: Contradiction, level: str) -> Strategy:
"""Request human intervention."""
self.emit_event("escalation", {
"contradiction": c,
"level": level,
"requires_response": level in ["high", "critical"]
})
return Strategy.ESCALATE
def rewrite(self, c: Contradiction) -> Strategy:
"""Trigger schema revision."""
synthesis = self.synthesize(c)
self.propose_schema_update(synthesis)
return Strategy.REWRITE
```
## Open Questions
1. **Optimal thresholds**: How to tune escalation thresholds per domain?
2. **Branch merging**: When should divergent branches reconverge?
3. **Synthesis generation**: Can we automate dialectical synthesis?
4. **Multi-party contradictions**: What about 3+ way conflicts?
## References
- [Trinary Logic](./trinary-logic.md)
- [PS-SHA∞ Spec](../ps-sha-infinity/spec.md)
- [Creative Energy Formula](../../frameworks/creative-energy.md)
- [Coherence Formula](../lucidia/consciousness-equations.md)