agentsclimarketplace

Ai causal deontic

Skill r-irbe/proof-skills/skills/ai-causal-deontic

APM-installable agent skills for Lean 4 and Mathlib4 — proof tactics, math domains, review and research workflows, generic tooling.

Install
npx -y skills add r-irbe/proof-skills --skill ai-causal-deontic

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

USE FOR: Causal reasoning, counterfactual analysis, and deontic logic for AI systems. Use for formalizing cause-effect relationships (Pearl's hierarchy), interventional reasoning, structural causal models, counterfactual simulation, obligation/permission/prohibition reasoning, normative systems, and legal/ethical rule formalization in Lean 4. DO NOT USE FOR: formalising those models in Lean (use @lean-causal-reasoning); agentic AI behaviour (use @ai-agentic-evolving); commonsense reasoning (use @ai-commonsense-reasoning). TRIGGERS: causal, counterfactual, Pearl hierarchy, deontic, obligation, permission, structural causal model.

SKILL.md

10.3 KB, as published. Nobody here has run it

Causal Reasoning & Deontic Logic

Formal frameworks for reasoning about causes, effects, counterfactuals, and normative obligations.


Routing

  • USE FOR: Causal reasoning, counterfactual analysis, and deontic logic for AI systems. Use for formalizing cause-effect relationships (Pearl's hierarchy), interventional reasoning, structural causal models, counterfactual simulation, obligation/permission/prohibition reasoning, normative systems, and legal/ethical rule formalization in Lean 4.
  • DO NOT USE FOR: formalising those models in Lean (use @lean-causal-reasoning); agentic AI behaviour (use @ai-agentic-evolving); commonsense reasoning (use @ai-commonsense-reasoning).
  • TRIGGERS: causal, counterfactual, Pearl hierarchy, deontic, obligation, permission, structural causal model.

Workflow

  1. Classify the question: causal-effect identification, counterfactual evaluation, deontic-norm modelling, or legal-deontic encoding.
  2. Pick the matching framework from the body (Pearl's do-calculus, structural causal model, standard deontic logic, dyadic deontic logic).
  3. Apply the framework to the concrete scenario; document identifiability conditions and norm interactions.
  4. Hand off: to @lean-causal-reasoning for Lean encoding, to @applied-legal-reasoning for legal-policy mapping, to @lean-zettelkasten.

Recovery & STOP

  • STOP if the question is about Lean formalisation — delegate to @lean-causal-reasoning.
  • STOP if the question is purely legal (not deontic-logic) — delegate to @applied-legal-reasoning.
  • STOP if a causal-effect identifiability claim cannot be established from the body — escalate to @research-council.

Handoffs

  • Predecessors: agent:gateway, skill:lean-research.
  • Successors: skill:lean-causal-reasoning, skill:lean-knowledge-formalization, skill:lean-zettelkasten.

Part 1 — Pearl's Causal Hierarchy

1.1 Three Levels of Causal Reasoning

LevelNameTypical QueryOperatorFormalization
1Association$P(y \mid x)$ConditioningStandard probability
2Intervention$P(y \mid do(x))$do-calculusTruncated factorization
3Counterfactual$P(y_x \mid x', y')$Structural equationsTwin network / abduction

1.2 Structural Causal Models (SCM)

An SCM $\mathcal{M} = \langle U, V, F, P(U) \rangle$ where:

  • $U$: Exogenous (background) variables
  • $V$: Endogenous variables
  • $F$: Structural equations $V_i = f_i(\text{pa}_i, U_i)$
  • $P(U)$: Distribution over exogenous variables

Lean formalization pattern:

structure CausalModel where
  vars : Type
  exogenous : Type
  structural : vars → (vars → Prop) → exogenous → Prop
  acyclicity : WellFounded (influences structural)

1.3 do-Calculus

Three rules for identifying causal effects from observational data:

RuleDescriptionCondition
Rule 1 (Insertion/deletion of observations)$P(y \mid do(x), z, w) = P(y \mid do(x), w)$$(Y \perp!!!\perp Z \mid X, W){G{\overline{X}}}$
Rule 2 (Action/observation exchange)$P(y \mid do(x), do(z), w) = P(y \mid do(x), z, w)$$(Y \perp!!!\perp Z \mid X, W){G{\overline{X}\underline{Z}}}$
Rule 3 (Insertion/deletion of actions)$P(y \mid do(x), do(z), w) = P(y \mid do(x), w)$$(Y \perp!!!\perp Z \mid X, W){G{\overline{X}\overline{Z(W)}}}$

1.4 Identifiability Criteria

CriterionDescriptionApplicability
Back-doorAdjust for confounders blocking back-door pathsCommon, simple
Front-doorMediate through intermediate variableWhen no valid adjustment set
Instrumental variableExploit exogenous variationEconometrics, natural experiments
General ID algorithmComplete identification algorithmAny semi-Markovian model

Part 2 — Counterfactual Reasoning

2.1 Counterfactual Computation (3 Steps)

  1. Abduction: Given evidence, infer $P(U \mid \text{evidence})$
  2. Action: Modify structural equations (intervention)
  3. Prediction: Compute outcome under modified model

2.2 Potential Outcomes Framework

  • Rubin causal model: $Y_i(1), Y_i(0)$ — potential outcomes under treatment/control
  • ATE: $\mathbb{E}[Y(1) - Y(0)]$ — average treatment effect
  • CATE: $\mathbb{E}[Y(1) - Y(0) \mid X = x]$ — conditional on covariates
  • Pipeline mapping: phase transitions as "treatment" effects on quality or safety outcomes

2.3 Counterfactual Stability

When is a counterfactual claim robust?

  • Monotonicity: Outcome monotonic in treatment
  • Counterfactual stability: Small perturbations in $U$ → small perturbations in counterfactual outcome
  • Pipeline example: phase transitions can exhibit threshold or bifurcation-like counterfactual behavior (sudden jumps)

Part 3 — Causal Discovery

3.1 Methods

MethodTypeAssumptionsOutput
PC algorithmConstraint-basedFaithfulness, no latent confoundersCPDAG
FCIConstraint-basedAllows latent confoundersPAG
GESScore-basedBIC score, decomposableCPDAG
NOTEARSContinuous optimizationAcyclicity constraintDAG
Causal transformersDeep learningLarge observational dataDAG

3.2 Causal Graphs in a Verification Pipeline

Example causal DAG:
  Stakeholder → Requirements → Phase classification
  Phase classification → Quality thresholds → Gate decisions
  Gate decisions → Knowledge state → Phase transitions
  Phase transitions → System trajectory → Final quality

Part 4 — Deontic Logic

4.1 Standard Deontic Logic (SDL)

OperatorSymbolReadingFormal
Obligation$O(p)$"It ought to be that $p$"$O(p) \equiv \neg P(\neg p)$
Permission$P(p)$"It is permitted that $p$"$P(p) \equiv \neg O(\neg p)$
Prohibition$F(p)$"It is forbidden that $p$"$F(p) \equiv O(\neg p)$

4.2 Paradoxes and Extensions

ParadoxDescriptionResolution
Ross's paradox$O(p) \to O(p \lor q)$ — obliged to mail → obliged to mail or burnInput/output logic
Contrary-to-dutyWhat obligations apply when one is violated?Defeasible deontic logic
Free choice$P(p \lor q)$ doesn't entail $P(p) \land P(q)$Bilateral norms
ChisholmNested conditional obligations conflictDyadic deontic logic

4.3 Deontic Logic for AI Governance

Governance RuleDeontic Formalization
Gate must be passed before advancement$O(\text{pass}(g_i) \to \text{before}(\text{phase}_{i+1}))$
Safety envelope must be maintained$F(\text{violate}(\text{safety_envelope}))$
Trust must converge$O(\text{eventually}(\text{converged}(\tau)))$
Provenance must be recorded$O(\text{record}(\text{provenance}(a)))$ for all actions $a$

4.4 Input/Output Logic (Makinson & van der Torre)

Input/Output pairs: (a, x) meaning "given input a, output x"
Four operators: out_1 (simple), out_2 (+SI), out_3 (+CT), out_4 (+SI+CT)
Permission: negative (not forbidden) vs positive (explicitly permitted)

Common application: quality gates as I/O norms mapping observation states to action obligations.


Part 5 — Normative Multi-Agent Systems

5.1 Norm Types

Norm TypeExample in a verification pipeline
Regulative"Agents SHALL pass quality gate"
Constitutive"Meeting threshold counts as passing"
Procedural"Review must precede approval"
Institutional"Council member has assessment authority"

5.2 Norm Compliance

  • Regimented: System physically prevents violations (hard constraints)
  • Regulated: System detects and sanctions violations (soft constraints with enforcement)
  • Example: quality gates can be regimented while trust scores or review confidence are regulated

5.3 Norm Conflict Resolution

StrategyDescriptionCommon approach
Priority orderingHigher-priority norm winsSafety > quality > efficiency
SpecificityMore specific norm overrides generalPhase-specific thresholds override defaults
TemporalLater norm supersedes earlierRETRO audit can update gates

Part 6 — Host-Repository Lean Extension Points

Do not assume repository-local Lean modules, tactics, or namespaces exist unless the host repository explicitly provides them. When local modules exist, map them by role:

Local extension pointCausal/deontic aspect
Provenance / audit trail modulecausal DAG of evidence, intervention tracking
Quality-gate moduledeontic obligations and gate-passage requirements
Safety modulesafety obligations and prohibited envelope violations
Classification modulecausal model of classification → gate → transition
Tactic-helper modulereasoning automation for causal/deontic proofs
Dynamics modulecausal dynamics of phase transitions

Part 7 — Epistemic Mapping

KKKUUU
SCM theory well-establishedFull do-calculus in Lean 4Causal reasoning under deep uncertainty
SDL axiomatizedI/O logic Lean formalizationEmergent norms in multi-agent systems
Back-door criterion provenAutomated causal discovery verificationCounterfactual stability for chaotic systems
Pipeline causal DAG identifiedGAI causal reasoning regulationEthical AI as deontic system

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.