(***** subtyping and contractiveness -- should split this into a separate file ******)

(* Specifications: *)
Lemma later_fash1 {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}:
forall P : A, |> # P |-- # |> P.
Lemma subp_later1 {A}  {NA: NatDed A}{IA: Indir A}{RA: RecIndir A} : forall P Q : A,
|>(P >=> Q)  |--   |>P >=> |>Q.
Lemma subp_later {A}  {NA: NatDed A}{IA: Indir A}{RA: RecIndir A} : forall P Q : A,
|>(P >=> Q) = |>P >=> |>Q.
Lemma eqp_later1 {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A} : forall P Q : A,
|>(P <=> Q)  |--   |>P <=> |>Q.
Lemma eqp_later {A}  {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall P Q: A,
(|>(P <=> Q) = |>P <=> |>Q).
Lemma subp_refl {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P : A),
G |-- P >=> P.
Lemma subp_trans {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P Q R: A),
G |-- P >=> Q ->
G |-- Q >=> R ->
G |-- P >=> R.
Lemma subp_top {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P: A),
G |-- P >=> TT.
Lemma subp_bot {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P: A),
G |-- FF >=> P.
Lemma subp_andp {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G {P P' Q Q': A},
G |-- P >=> P' ->
G |-- Q >=> Q' ->
G |-- P && Q >=> (P' && Q').
Lemma subp_imp {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P P' Q Q' : A),
G |-- P' >=> P ->
G |-- Q >=> Q' ->
G |-- (P --> Q) >=> (P' --> Q').
Lemma subp_orp {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}  : forall G (P P' Q Q' : A),
G |-- P >=> P' ->
G |-- Q >=> Q' ->
G |-- (P || Q) >=> (P' || Q').
Lemma subp_subp {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A}:
forall G (P Q R S: A),
G |-- (R >=> P) ->
G |-- (Q >=> S) ->
G |-- (P >=> Q) >=> (R >=> S).
Lemma allp_imp2_later_e2 {B}{A}{NA: NatDed A}{IA: Indir A}{RA: RecIndir A}:
forall (P Q: B -> A) (y: B) ,
(ALL x:B, |> P x <=> |> Q x) |-- |> Q y >=> |> P y.
Lemma allp_imp2_later_e1 {B}{A}{NA: NatDed A}{IA: Indir A}{RA: RecIndir A}:
forall (P Q: B -> A) (y: B) ,
(ALL x:B, |> P x <=> |> Q x) |-- |> P y >=> |> Q y.
Lemma prove_HOcontractive1 {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A} : forall X F,
(forall P Q: X -> A,
(ALL x:X, |>(P x >=> Q x) |--
ALL x:X, F P x >=> F Q x)) ->
HOcontractive F.
Lemma prove_HOcontractive {A} {NA: NatDed A}{IA: Indir A}{RA: RecIndir A} : forall X F,
(forall (P Q: X -> A) (x: X),
(ALL x:X, (|> P x <=> |> Q x) |-- F P x >=> F Q x)) ->
HOcontractive F.
Lemma sub_sepcon' {A}{NA: NatDed A}{SL: SepLog A}{IA: Indir A}{RA: RecIndir A}{SRA: SepRec A}:
forall P P' Q Q': A, (P >=> P') && (Q >=> Q') |-- (P * Q) >=> (P' * Q').
Lemma subp_sepcon {A} {NA: NatDed A}{IA: Indir A}{SA: SepLog A}{SI: SepIndir A}{RA: RecIndir A}{SRA: SepRec A} :
forall G (P P' Q Q' : A),
G |-- P >=> P' ->
G |-- Q >=> Q' ->
G |-- P * Q >=> P' * Q'.