diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-20 02:14:10 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-20 02:14:10 -0300 |
| commit | f53d887d23d7743bc40c3b552c27d9ae30a72acd (patch) | |
| tree | 965f1ff7a4825d5d8843c612d1e6b37172478bcd /lib/concepts/Cardinality.ml | |
| parent | f76392a009f620b1717718001250e47ac71c3c9c (diff) | |
| download | RNT-f53d887d23d7743bc40c3b552c27d9ae30a72acd.tar.gz RNT-f53d887d23d7743bc40c3b552c27d9ae30a72acd.zip | |
format
Diffstat (limited to 'lib/concepts/Cardinality.ml')
| -rw-r--r-- | lib/concepts/Cardinality.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/concepts/Cardinality.ml b/lib/concepts/Cardinality.ml index ac80a15..a87f9c8 100644 --- a/lib/concepts/Cardinality.ml +++ b/lib/concepts/Cardinality.ml @@ -4,7 +4,7 @@ let bounded n = if n <= 0 then Empty else Bounded n let rank = function Empty -> 0 | Bounded _ -> 1 | Finite -> 2 | Countable -> 3 let compare a b = - match (a, b) with + match a, b with | Bounded n, Bounded m -> Utilities.Ordering.of_int (Int.compare n m) | _ -> Utilities.Ordering.of_int (Int.compare (rank a) (rank b)) @@ -12,14 +12,16 @@ let equal a b = compare a b = Utilities.Ordering.Equal let leq a b = compare a b <> Utilities.Ordering.Greater let join a b = if leq a b then b else a let meet a b = if leq a b then a else b + let product a b = - match (a, b) with + match a, b with | Empty, _ | _, Empty -> Empty | Countable, _ | _, Countable -> Countable | Finite, _ | _, Finite -> Finite | Bounded n, Bounded m -> if n > max_int / m then Finite else bounded (n * m) let exhaustible = function Countable -> false | Empty | Bounded _ | Finite -> true + let to_string = function | Empty -> "empty" | Bounded n -> Printf.sprintf "bounded(%d)" n |
