Module Rat_inter


module Rat_inter: sig .. end
Provides type rat_inter : singletons and non-empty open intervals whose bounds are rationals, and operations involving them.


type rat_inter =
| Open_inter of Rat.rat * Rat.rat
| Singleton_inter of Rat.rat
Every interval (singleton or non-empty open interval whose bounds are rationals) is given a unique representation.
val cons_open : Rat.rat * Rat.rat -> rat_inter
Constructs the non-empty open interval (a, b) from the given pair (a, b) of rationals.
val cons_single : Rat.rat -> rat_inter
Constructs the singleton that contains the given rational.
val is_open : rat_inter -> bool
Tests whether an interval is open.
val lower_bound : rat_inter -> Rat.rat
Returns the lower bound of an interval.
val upper_bound : rat_inter -> Rat.rat
Returns the upper bound of an interval.
val width : rat_inter -> Rat.rat
Returns the width of an interval.
val midpoint : rat_inter -> Rat.rat
Returns the midpoint of an interval.
val cut_in_half : rat_inter -> rat_inter * rat_inter
Returns given the interval (a, b) the pair ((a, c), (c, b)) of intervals where c is the midpoint of (a, b).
val string_of_rat_inter : rat_inter -> string
Returns a string representation of an interval.
val pr_inter : 'a -> rat_inter -> unit
val print_rat_inter : rat_inter -> unit
Prints a string representation of an interval.