Section Typing.
Variable (E: list deq).
Definition Gamma__deq :=
tab (fun x => if partition_F_G x then (alpha → alpha) else (alpha → alpha → alpha → alpha))
(S (Sum (Fs E) + Sum (Gs E))).
Arguments Gamma__deq: simpl never.
Hint Resolve typing_G typing_F : core.
Ltac autotype :=
repeat match goal with
| [|- _ ⊢(2) var (?n + ?x) : _] =>
eapply ordertyping_preservation_under_renaming with (delta := add n) (s := var x)
| [|- _ ⊢(2) var (G _ _ _) : _ ]=> eapply typing_G
| [|- _ ⊢(2) var (F _) : _ ]=> eapply typing_F
| [|- _ ⊢(2) var ?n : _] => now (econstructor; cbn; eauto)
| [|- _ ⊢(2) const _ : _] => eauto
| [|- _ ⊢(2) enc _ _ : _] => eapply enc_typing
| [|- _ ⊢(2) _ : _] => econstructor
| [|- _ ⊫ add _ : _] => now intros ??
| [H: ?e ∈ E |- _ ∈ Vars__de E] => eapply Vars__de_in; [eapply H|cbn;intuition]
end.

Lemma typing_add x y z:
x +ₑ y =ₑ z ∈ E -> Gamma__deq ⊢₂(2) addEQ x y z : alpha → alpha → alpha.