Compute fixed points using Lattices
masterAscent supports computing fixed points of user-defined lattices using the lattice keyword. A lattice behaves like a relation, but when a new fact is discovered, the values in the final column are joined together using the Lattice trait implementation. This allows for computations like shortest paths.
Example using Dual<T> to find shortest paths (where Dual stores the minimum value):
ascent! {
lattice shortest_path(i32, i32, Dual<u32>);
relation edge(i32, i32, u32);
shortest_path(x, y, Dual(*w)) <-- edge(x, y, w);
shortest_path(x, z, Dual(w + l)) <--
edge(x, y, w),
shortest_path(y, z, ?Dual(l));
}