package orgeat

  1. Overview
  2. Docs

Module Combi.MakeSource

Parameters

module K : Scalar.S

Signature

Sourcemodule Boltzmann : sig ... end

Tree representation of the definition of a combinatorial class

Note: the functions in Map should be bijections whenever possible. Not doing so is not a problem in itself, but we can predict what will happen:

  • without injectivity, some elements will have a greater probability of occurence;
  • without surjectivity, the sampling will not be exhaustive. Please keep this notion in mind when manually creating class_trees.
Sourcetype sequence_kind = {
  1. min : int;
  2. max : int option;
}
Sourceval unbounded_seq : sequence_kind
Sourceval bounded_seq : int -> int option -> sequence_kind
Sourcetype _ class_tree =
  1. | One : unit class_tree
  2. | Scalar : K.t -> unit class_tree
  3. | Z : unit class_tree
  4. | Empty : 'a class_tree
  5. | Sampler : 'a Sampler.t -> 'a class_tree
  6. | Class : 'a combi_class -> 'a class_tree
  7. | Union : 'a class_tree list -> 'a class_tree
  8. | Product : 'a class_tree * 'b class_tree -> ('a * 'b) class_tree
  9. | Sequence : sequence_kind * 'a class_tree -> 'a list class_tree
  10. | Map : 'a class_tree * ('a -> 'b) -> 'b class_tree
Sourceand 'a solved_tree =
  1. | T : (K.t * 'a stub) -> 'a solved_tree
Sourceand 'a stub =
  1. | S_One : unit stub
  2. | S_Z : unit stub
  3. | S_Sampler : 'a Sampler.t -> 'a stub
  4. | S_Empty : 'a stub
  5. | S_Class : 'a combi_class -> 'a stub
  6. | S_Union : 'a solved_tree list -> 'a stub
  7. | S_Product : 'a solved_tree * 'b solved_tree -> ('a * 'b) stub
  8. | S_Sequence : sequence_kind * 'a solved_tree -> 'a list stub
  9. | S_Map : 'a solved_tree * ('a -> 'b) -> 'b stub
Sourceand 'a combi_class = {
  1. name : Literal.Class.t;
  2. mutable class_tree : 'a class_tree option;
  3. mutable solved_tree : 'a solved_tree option;
}

Reference to a class_tree with a name. Allows for mutual recursion.

Sourceval get_name : 'a combi_class -> Literal.Class.t
Sourceval get_class : 'a combi_class -> 'a class_tree option
Sourceval get_solved : 'a combi_class -> 'a solved_tree option
Sourceval new_class : Literal.Class.t -> 'a combi_class
Sourceval new_class_of_str : string -> 'a combi_class
Sourceval reset_class : 'a combi_class -> unit
Sourceval update_class : 'a combi_class -> 'a class_tree -> unit
Sourceval reset_solved : 'a combi_class -> unit
Sourceval update_solved : 'a combi_class -> 'a solved_tree -> unit
Sourceval tup2 : 'a class_tree -> 'b class_tree -> ('a * 'b) class_tree

tupn generates a t class_tree where t is a tuple of size n Useful before a Map to build records.

Sourceval tup3 : 'a class_tree -> 'b class_tree -> 'c class_tree -> ('a * 'b * 'c) class_tree
Sourceval tup4 : 'a class_tree -> 'b class_tree -> 'c class_tree -> 'd class_tree -> ('a * 'b * 'c * 'd) class_tree
Sourceval tup5 : 'a class_tree -> 'b class_tree -> 'c class_tree -> 'd class_tree -> 'e class_tree -> ('a * 'b * 'c * 'd * 'e) class_tree
Sourceval mul_scalar : K.t -> 'a class_tree -> 'a class_tree

mul_scalar k t multiplies the given tree t with a weight k. Used to skew the distribution without changing the generated objects.

Sourceval (+) : 'a class_tree -> 'a class_tree -> 'a class_tree
Sourceval (*) : 'a class_tree -> 'b class_tree -> ('a * 'b) class_tree
Sourceval z : 'a class_tree -> 'a class_tree
Sourceval seq : 'a class_tree -> 'a list class_tree
Sourceval seq_bounded : min:int -> ?max:int -> 'a class_tree -> 'a list class_tree
Sourceval option : 'a class_tree -> 'a option class_tree
Sourceval stub_node_to_string : 'a. 'a stub -> string
Sourceval solved_node_to_string : 'a. 'a solved_tree -> string
Sourceval solved_to_strings : 'a. 'a solved_tree -> string list
Sourceval pp_solved_tree : Format.formatter -> 'a solved_tree -> unit
OCaml

Innovation. Community. Security.