Section Check_Proof.
Variable L : Language.
Variable codeF : Functions L -> nat.
Variable codeR : Relations L -> nat.
Variable codeArityF : nat -> nat.
Variable codeArityR : nat -> nat.
Hypothesis codeArityFIsPR : isPR 1 codeArityF.
Hypothesis
codeArityFIsCorrect1 :
forall f : Functions L, codeArityF (codeF f) = S (arity L (inr _ f)).
Hypothesis
codeArityFIsCorrect2 :
forall n : nat, codeArityF n <> 0 -> exists f : Functions L, codeF f = n.
Hypothesis codeArityRIsPR : isPR 1 codeArityR.
Hypothesis
codeArityRIsCorrect1 :
forall r : Relations L, codeArityR (codeR r) = S (arity L (inl _ r)).
Hypothesis
codeArityRIsCorrect2 :
forall n : nat, codeArityR n <> 0 -> exists r : Relations L, codeR r = n.
Hypothesis codeFInj : forall f g : Functions L, codeF f = codeF g -> f = g.
Hypothesis codeRInj : forall R S : Relations L, codeR R = codeR S -> R = S.
Let Term := Term L.
Let Terms := Terms L.
Let var := var L.
Let apply := apply L.
Let Formula := Formula L.
Let equal := equal L.
Let atomic := atomic L.
Let impH := impH L.
Let notH := notH L.
Let forallH := forallH L.
Let wellFormedTerm := wellFormedTerm codeArityF.
Let wellFormedFormula := wellFormedFormula codeArityF codeArityR.
Let Prf := Prf L.
(*The wellFormedness requirement isn't really neccesary, because and proof that used ``extra symbols'' could be turned into a proof that only used symbols from the axioms and the conclusion.  However making this assumption makes the proof easier *)
(* p is (cPair (formula) (proof of the Formula)) *)
Definition checkPrfAXM (p recs : nat) :=
switchPR (charFunction 2 beq_nat (cPairPi2 (cPairPi2 p)) (cPairPi1 p))
(S (S (cPair (cPairPi1 p) 0))) 0.

Lemma checkPrfFA1IsPR : isPR 2 checkPrfFA1.
Definition checkPrfFA2 (p recs : nat) :=
let A := cPairPi1 (cPairPi2 (cPairPi2 p)) in
let v := cPairPi2 (cPairPi2 (cPairPi2 p)) in
(1 - codeIn v (codeFreeVarFormula A)) *
charFunction 2 beq_nat (cPair 1 (cPair A (cPair 3 (cPair v A))))
(cPairPi1 p).