Request for Comments (RFC): Integrating First-Class Uncertainty into DeepCausality via Uncertain<T> Semantics #298
marvin-hansen
started this conversation in
Ideas
Replies: 1 comment
-
|
Proposed new crate for implementation of the core Uncertain Type. While there are 2 existing crates, none of them aligns with the core requirements of performance and flexibility i.e. replacable samplers. Progress is tracked in issue: #299 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Author: Marvin Hansen
Date: Fri, Aug. 29 2025
Status: Draft Proposal
Abstract
This RFC proposes a fundamental architectural enhancement to the Effect Propagation Process (EPP) reference implementation, DeepCausality: the integration of first-class uncertainty primitives inspired by the Microsoft Research paper,
Uncertain<T>and its implementation in Swift by Mattt.The current EPP is a deterministic meta-calculus that can encapsulate probabilistic logic (via
ΠProband Causaloids containing statistical models). This proposal shifts DeepCausality to a system where uncertainty is a native primitive, enabling causal reasoning over full probability distributions rather than single-point estimates.This integration provides the precise mathematical language and engineering ergonomics necessary to formalize high-confidence decision-making, transforming the Causal State Machine (CSM) and the Effect Ethos into verifiable, risk-aware policy engines. This capability shatters current limitations in computational causality regarding the management of cascading uncertainty and high-confidence inference.
1. Motivation: The Limit of Encapsulation
The core axiom of the EPP,$E_2 = f(E_1)$ , allows
fto be a probabilistic function, and thePropagatingEffecthas aΠProbvariant. However, two critical problems remain:if (effect > X)). This treats a 95% likelihood with high variance identically to a 95% likelihood with low variance, making critical decisions unnecessarily brittle and opaque.The
Uncertain<T>concept solves these problems elegantly by making the distribution the fundamental value. The fact that the entire Swift implementation is compact (approx. 1,600 lines) and relies on standard functional programming concepts proves this is a high-leverage, low-friction integration.2. Proposal: Integration of
Uncertain<T>SemanticsWe propose modifying DeepCausality’s core primitives to adopt
Uncertain<T>semantics, specifically the sampling functions, lazy evaluation graph, and statistical conditional operators (Hypothesis Testing).2.1. Core Type Modification: The PropagatingEffect (
ΠE)The current
ΠProbvariant should be generalized to carry a full distribution type.Proposed Change to
ΠE:ΠProb = {Probabilistic(p) | p ∈ [0, 1]}ΠUncertain<T>: A type that wraps the distribution for a given payload typeT.PropagatingEffectwill now carry a complete description of the probabilistic value, allowing downstream Causaloids to access the full distribution (mean, variance, mode, etc.).2.2. Contextual Fabric Modification (
C)Contextoidpayloads should natively support the new uncertain type.Proposed Change to
Contextoid Payload:payloadvunion to optionally wrap its components in theUncertain<T>semantic, especially forDatoid,Tempoid, andSpaceoid.Uncertain<GeoCoordinate>that encapsulates the Rayleigh/Normal distribution model for GPS error, as detailed in the source code review.2.3. Causaloid Functionality (
fχ)The core Causaloid function must seamlessly operate on these new uncertain types.
Proposed Change to Causaloid Logic:
Uncertain<T>operator overloading (+,*,/,&&,||,>) logic into Rust. This is critical for engineers to continue writing simple logic (speed = dist / time) while the system handles the complex convolution/sampling required for distribution propagation.ΠEP P) must be updated to manage theSampleContext(the memoization map based on UUIDs). This ensures that if a single uncertain Contextoid (e.g., GPS reading) is referenced by multiple Causaloids in a single reasoning cycle, they all draw the same random sample, maintaining statistical consistency (a key feature ofUncertain<T>'s internal graph).3. Impact and Unprecedented Payoff
Integrating
Uncertain<T>realizes several promised EPP capabilities with unprecedented rigor:Uncertain<T>Behaviorif (P) is True).if P.probability(exceeds: α)).4. Implementation and Discussion
Proposed Immediate Next Steps (RFC Stage):
Uncertain<T>struct, operators, and the necessary underlying statistical distributions (Normal, Rayleigh) to Rust, ensuring seamless integration with existing DeepCausality structures (especially theContextoidgenerics).PropagatingEffectandCausalFnRefactoring: Define the newΠUncertain<T>type and update theCausalFntraits to accept and return these uncertain types.evaluateHypothesislogic into the CSM activation mechanism, making high-confidence conditional logic the standard for actionable intelligence.This is a critical architectural decision that requires consensus. The proposed change fundamentally elevates the EPP’s core capabilities from a relatively modest contribtuion to one of the most advanced computational framework for hybrid, contextual, dynamic, and verifiably safe causality.
5. Further Reading
nshipster
https://nshipster.com/uncertainty
https://github.com/mattt/Uncertain
microsoft research:
https://www.microsoft.com/en-us/research/publication/uncertaint-a-first-order-type-for-uncertain-data-2
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/asplos077-bornholtA.pdf
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/uncertaint-asplos-2014-slides.pdf
We invite feedback and discussion on this proposal.
Beta Was this translation helpful? Give feedback.
All reactions