# `ShotUn.Trace`
[🔗](https://github.com/jcschuster/ShotUn/blob/v0.2.1/lib/shot_un/trace.ex#L40)

Decision-tree trace produced by `ShotUn.unify/3`, `ShotUn.match/2` and
`ShotUn.pattern_unify/2` when invoked with `vis: true`. Each node
records the rule applied, the resulting work-list, the accumulated
substitutions and the deferred flex-flex pairs (pre-formatted as
strings). Render the tree with `ShotUn.Trace.Mermaid.render/2`.

The traces returned by the public entry points are pre-pruned to the
paths from the root to a `:solution` leaf — failed branches and
dead-end intermediate steps are dropped. Use `prune_to_solutions/1`
directly if you have an unpruned trace from a lower-level call.

# `algorithm`

```elixir
@type algorithm() :: :pre_unification | :matching | :pattern
```

# `t`

```elixir
@type t() :: %ShotUn.Trace{algorithm: algorithm(), root: ShotUn.Trace.Node.t() | nil}
```

# `prune_to_solutions`

```elixir
@spec prune_to_solutions(t()) :: t()
```

Returns a trace that retains only the nodes lying on a path from the
root to a `:solution` leaf. The root node is always preserved (even if
no solution was reached) so the diagram still shows the initial state.

---

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