(* Require Import NNtheory. *)
(* Require Import PRrepresentable. Require Import expressible. *)
Unset Standard Proposition Elimination Names.
Section Goedel's_2nd_Incompleteness.
Variable T : System.
Hypothesis extendsPA : Included _ PA T.
Variable repT : Formula.
Variable v0 : nat.
Hypothesis
freeVarRepT : forall v : nat, In v (freeVarFormula LNT repT) -> v = v0.
Hypothesis
expressT1 :
forall f : Formula,
mem _ T f ->
SysPrf T (substituteFormula LNT repT v0 (natToTerm (codeFormula f))).
Hypothesis
expressT2 :
forall f : Formula,
~ mem _ T f ->
SysPrf T
(notH (substituteFormula LNT repT v0 (natToTerm (codeFormula f)))).
Definition codeSysPf :=
(codeSysPf LNT codeLNTFunction codeLNTRelation codeArityLNTF codeArityLNTR
codeArityLNTFIsPR codeArityLNTRIsPR (LNT2LNN_formula repT) v0).
(* Definition codeSysPrfCorrect2 := codeSysPrfCorrect2 LNT codeLNTFunction codeLNTRelation codeArityLNTF codeArityLNTR codeArityLNTFIsPR codeArityLNTFIsCorrect1 codeArityLNTRIsPR codeArityLNTRIsCorrect1 T' extendsNN T (LNT2LNN_formula repT) v0 freeVarRepT' expressT'2.  Definition codeSysPrfCorrect3 := codeSysPrfCorrect3 LNT codeLNTFunction codeLNTRelation codeArityLNTF codeArityLNTR codeArityLNTFIsPR codeArityLNTFIsCorrect1 codeArityLNTFIsCorrect2 codeArityLNTRIsPR codeArityLNTRIsCorrect1 codeArityLNTRIsCorrect2 codeLNTFunctionInj codeLNTRelationInj T' extendsNN. *)
Section Goedel1PA.
(*Let's reuse some of our work from rosserPA*)
Definition T' := T' T.
Definition extendsNN := extendsNN T.
Definition Tprf2T'prf := Tprf2T'prf T.
Definition expressT'1 := expressT'1 T repT v0 expressT1.
Definition expressT'2 := expressT'2 T repT v0 expressT2.
Definition freeVarRepT' := freeVarRepT' repT v0 freeVarRepT.
Definition codeSysPfCorrect :=
codeSysPfCorrect LNT codeLNTFunction codeLNTRelation codeArityLNTF
codeArityLNTR codeArityLNTFIsPR codeArityLNTFIsCorrect1 codeArityLNTRIsPR
codeArityLNTRIsCorrect1 T' extendsNN T (LNT2LNN_formula repT) v0
freeVarRepT' expressT'1.
Definition G := let (a,_) := FixPointLNT (notH (LNN2LNT_formula codeSysPf)) 0 in a.
Definition box (f:Formula) := (substituteFormula LNT (LNN2LNT_formula codeSysPf) 0 (natToTerm (codeFormula f))).

Lemma GS : SysPrf T (iffH G (notH (box G))).