Module Evidence.Obs


This module provides a type to describe observations. Essentially an observation is an arbitrary OCaml type and its decomposition into variables which we represent by a variable product.

Using a variable product rather than a list of exisentials allows to construct observations from its variables. If for some reason you can't do that use Var.Prod.absurd, note that by doing so functions that need to construct observations like Dataset.Var.update will raise Invalid_argument.


type 'o t

The type for describing observations of type 'o.

val v : ?doc:string -> ('o, 'o) Var.Prod.t -> 'o t

v ?doc vars are observations described by the variables product vars. doc is a documentation string.

val empty : unit -> 'o t

empty () observes the void.

val doc : 'o t -> string

doc obs is the documentation string of obs.

val prod : 'o t -> ('o, 'o) Var.Prod.t

prod obs is the product of variables describing obs.

val vars : 'o t -> 'o Var.v list

vars obs is are the variables of observations obs.

val compare : 'o t -> 'o -> 'o -> int

compare obs is Var.order (vars obs), orders observations in the lexicographic order of their variables.

val set : 'o t -> ('o, 'a) Var.t -> 'a -> 'o -> 'o

set obs var v o sets variable var to v in o. Raises Invalid_argument if the product is absurd and has no effect if var is not part of prod obs.

val o1 : ?doc:string -> ('a, 'a) Var.t -> 'a t
val o2 : ?doc:string -> ('a * 'b, 'a) Var.t -> ('a * 'b, 'b) Var.t -> ('a * 'b) t