Trait adapton::engine::AbsMapFam
[−]
[src]
pub trait AbsMapFam<Arg, Abs, T, DiffT, S> { fn map(&self, arg: Arg, inp: T) -> S; fn abs(&self, arg: Arg) -> Abs; fn join(&self, fst: Abs, snd: Abs) -> Abs; fn diff(&self, fst: &T, snd: &T) -> DiffT; fn is_dirty(&self, diff: DiffT, abs: &Abs) -> bool; }
A family of mappings, with a notion of member subsets via abstract
mappings. These abstractions compress sequences of observations
into a single DCG force edge. See also: force_abs
.
Specifically, we abstract sets of edges when the source thunk and target cell are the same two nodes, and the same abstract mapping family is used throughout.
Each mapping family uses several type parameters in its definition:
- The family maps values of type
T
to values of typeS
- Each mapping in the family is identified by a distinct
Arg
value. - Each abstract mapping in the family is identified by a
distinct
Abs
value; thisAbs
value represents a set ofArg
values, and likewise, a set of mappings in the family. - The family represents (possibly abstracted) differences in
type
T
as values of typeDiffT
.
Based on these types, the family defines:
- mappings (
fn map
), - mapping abstraction (
fn abs
), - joins over abstract mappings (
fn join
), - differencing mapping inputs (
fn diff
), - and intersecting differenced inputs and abstracted mappings (
fn is_dirty
).
TODO: What conditions should hold for an implementation of AbsMap to be sound?
Required Methods
fn map(&self, arg: Arg, inp: T) -> S
using an Arg
, map a value of type T
into one of type S
fn abs(&self, arg: Arg) -> Abs
make a concrete mapping argument of type Arg
into an abstracted one of type Abs
fn join(&self, fst: Abs, snd: Abs) -> Abs
lattice join operation over two abstracted mappings (intersect fst
and snd
)
fn diff(&self, fst: &T, snd: &T) -> DiffT
represent the difference between two values of type T
, perhaps abstractly, as a value of type DiffT
.
fn is_dirty(&self, diff: DiffT, abs: &Abs) -> bool
intersect the difference in T
values (of type DiffT
) with the abstract mapping; return true if non-empty.