# `ReductionBounds.ProtocolConditions`
[🔗](https://github.com/zacky1972/reduction_bounds/blob/v0.1.0/lib/reduction_bounds/protocol_conditions.ex#L1)

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.

# `t`

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

# `check_trace`

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

# `new`

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

# `observe`

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

Measures supplied iodata fields and retains independent integer values.

# `validate`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
