cnocco/dependency

This file defines the functional dependencies that are necessary for the evaluation of canonical covers.

Types

The type that represents functional dependencies. Due to the long name of the actual term, the abbreviation Dependency is used.

In general, a Dependency has the form of “alpha -> beta”, where alpha and beta are sets of Ints.

The reason for this type being opaque is that an empty set for alpha is illegal.

pub opaque type Dependency

Values

pub fn alpha(dep: Dependency) -> set.Set(Int)

A getter for the alpha value.

pub fn beta(dep: Dependency) -> set.Set(Int)

A getter for the beta value.

pub fn delete_empty_all(
  deps: List(Dependency),
) -> List(Dependency)

Algorithm for deleting Dependencys with an empty beta when finding a canonical cover.

You can use this instead of the entire chain of algorithms if you want to only do a part.

pub fn left_reduce_all(
  deps: List(Dependency),
) -> List(Dependency)

Algorithm for the left reduction when finding a canonical cover.

You can use this instead of the entire chain of algorithms if you want to only do a part.

pub fn merge_all(deps: List(Dependency)) -> List(Dependency)

Algorithm for merging Dependencys with the same alpha when finding a canonical cover.

You can use this instead of the entire chain of algorithms if you want to only do a part.

pub fn merge_betas(betas: List(set.Set(Int))) -> set.Set(Int)
pub fn right_reduce_all(
  deps: List(Dependency),
) -> List(Dependency)

Algorithm for the right reduction when finding a canonical cover.

You can use this instead of the entire chain of algorithms if you want to only do a part.

pub fn to_list_tuple(dep: Dependency) -> #(List(Int), List(Int))

The reverse of try_from_list_tuple.

pub fn to_set_tuple(
  dep: Dependency,
) -> #(set.Set(Int), set.Set(Int))

The reverse of try_from_set_tuple.

pub fn to_string(dep: Dependency) -> String

Parses the Dependency to a nice human-readable String.

Examples:

let assert Ok(dep) = try_from_lists([1, 2], [3, 4])
to_string(dep)
// -> "{1, 2} -> {3, 4}"
pub fn try_from_list_tuple(
  tuple: #(List(Int), List(Int)),
) -> Result(Dependency, Nil)

The behavior is the exact same as try_from_lists.

pub fn try_from_lists(
  alpha: List(Int),
  beta: List(Int),
) -> Result(Dependency, Nil)

Tries to create a Dependency based on the alpha and beta value provided.

Examples:

try_from_lists([1], [2])
// -> Ok(Dependency)

try_from_lists([], [2])
// -> Error(Nil)
pub fn try_from_set_tuple(
  tuple: #(set.Set(Int), set.Set(Int)),
) -> Result(Dependency, Nil)

The behavior is the exact same as try_from_sets.

pub fn try_from_sets(
  alpha: set.Set(Int),
  beta: set.Set(Int),
) -> Result(Dependency, Nil)

Tries to create a Dependency based on the alpha and beta value provided.

Examples:

try_from_sets(set.from_list([1]), set.from_list([2]))
// -> Ok(Dependency)

try_from_sets(set.from_list([]), set.from_list([2]))
// -> Error(Nil)
Search Document