ReductionBounds.ProtocolCost (ReductionBounds v0.1.0)

Copy Markdown View Source

Symbolic participant budgets for finite protocol traces and their prefixes.

Each owned state/event context supplies a nonnegative expression and a counter that counts that context. Expressions accept natural constants, {:charge, name}, {:data, slot, :bytes | :structure}, {:integer, slot, :magnitude_bits}, and {:add | :mul | :max, left, right}. Size references must be required by the context's condition rule.

Contexts assigned to the same participant and counter share the maximum local budget. The participant budget adds these maxima multiplied by the corresponding count limits. Charge names are scoped to each participant. Participants without modeled work events receive no budget claim.

new/2 and check_trace/3 validate evidence in Elixir. Use the protocol cost proof builder and the packaged Lean sources to check the universal safety theorems (see the proof notes and proof test). No completion, source-code, runtime reduction, or elapsed-time guarantee follows from these symbolic budgets.

Summary

Functions

Evaluates a closed participant budget using that participant's natural charges.

Types

t()

@type t() :: %ReductionBounds.ProtocolCost{
  bounds: map(),
  conditions: ReductionBounds.ProtocolConditions.t(),
  groups: [map()],
  rules: map(),
  unmodeled_participants: [atom()]
}

Functions

check_trace(profile, events, observations \\ %{})

@spec check_trace(t(), list(), map()) :: {:ok, map()} | {:error, term()}

evaluate(expr, charges)

@spec evaluate(term(), map()) :: {:ok, non_neg_integer()} | {:error, term()}

Evaluates a closed participant budget using that participant's natural charges.

new(conditions, rules)

@spec new(ReductionBounds.ProtocolConditions.t(), map()) ::
  {:ok, t()} | {:error, term()}