Variables (n : nat) (s : ll_vars -> vec nat n -> Prop).
Reserved Notation "'⟦' A '⟧'" (at level 65).
Definition ll_tps_imp (X Y : _ -> Prop) (v : vec _ n) := forall x, X x -> Y (vec_plus x v).
Definition ll_tps_mult (X Y : _ -> Prop) (x : vec _ n) := exists a b, x = vec_plus a b /\ X a /\ Y b.
Infix "**" := (ll_tps_mult) (at level 65, right associativity).
Infix "-*" := (ll_tps_imp) (at level 65, right associativity).
Fact ll_tps_mult_mono (X1 X2 Y1 Y2 : _ -> Prop) :
(forall x, X1 x -> X2 x)
-> (forall x, Y1 x -> Y2 x)
-> (forall x, (X1**Y1) x -> (X2**Y2) x).
(* Symbols for cut&paste ⟙   ⟘   𝝐  ﹠ ⊗  ⊕  ⊸  ❗   ‼  ∅  ⊢ ⟦ ⟧ Γ Δ Σ*)
Fixpoint ll_tps A x : Prop :=
match A with
| £ X     => s X x
| A ﹠ B  => ⟦A⟧ x /\ ⟦B⟧ x
| ❗ A     => ⟦A⟧ x /\ x = vec_zero
| A ⊸ B  => (⟦A⟧ -* ⟦B⟧) x
| A ⊗ B  => (⟦A⟧ ** ⟦B⟧) x
| A ⊕ B  => ⟦A⟧ x \/ ⟦B⟧ x
| ⟘             => False
| ⟙             => True
| 𝝐              => x = vec_zero
end
where "⟦ A ⟧" := (ll_tps A).
Reserved Notation "'[[' Γ ']]'" (at level 0).
Fixpoint ll_tps_list Γ :=
match Γ with
| ∅    => eq vec_zero
| A::Γ => ⟦A⟧ ** [[Γ]]
end
where "[[ Γ ]]" := (ll_tps_list Γ).
Fact ll_tps_app Γ Δ x : [[Γ++Δ]] x <-> ([[Γ]]**[[Δ]]) x.
Fact ll_tps_lbang Γ x : [[‼Γ]] x <-> [[Γ]] x /\ x = vec_zero.
Fact ll_tps_list_bang_zero Γ : [[‼Γ]] vec_zero <-> forall A, In A Γ -> ⟦A⟧ vec_zero.
(* Symbols for cut&paste ⟙   ⟘   𝝐  ﹠ ⊗  ⊕  ⊸  ❗   ‼  ∅  ⊢ ⟦ ⟧ Γ Δ Σ*)
Fact ll_tps_perm Γ Δ : Γ ~p Δ -> forall x, [[Γ]] x -> [[Δ]] x.
Definition ll_sequent_tps Γ A := [[Γ]] -* ⟦A⟧.
Notation "'[<' Γ '|-' A '>]'" := (ll_sequent_tps Γ A).
Fact ll_sequent_tps_mono Γ A B :
(forall x, ⟦A⟧ x -> ⟦B⟧ x) -> forall x, [< Γ |- A >] x -> [< Γ |- B >] x.
Fact ll_perm_tps Γ Δ : Γ ~p Δ -> forall x A, [< Γ |- A >] x -> [< Δ |- A >] x.
Fact ll_sequent_tps_eq  Γ A : [< Γ |- A >] vec_zero <-> forall x, [[Γ]] x -> ⟦A⟧ x.

Theorem ll_tps_sound Γ A : Γ ⊢ A -> [< Γ |- A >] vec_zero.
End trivial_phase_semantics.