diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
| commit | b4422c99e10a8daee452b22aea84cb1f68ae54bc (patch) | |
| tree | 1f2ac50f4c536b8da83fca654cb3a6dee86a9975 /lib/concepts | |
| parent | f88aeff9f7a673e945484a31fbcaed647bb3d2fa (diff) | |
| download | RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.tar.gz RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.zip | |
refactor ephemeral and subs relations
Diffstat (limited to '')
| -rw-r--r-- | lib/concepts/Mode.ml | 17 | ||||
| -rw-r--r-- | lib/concepts/Mode.mli | 3 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/concepts/Mode.ml b/lib/concepts/Mode.ml index 23abacf..6ac1704 100644 --- a/lib/concepts/Mode.ml +++ b/lib/concepts/Mode.ml @@ -21,15 +21,16 @@ let generation declaration bound = (fun tightest {bound= declared; affords} -> match affords with | Generates cardinality when BatSet.String.subset declared bound -> - Some - ( match tightest with - | None -> cardinality - | Some other -> Cardinality.meet cardinality other ) + Some (Option.fold ~none:cardinality ~some:(Cardinality.meet cardinality) tightest) | Generates _ | Decides -> tightest ) None declaration +let exhaustible declaration bound = + Option.fold ~none:false ~some:Cardinality.exhaustible (generation declaration bound) + let decision declaration bound = - List.exists - (fun {bound= declared; affords} -> - match affords with Decides -> BatSet.String.equal declared bound | Generates _ -> false ) - declaration + exhaustible declaration bound + || List.exists + (fun {bound= declared; affords} -> + match affords with Decides -> BatSet.String.equal declared bound | Generates _ -> false ) + declaration diff --git a/lib/concepts/Mode.mli b/lib/concepts/Mode.mli index 982518a..8d84093 100644 --- a/lib/concepts/Mode.mli +++ b/lib/concepts/Mode.mli @@ -24,4 +24,7 @@ val to_list : t -> mode list attributes left free are then fewer and no more numerous. *) val generation : t -> attributes -> Cardinality.t option +val exhaustible : t -> attributes -> bool + +(** declared outright, or implied by a generation that can be exhausted. *) val decision : t -> attributes -> bool |
