Global Instance k2_unfold RR (R1: klr W A1 B1) (R2: klr W A2 B2) w:
    Related (RR (R1 w) (R2 w)) (k2 RR R1 R2 w) subrel.Global Instance k_rel_params: Params (@k) 4.Global Instance k1_rel_params: Params (@k1) 5.Global Instance k2_rel_params: Params (@k2) 6.Definition arrow_klr {A1 A2 B1 B2} :=
    k2 (W:=W) (@arrow_rel A1 A2 B1 B2).Definition arrow_pointwise_klr A {B1 B2} :=
    k1 (W:=W) (@arrow_pointwise_rel A B1 B2).Definition prod_klr {A1 A2 B1 B2} :=
    k2 (W:=W) (@prod_rel A1 A2 B1 B2).Definition sum_klr {A1 A2 B1 B2} :=
    k2 (W:=W) (@sum_rel A1 A2 B1 B2).Definition list_klr {A1 A2} :=
    k1 (W:=W) (@list_rel A1 A2).Definition set_kle {A B} (R: klr W A B): klr W (A -> Prop) (B -> Prop) :=
    fun w sA sB => forall a, sA a -> exists b, sB b /\ R w a b.Definition set_kge {A B} (R: klr W A B): klr W (A -> Prop) (B -> Prop) :=
    fun w sA sB => forall b, sB b -> exists a, sA a /\ R w a b.Definition klr_union {W A B} :=
    k2 (W:=W) (@rel_union A B).Definition klr_inter {W A B} :=
    k2 (W:=W) (@rel_inter A B).Definition klr_curry {W A1 B1 C1 A2 B2 C2} :=
    k1 (W:=W) (@rel_curry A1 B1 C1 A2 B2 C2).Notation "RA ==> RB" := (arrow_klr RA RB)
  (at level 55, right associativity) : klr_scope.Notation "RA ++> RB" := (arrow_klr RA RB)
  (at level 55, right associativity) : klr_scope.Notation "RA --> RB" := (arrow_klr (k1 flip RA) RB)
  (at level 55, right associativity) : klr_scope.Notation "- ==> R" := (arrow_pointwise_klr _ R) : klr_scope.Infix "*" := prod_klr : klr_scope.Infix "+" := sum_klr : klr_scope.Infix "\/" := klr_union : klr_scope.Infix "/\" := klr_inter : klr_scope.Notation "% R" := (klr_curry R) : klr_scope.(** The box modality asserts that the relation holds at all
    possible future worlds. *)

  Definition klr_box {A B} (l: L) (R: klr W A B): klr W A B :=
    fun w x y => forall w', acc l w w' -> R w' x y.

Lemma klr_box_relim {A B} l (R: klr W A B) w w' x y P Q: RElim (R w') x y P Q -> RElim (klr_box l R w) x y (acc l w w' /\ P) Q.