Section Lifting.
Variable (sig : Type).
Variable (m n : nat).
(* [P] is the premise of the lifted machine [M@I]. *)
Variable (P : @SpecV sig n).
Variable (I : Vector.t (Fin.t n) m). (* [m<=n] *)
Hypothesis (HI : dupfree I).
(* We want to extract from [P] the premise [P'] for [M] *)
Definition Downlift : @SpecV sig m :=
(select I P).
(* Same specification as in [P] on indices not in [I], but as in [Q] for indices in [I] (lifted).  *)
Definition Frame (Q : @SpecV sig m) : @SpecV sig n := fill I P Q.
End Lifting.

Lemma LiftTapes_SpecT_space_con (sig : finType) (F : finType) (m n : nat) (I : Vector.t (Fin.t n) m)
P' (P : SpecV sig n) Q' (Q : F -> SpecV sig m) R' (R : F -> SpecV sig n) (ss : Vector.t nat n) (ss' : Vector.t nat m) (ss'' : Vector.t nat n)
(k : nat) (pM : pTM sig^+ F m) :
dupfree I ->
TripleT (tspec (P',withSpace (Downlift P I) (select I ss))) k pM (fun y => tspec (Q' y,withSpace (Q y) ss')) ->
(forall yout, Entails (tspec (Q' yout,withSpace (Frame P I (Q yout)) (fill I ss ss'))) (tspec (R' yout,withSpace (R yout) ss''))) ->
TripleT (tspec (P',withSpace P ss)) k (LiftTapes pM  I) (fun y => tspec (R' y,withSpace (R y) ss'')).