Skip to content

Commit 532063e

Browse files
committed
just use id as adjoints
1 parent 67b76d8 commit 532063e

File tree

1 file changed

+3
-40
lines changed

1 file changed

+3
-40
lines changed

ocaml/typing/mode.ml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,12 @@ module Lattices_mono = struct
506506
| Id : ('a, 'a, 'd) morph (** identity morphism *)
507507
| Meet_with : 'a -> ('a, 'a, 'l * 'r) morph
508508
(** Meet the input with the parameter *)
509-
| Restrict_below : 'a -> ('a, 'a, 'l * disallowed) morph
510-
(** [Restrict_below c] is identity for input lower than [c], and
511-
undefined otherwise. This is the partial left joint of [Meet_with]. *)
512509
| Imply : 'a -> ('a, 'a, disallowed * 'd) morph
513510
(** The right adjoint of [Meet_with] *)
514511
| Join_with : 'a -> ('a, 'a, 'l * 'r) morph
515512
(** Join the input with the parameter *)
516513
| Subtract : 'a -> ('a, 'a, 'd * disallowed) morph
517514
(** The left adjoint of [Join_with] *)
518-
| Restrict_above : 'a -> ('a, 'a, disallowed * 'r) morph
519-
(** [Restrict_above c] is identity for input higher than [c], and
520-
undefined otherwise. It is the partial right adjoint of [Join_with] *)
521515
| Proj : 't obj * ('t, 'r_) Axis.t -> ('t, 'r_, 'l * 'r) morph
522516
(** Project from a product to an axis *)
523517
| Max_with : ('t, 'r_) Axis.t -> ('r_, 't, disallowed * 'r) morph
@@ -563,7 +557,6 @@ module Lattices_mono = struct
563557
| Proj (src, ax) -> Proj (src, ax)
564558
| Min_with ax -> Min_with ax
565559
| Meet_with c -> Meet_with c
566-
| Restrict_below c -> Restrict_below c
567560
| Join_with c -> Join_with c
568561
| Subtract c -> Subtract c
569562
| Compose (f, g) ->
@@ -587,7 +580,6 @@ module Lattices_mono = struct
587580
| Proj (src, ax) -> Proj (src, ax)
588581
| Max_with ax -> Max_with ax
589582
| Join_with c -> Join_with c
590-
| Restrict_above c -> Restrict_above c
591583
| Meet_with c -> Meet_with c
592584
| Imply c -> Imply c
593585
| Compose (f, g) ->
@@ -612,10 +604,8 @@ module Lattices_mono = struct
612604
| Min_with ax -> Min_with ax
613605
| Max_with ax -> Max_with ax
614606
| Join_with c -> Join_with c
615-
| Restrict_above c -> Restrict_above c
616607
| Subtract c -> Subtract c
617608
| Meet_with c -> Meet_with c
618-
| Restrict_below c -> Restrict_below c
619609
| Imply c -> Imply c
620610
| Compose (f, g) ->
621611
let f = disallow_left f in
@@ -641,10 +631,8 @@ module Lattices_mono = struct
641631
| Min_with ax -> Min_with ax
642632
| Max_with ax -> Max_with ax
643633
| Join_with c -> Join_with c
644-
| Restrict_above c -> Restrict_above c
645634
| Subtract c -> Subtract c
646635
| Meet_with c -> Meet_with c
647-
| Restrict_below c -> Restrict_below c
648636
| Imply c -> Imply c
649637
| Compose (f, g) ->
650638
let f = disallow_right f in
@@ -692,9 +680,7 @@ module Lattices_mono = struct
692680
| Max_with ax -> proj_obj ax dst
693681
| Min_with ax -> proj_obj ax dst
694682
| Join_with _ -> dst
695-
| Restrict_above _ -> dst
696683
| Meet_with _ -> dst
697-
| Restrict_below _ -> dst
698684
| Imply _ -> dst
699685
| Subtract _ -> dst
700686
| Compose (f, g) ->
@@ -742,11 +728,7 @@ module Lattices_mono = struct
742728
not requird to be complete: i.e., it's allowed to return [None] when
743729
it should return [Some]. It would cause duplication but not error. *)
744730
if c0 = c1 then Some Refl else None
745-
| Restrict_below c0, Restrict_below c1 ->
746-
if c0 = c1 then Some Refl else None
747731
| Join_with c0, Join_with c1 -> if c0 = c1 then Some Refl else None
748-
| Restrict_above c0, Restrict_above c1 ->
749-
if c0 = c1 then Some Refl else None
750732
| Imply c0, Imply c1 -> if c0 = c1 then Some Refl else None
751733
| Subtract c0, Subtract c1 -> if c0 = c1 then Some Refl else None
752734
| Monadic_to_comonadic_min, Monadic_to_comonadic_min -> Some Refl
@@ -765,8 +747,7 @@ module Lattices_mono = struct
765747
match equal g0 g1 with None -> None | Some Refl -> Some Refl))
766748
| Map_comonadic f, Map_comonadic g -> (
767749
match equal f g with Some Refl -> Some Refl | None -> None)
768-
| ( ( Id | Proj _ | Max_with _ | Min_with _ | Meet_with _
769-
| Restrict_below _ | Join_with _ | Restrict_above _
750+
| ( ( Id | Proj _ | Max_with _ | Min_with _ | Meet_with _ | Join_with _
770751
| Monadic_to_comonadic_min | Comonadic_to_monadic _
771752
| Monadic_to_comonadic_max | Local_to_regional
772753
| Locality_as_regionality | Global_to_regional | Regional_to_local
@@ -783,9 +764,7 @@ module Lattices_mono = struct
783764
fun dst ppf -> function
784765
| Id -> Format.fprintf ppf "id"
785766
| Join_with c -> Format.fprintf ppf "join_%a" (print dst) c
786-
| Restrict_above c -> Format.fprintf ppf "restrict_above_%a" (print dst) c
787767
| Meet_with c -> Format.fprintf ppf "meet_%a" (print dst) c
788-
| Restrict_below c -> Format.fprintf ppf "restrict_below_%a" (print dst) c
789768
| Imply c -> Format.fprintf ppf "imply_%a" (print dst) c
790769
| Subtract c -> Format.fprintf ppf "subtract_%a" (print dst) c
791770
| Proj (_, ax) -> Format.fprintf ppf "proj_%a" Axis.print ax
@@ -842,14 +821,6 @@ module Lattices_mono = struct
842821

843822
let max_with dst ax a = Axis.update ax a (max dst)
844823

845-
let restrict_below obj c a =
846-
assert (le obj a c);
847-
a
848-
849-
let restrict_above obj c a =
850-
assert (le obj c a);
851-
a
852-
853824
let monadic_to_comonadic_min :
854825
type a. a comonadic_with obj -> Monadic_op.t -> a comonadic_with =
855826
fun obj (uniqueness, ()) ->
@@ -884,9 +855,7 @@ module Lattices_mono = struct
884855
| Max_with ax -> max_with dst ax a
885856
| Min_with ax -> min_with dst ax a
886857
| Meet_with c -> meet dst c a
887-
| Restrict_below c -> restrict_below dst c a
888858
| Join_with c -> join dst c a
889-
| Restrict_above c -> restrict_above dst c a
890859
| Imply c -> imply dst c a
891860
| Subtract c -> subtract dst c a
892861
| Monadic_to_comonadic_min -> monadic_to_comonadic_min dst a
@@ -921,10 +890,6 @@ module Lattices_mono = struct
921890
match m0, m1 with
922891
| Id, m -> Some m
923892
| m, Id -> Some m
924-
| Restrict_below _, m -> Some m
925-
| m, Restrict_below _ -> Some m
926-
| Restrict_above _, m -> Some m
927-
| m, Restrict_above _ -> Some m
928893
| Meet_with c0, Meet_with c1 -> Some (Meet_with (meet dst c0 c1))
929894
| Join_with c0, Join_with c1 -> Some (Join_with (join dst c0 c1))
930895
| Imply c0, Imply c1 -> Some (Imply (meet dst c0 c1))
@@ -1084,8 +1049,7 @@ module Lattices_mono = struct
10841049
let g' = left_adjoint mid g in
10851050
Compose (g', f')
10861051
| Join_with c -> Subtract c
1087-
| Restrict_above c -> Join_with c
1088-
| Meet_with c -> Restrict_below c
1052+
| Meet_with _ -> Id
10891053
| Imply c -> Meet_with c
10901054
| Comonadic_to_monadic _ -> Monadic_to_comonadic_min
10911055
| Monadic_to_comonadic_max -> Comonadic_to_monadic dst
@@ -1112,9 +1076,8 @@ module Lattices_mono = struct
11121076
let g' = right_adjoint mid g in
11131077
Compose (g', f')
11141078
| Meet_with c -> Imply c
1115-
| Restrict_below c -> Meet_with c
11161079
| Subtract c -> Join_with c
1117-
| Join_with c -> Restrict_above c
1080+
| Join_with _ -> Id
11181081
| Comonadic_to_monadic _ -> Monadic_to_comonadic_max
11191082
| Monadic_to_comonadic_min -> Comonadic_to_monadic dst
11201083
| Local_to_regional -> Regional_to_local

0 commit comments

Comments
 (0)