X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fsrc%2Fcommon%2Flevel.ml;fp=helm%2Fsoftware%2Flambda-delta%2Fsrc%2Fcommon%2Flevel.ml;h=d33c1be662deda6db265f7169c0795b57913cf7f;hb=fa9e69af2ad5a22692f6fdd555d37bc6d80c5ad9;hp=0000000000000000000000000000000000000000;hpb=22fd9c98a22929f0319286c0693fcdaee43a72df;p=helm.git diff --git a/helm/software/lambda-delta/src/common/level.ml b/helm/software/lambda-delta/src/common/level.ml new file mode 100644 index 000000000..d33c1be66 --- /dev/null +++ b/helm/software/lambda-delta/src/common/level.ml @@ -0,0 +1,37 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department, University of Bologna, Italy. + ||I|| + ||T|| HELM is free software; you can redistribute it and/or + ||A|| modify it under the terms of the GNU General Public License + \ / version 2 or (at your option) any later version. + \ / This software is distributed as is, NO WARRANTY. + V_______________________________________________________________ *) + +type level = int option + +(* Interface functions ******************************************************) + +let infinite = None + +let finite i = Some i + +let is_zero xi = + xi = (Some 0) + +let is_infinite xi = + xi = None + +let succ = function + | None -> None + | Some i -> Some (succ i) + +let pred = function + | None -> None + | Some i when i > 0 -> Some (pred i) + | _ -> Some 0 + +let to_string = function + | None -> "" + | Some i -> string_of_int i