Section tbled.
Variable tbl : SymEnv.functions RType_typ.
Let RSym_sym := RSym_sym tbl.
Existing Instance RSym_sym.
Let Expr_expr_fs := Expr_expr_fs tbl.
Existing Instance Expr_expr_fs.
Let Expr_ok_fs := Expr_ok_fs tbl.
Existing Instance Expr_ok_fs.
Let ExprVar_expr := @ExprVariables.ExprVar_expr typ func.
Existing Instance ExprVar_expr.
Existing Instance MA.
Instance MentionsAnyOk : MentionsAnyOk MA _ _.
Admitted.
intros. unfold THEN.
unfold THEN'.
apply THEN_sound; auto.
apply runOnGoals_sound; auto;
rtac_derive_soundness.
apply INSTANTIATE_sound.
apply runOnGoals_sound. auto.
Qed.
Definition APPLY_sound := (@APPLY_sound _ (expr typ func) _ _ _ _ _ _ _ _ _ _ _ ).
(*Definition APPLY_sound := (@APPLY_sound _ (expr typ func) _ _ _ _ _ _ _ _ _ _ _ _ (fun (subst : Type) (SS : Subst subst (expr typ func)) (SU : SubstUpdate subst (expr typ func)) (tus tvs : tenv typ) (n : nat) (l r : expr typ func) (t3 : typ) (s1 : subst) => @ExprUnify_simul.exprUnify subst typ func RType_typ (_) Typ2_tyArr SS SU (S (S (S (S (S (S (S (S (S (S O)))))))))) tus tvs n l r t3 s1) _ (ExprLift.vars_to_uvars_exprD')).*)
(*  (fun (subst : Type) (SS : Subst subst (expr typ func)) (SU : SubstUpdate subst (expr typ func)) (tus tvs : tenv typ) (n : nat) (l r : expr typ func) (t3 : typ) (s1 : subst) => @ExprUnify_simul.exprUnify subst typ func RType_typ (_) Typ2_tyArr SS SU (S (S (S (S (S (S (S (S (S (S O)))))))))) tus tvs n l r t3 s1) _ (* (ExprLift.vars_to_uvars_exprD')*)).*)
Definition EAPPLY_sound :=
(@EAPPLY_sound _ (expr typ func) _ _ _ _ _ _ _ _ _ _). (*_ _ (fun (subst : Type)
(SS : Subst subst (expr typ func))
(SU : SubstUpdate subst (expr typ func))
(tus tvs : tenv typ)
(n : nat) (l r : expr typ func)
(t3 : typ) (s1 : subst) =>
@ExprUnify_simul.exprUnify subst typ func
RType_typ (func_defs.RSym_sym symexe.tbl)
Typ2_tyArr SS SU
(S (S (S (S (S (S (S (S (S (S O))))))))))
tus tvs n l r t3 s1) (ExprLift.vars_to_uvars_exprD')).*)

Lemma APPLY_condition1: vars_to_uvars_spec vars_to_uvars.