From b4422c99e10a8daee452b22aea84cb1f68ae54bc Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Wed, 23 Sep 2026 03:23:40 -0300 Subject: refactor ephemeral and subs relations --- lib/concepts/Mode.ml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/concepts/Mode.ml') 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 -- cgit v1.2.3