ReductionBounds.ProtocolConditions (ReductionBounds v0.1.0)

Copy Markdown View Source

Explicit size and event-count conditions for supplied protocol traces.

Rules are indexed by the state before an event and its name. Every allowed transition needs a rule, including an empty rule for events without data. Required data bounds have independent finite byte and structural bounds. Integer conditions reuse ReductionBounds.IntegerSize and require a known magnitude bound. No encoding relationship or response-size bound is inferred from request data. Counts limit total occurrences over the entire trace, including repeated inspections and events after new arrivals.

check_trace/3 checks one supplied trace and returns the conditions used. The conditions remain assumptions for subsequent all-trace analysis; they are not inferred loop bounds, a cost bound, or a completion guarantee. Data summaries and integer values must describe the associated target data. That association is not proved by these model-level checks.

Summary

Types

t()

@type t() :: %ReductionBounds.ProtocolConditions{
  contract: ReductionBounds.Protocol.Contract.t(),
  count_bounds: %{required(atom()) => non_neg_integer()},
  data_bounds: %{required(atom()) => ReductionBounds.ProtocolSize.t()},
  integer_bounds: %{required(atom()) => ReductionBounds.IntegerSize.t()},
  rules: %{
    required({atom(), atom()}) => ReductionBounds.ProtocolConditions.Rule.t()
  }
}

Functions

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

@spec check_trace(t(), [ReductionBounds.Protocol.Event.t()], map()) ::
  {:ok, map()} | {:error, term()}

new(contract, options)

@spec new(ReductionBounds.Protocol.Contract.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

observe(data, integers \\ %{})

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

Measures supplied iodata fields and retains independent integer values.

validate(profile)

@spec validate(term()) :: :ok | {:error, term()}