Ltac solve_legal_tc_init :=
repeat progress
(simpl; auto;
match goal with
| |- context [match ?A with _ => _ end] => destruct A eqn:?H
| |- legal_tc_init _ (tc_bool _ _) => apply legal_tc_init_tc_bool
| |- legal_tc_init _ (tc_andp _ _) => apply legal_tc_init_tc_andp
| |- legal_tc_init _ (tc_nonzero _) => apply legal_tc_init_tc_nonzero
| |- legal_tc_init _ (tc_iszero _) => apply legal_tc_init_tc_iszero
| |- legal_tc_init _ (tc_test_eq _ _) => apply legal_tc_init_tc_test_eq
| |- legal_tc_init _ (tc_test_order _ _) => apply legal_tc_init_tc_test_order
| |- legal_tc_init _ (tc_nodivover _ _) => apply legal_tc_init_tc_nodivover
| |- legal_tc_init _ (tc_ilt _ _) => apply legal_tc_init_tc_ilt
| |- legal_tc_init _ (tc_llt _ _) => apply legal_tc_init_tc_llt
| |- legal_tc_init _ (binarithType _ _ _ _ _) => apply legal_tc_init_binarithType
| |- legal_tc_init _ (tc_nobinover _ _ _) => apply legal_tc_init_tc_nobinover
| |- _ => idtac
end).

Lemma typecheck_LR_legal_tc_init: forall {cs: compspecs} Delta e lr,
legal_tc_init Delta (typecheck_LR Delta e lr).