ExMaude. AI. Encoder
(ExMaude v0.2.0)
View Source
Encodes Elixir AI rule structures into Maude syntax compatible with
the bundled ai-rules.maude module.
Companion to ExMaude.IoT.Encoder. Where the IoT encoder handles
Things, Properties, and Actions, this encoder handles Agents,
Capabilities, ToolInvocations, and richer predicates (capability,
budget, jurisdiction, authority).
Type mapping
| Elixir term | Maude syntax |
|---|---|
{"acme", "ag-1"} (agent id) | agent(tenant("acme"), "ag-1") |
{:str, "x"} | strVal("x") |
{:int, 42} | intVal("42") |
{:bool, true} | boolVal(true) |
{:interval, lo, hi} | intervalVal(lo, hi) |
{:jurisdiction, :eu} | jurisdictionVal(eu) |
{:cap, "web_search", "shape_v1"} | cap("web_search", "shape_v1") |
{:invoke_tool, name, args, cap_required, jurisdiction} | invokeTool(tool("name"), argMap, "cap", eu) |
{:require_approval, class} | requireApproval("class") |
Predicate mapping
| Elixir | Maude |
|---|---|
{:prop_eq, key, val} | propEq("key", val) |
{:capability_required, name} | capabilityRequired("name") |
{:capability_granted, name} | capabilityGranted("name") |
{:budget_within, scope, interval} | budgetWithin("scope", intervalVal(...)) |
{:authority_at_least, n} | authorityAtLeast(n) |
{:jurisdiction_allowed, j} | jurisdictionAllowed(eu) |
{:latency_at_most, ms} | latencyAtMost(ms) |
{:always} | alwaysP |
{:and, p1, p2} | andP(p1, p2) |
{:or, p1, p2} | orP(p1, p2) |
{:not, p} | notP(p) |
Summary
Functions
Encodes a jurisdiction set into Maude syntax.
Encodes a single AI rule into Maude syntax.
Encodes a list of AI rules into Maude rule-set syntax.
Functions
Encodes a jurisdiction set into Maude syntax.
Used as the second argument to detectAllConflicts/2 and similar
facade operations.
@spec encode_rule(ExMaude.AI.ai_rule()) :: String.t()
Encodes a single AI rule into Maude syntax.
@spec encode_rules([ExMaude.AI.ai_rule()]) :: {:ok, String.t()}
Encodes a list of AI rules into Maude rule-set syntax.
Returns {:ok, maude_string} on success.