ExGAM.Kernel.Recognition (ExGAM v0.1.0)

Copy Markdown View Source

Pure recognition of typed Evidence against typed Conditions.

Recognition answers only whether facts satisfy declared conditions. It never resolves a Mandate, grants authority or performs I/O. Durable maps are decoded before entering this module; consequently this algebra has one record shape and cannot assign different meaning to atom- and string-keyed representations of the same supposed fact.

Proposition, bindings, coverage and parameters remain portable opaque values chosen by the application. Reserved recognition parameters use string keys: "issuer_refs", "source_refs", "required_labels" and "accepted_assumptions".

A missing, stale, insufficient or provisional proof is :undecidable. Explicit contrary Evidence is :unsatisfied; conflicting support and contradiction remains :undecidable rather than being resolved by order.

Summary

Functions

Checks every condition against Evidence available at trusted time.

Checks one Condition and returns a stable local explanation.

Checks conditions and returns the exact qualified Evidence basis.

Checks that every Evidence reference used by Recognition was declared by the Candidate.

Types

reason()

@type reason() :: term()

result()

@type result() :: :satisfied | {:unsatisfied, [reason()]} | {:undecidable, [reason()]}

Functions

check(conditions, evidence, time)

@spec check(
  [ExGAM.Condition.t()] | nil,
  [ExGAM.Evidence.t()] | map() | nil,
  integer()
) :: result()

Checks every condition against Evidence available at trusted time.

check_condition(condition, evidence, time)

@spec check_condition(ExGAM.Condition.t(), [ExGAM.Evidence.t()] | map(), integer()) ::
  :satisfied | {:unsatisfied, reason()} | {:undecidable, reason()}

Checks one Condition and returns a stable local explanation.

check_with_basis(conditions, evidence, time)

@spec check_with_basis(
  [ExGAM.Condition.t()] | nil,
  [ExGAM.Evidence.t()] | map() | nil,
  integer()
) ::
  {result(), [String.t()]}

Checks conditions and returns the exact qualified Evidence basis.

The basis contains every current supporting or contradicting record that can affect the result, plus qualified records used to establish assumptions. This lets admission freeze the complete factual basis into its Act.

validate_declared_basis(required_refs, declared_refs)

@spec validate_declared_basis([String.t()], [String.t()]) :: :ok | {:error, term()}

Checks that every Evidence reference used by Recognition was declared by the Candidate.