Search documentation of ash

# Ash.SatSolver (ash v3.4.71)

View Source

Tools for working with the satsolver that drives filter subset checking (for authorization)

This is public as a very low level toolkit for writing authorizers, but you almost certainly do not need to look at this module.

If you are looking for information about how authorization works, see the policy guide

# Summary

## Functions

b(statement)

Creates tuples of a boolean statement.

left_excludes_right(left, right)

Returns `b(not (left and right))`

left_implies_right(left, right)

Returns `b(not (left and not right))`

mutually_exclusive(predicates, acc \\ [])

Returns a statement expressing that the predicates are mutually exclusive.

mutually_exclusive_and_collectively_exhaustive(predicates)

Returns a statement expressing that the predicates are mutually exclusive and collectively exhaustive.

mutually_inclusive(predicates, acc \\ [])

Returns a statement expressing that the predicates are mutually inclusive

right_excludes_left(left, right)

Returns `b(not (right and left))`

right_implies_left(left, right)

Returns `b(not (right and not left))`

strict_filter_subset(filter, candidate)

Returns true if the candidate filter returns the same or less data than the filter

synonymous_relationship_paths?(left_resource, candidate, search, right_resource \\ nil)

Returns `true` if the relationship paths are synonymous from a data perspective

to_cnf(expression)

Transforms a statement to Conjunctive Normal Form(CNF), as lists of lists of integers.

transform(resource, expression)

Prepares a filter for comparison

transform_and_solve(resource, expression)

Calls `transform/2` and solves the expression

# Functions

# b(statement)

(macro)

Creates tuples of a boolean statement.

i.e `b(1 and 2) #=> {:and, 1, 2}`

# left_excludes_right(left, right)

    @spec left_excludes_right(Ash.Expr.t(), Ash.Expr.t()) :: boolean_expr()

Returns `b(not (left and right))`

# left_implies_right(left, right)

Returns `b(not (left and not right))`

# mutually_exclusive(predicates, acc \\ [])

Returns a statement expressing that the predicates are mutually exclusive.

# mutually_exclusive_and_collectively_exhaustive(predicates)

    @spec mutually_exclusive_and_collectively_exhaustive([Ash.Expr.t()]) :: boolean_expr()

Returns a statement expressing that the predicates are mutually exclusive and collectively exhaustive.

# mutually_inclusive(predicates, acc \\ [])

Returns a statement expressing that the predicates are mutually inclusive

# right_excludes_left(left, right)

    @spec right_excludes_left(Ash.Expr.t(), Ash.Expr.t()) :: boolean_expr()

Returns `b(not (right and left))`

# right_implies_left(left, right)

    @spec right_implies_left(Ash.Expr.t(), Ash.Expr.t()) :: boolean_expr()

Returns `b(not (right and not left))`

# strict_filter_subset(filter, candidate)

    @spec strict_filter_subset(Ash.Filter.t(), Ash.Filter.t()) :: boolean() | :maybe

Returns true if the candidate filter returns the same or less data than the filter

# synonymous_relationship_paths?(left_resource, candidate, search, right_resource \\ nil)

    @spec synonymous_relationship_paths?(
      Ash.Resource.t(),
      [atom()],
      [atom()],
      Ash.Resource.t()
    ) ::
      boolean()

Returns `true` if the relationship paths are synonymous from a data perspective

# to_cnf(expression)

Transforms a statement to Conjunctive Normal Form(CNF), as lists of lists of integers.

# transform(resource, expression)

    @spec transform(Ash.Resource.t(), Ash.Expr.t()) :: boolean_expr()

Prepares a filter for comparison

# transform_and_solve(resource, expression)

    @spec transform_and_solve(Ash.Resource.t(), Ash.Expr.t()) ::
      {:ok, [integer()]} | {:error, :unsatisfiable}

Calls `transform/2` and solves the expression