Skip to main content

Module effect_system

Module effect_system 

Source
Expand description

Effect system for tracking computational effects in TensorLogic expressions.

This module provides an effect system that tracks various kinds of computational effects in logical expressions and tensor operations, enabling:

  • Effect tracking: Know which operations have side effects
  • Differentiability: Track which operations support gradient computation
  • Probabilistic reasoning: Distinguish deterministic from stochastic operations
  • Memory safety: Track memory access patterns
  • Effect polymorphism: Functions parametric over effects

§Examples

use tensorlogic_ir::effect_system::{Effect, EffectSet, ComputationalEffect};

// Pure computation (no side effects)
let pure_effect = EffectSet::pure();
assert!(pure_effect.is_pure());

// Differentiable operation
let diff_effect = EffectSet::new()
    .with(Effect::Computational(ComputationalEffect::Pure))
    .with(Effect::Differentiable);

// Combine effects
let combined = pure_effect.union(&diff_effect);
assert!(combined.contains(&Effect::Differentiable));

Structs§

EffectAnnotation
Effect annotation for expressions
EffectSet
Set of effects for an expression or operation.
EffectVar
Effect variable for effect polymorphism

Enums§

ComputationalEffect
Computational purity effects.
Effect
Individual effect kinds.
EffectScheme
Effect scheme for effect polymorphism (analogous to type schemes)
MemoryEffect
Memory access effects.
ProbabilisticEffect
Probabilistic effects.

Functions§

infer_operation_effects
Infer effects for common operations

Type Aliases§

EffectSubstitution
Substitution mapping effect variables to effect sets