(* File: Derivable.v  (last edited on 1/1/2000) (c) Klaus Weich  *)
Require Export Derivable_Def.
intros context context' a a' eq_context eq_a.
rewrite eq_context.
rewrite eq_a.
intros; assumption.
Qed.
intros i g context a der.
elim der; clear der.
intros t der.
elim der; clear der a t context.
intros context n a nth.
apply Derivable_Intro with (Var n).
apply ByAssumption.
apply subst_nth; assumption.
intros context t a der ih.
elim ih; clear ih.
intros t1 der1.
apply Derivable_Intro with (Efq t1 (subst_form i g a)).
apply ByAbsurdity; assumption.
intros context a t b der ih.
elim ih; clear ih.
intros t1 der1.
apply Derivable_Intro with (Abs (subst_form i g a) t1).
simpl in |- *.
apply ImpIntro; assumption.
intros context r s a b der_r ih_r der_s ih_s.
elim ih_r; clear ih_r.
intros r1 der_r1.
elim ih_s; clear ih_s.
intros s1 der_s1.
apply Derivable_Intro with (App (subst_form i g a) r1 s1).
apply ImpElim; assumption.
intros context r s a b der_r ih_r der_s ih_s.
elim ih_r; clear ih_r.
intros r1 der_r1.
elim ih_s; clear ih_s.
intros s1 der_s1.
apply Derivable_Intro with (Pair r1 s1).
simpl in |- *; apply AndFIntro; assumption.
intros context r a b der_r ih.
elim ih; clear ih; intros r1 der_r1.
apply Derivable_Intro with (PrL (subst_form i g b) r1).
apply AndFElimL; assumption.
intros context r a b der_r ih.
elim ih; clear ih; intros r1 der_r1.
apply Derivable_Intro with (PrR (subst_form i g a) r1).
apply AndFElimR; assumption.
intros context r a b der_r ih.
elim ih; clear ih; intros r1 der_r1.
apply Derivable_Intro with (OrFL r1 (subst_form i g b)).
simpl in |- *; apply OrFIntroL; assumption.
intros context r a b der_r ih.
elim ih; clear ih; intros r1 der_r1.
apply Derivable_Intro with (OrFR r1 (subst_form i g a)).
simpl in |- *; apply OrFIntroR; assumption.
intros context r s t a b c der_r ih_r der_s ih_s der_t ih_t.
elim ih_r; clear ih_r; intros r1 der_r1.
elim ih_s; clear ih_s; intros s1 der_s1.
elim ih_t; clear ih_t; intros t1 der_t1.
apply
Derivable_Intro with (Cas (subst_form i g a) (subst_form i g b) r1 s1 t1).
apply OrFElim; assumption.
intros context r a b der_r ih_r.
elim ih_r; clear ih_r; intros r1 der_r1.
apply Derivable_Intro with (Shift r1).
simpl in |- *; apply ShiftIntro; assumption.
Qed.
intros context i der below b.
cut (subst_form i b (Atom i) = b).
intro eq_b.
rewrite <- eq_b.
rewrite <- (subst_list_below i b context).
apply derivable_subst; assumption.
assumption.
simpl in |- *.
apply equal_dec_refl.
Qed.
intros context a b der_a.
elim der_a; clear der_a.
intros t der_t.
apply Derivable_Intro with (Shift t).
apply ShiftIntro; assumption.
Qed.

Lemma derivable_weak_list :
forall (context1 context2 : flist) (a : form),
Derivable context1 a -> Derivable (context2 ++ context1) a.