Module KL := KnotHered_Lemmas(K).
Export K.
Export KL.
(* Let's define our typing system on values *)
Definition mtype : Type := knot.
Definition world : Type := (mtype * value)%type.
Definition world_ag : ageable world :=
ag_prod mtype value ag_knot.
Existing Instance world_ag.
Definition knot_extends (k1 k2 : knot) : Prop :=
match (unsquash k1, unsquash k2) with
((n, psi), (n', psi')) => n = n' /\ forall a, (psi a = None) \/ (psi' a = psi a)
end.
Definition R_extends (w1 w2 : world) : Prop :=
match (w1, w2) with
((k1, v1), (k2, v2)) => knot_extends k1 k2 /\ v1 = v2
end.
(* Lemma extends_fashionable : forall x y, R_extends x y -> fashionR x y. *)
Definition knot_contracts := transp _ knot_extends.
Definition R_contracts := transp _ R_extends.
Definition extendM : modality :=
exist _ R_extends R_extends_valid_rel.
Definition contractsM : modality :=
exist _ R_contracts R_contracts_valid_rel.
Notation "'%' e"  := (box extendM e)(at level 30, right associativity): pred.
Open Scope pred.
(* Section 4.1, equation 19 *)
Definition approx_eq (n : nat) (tau1 tau2 : predicate) : Prop :=
approx n tau1 = approx n tau2.

Lemma approx_eq_downward : forall n m p q,
m <= n ->
approx_eq n p q ->
approx_eq m p q.