(* ========================================================================= *)
(* Proof that provability is definable; weak form of Godel's theorem.        *)
(* ========================================================================= *)
prioritize_num();;
(* ------------------------------------------------------------------------- *)
(* Auxiliary predicate: all numbers in an iterated-pair "list".              *)
(* ------------------------------------------------------------------------- *)
let ALLN_DEF =
  
(* ------------------------------------------------------------------------- *)
(* Valid term.                                                               *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Valid formula.                                                            *)
(* ------------------------------------------------------------------------- *)
(*** Following really blows up if we just use FORM1
 *** instead of manually breaking up the conjuncts
 ***)
(* ------------------------------------------------------------------------- *)
(* Term without particular variable.                                         *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Formula without particular free variable.                                 *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Arithmetization of logical axioms --- autogenerated.                      *)
(* ------------------------------------------------------------------------- *)
let AXIOM,AXIOM_THM =
  
(* ------------------------------------------------------------------------- *)
(* Prove also that all AXIOMs are in fact numbers of formulas.               *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Arithmetization of the full logical inference rules.                      *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Now really objectify all that.                                            *)
(* ------------------------------------------------------------------------- *)
let arith_term1,ARITH_TERM1 = OBJECTIFY [] "arith_term1" TERM1;;
let arith_term,ARITH_TERM = OBJECTIFY_RTC ARITH_TERM1 "arith_term" TERM;;
let arith_form1,ARITH_FORM1 =
 OBJECTIFY [ARITH_TERM] "arith_form1" FORM1;;
let arith_form,ARITH_FORM = OBJECTIFY_RTC ARITH_FORM1 "arith_form" FORM;;
let arith_freeterm1,ARITH_FREETERM1 =
 OBJECTIFY [] "arith_freeterm1" FREETERM1;;
let arith_freeterm,ARITH_FREETERM =
  OBJECTIFY_RTCP ARITH_FREETERM1 "arith_freeterm" FREETERM;;
let arith_freeform1,ARITH_FREEFORM1 =
 OBJECTIFY [ARITH_FREETERM; ARITH_FORM] "arith_freeform1" FREEFORM1;;
let arith_freeform,ARITH_FREEFORM =
 OBJECTIFY_RTCP ARITH_FREEFORM1 "arith_freeform" FREEFORM;;
let arith_axiom,ARITH_AXIOM =
 OBJECTIFY [ARITH_FORM; ARITH_FREEFORM; ARITH_FREETERM; ARITH_TERM]
           "arith_axiom" AXIOM;;
(* ------------------------------------------------------------------------- *)
(* Parametrization by A means it's easier to do these cases manually.        *)
(* ------------------------------------------------------------------------- *)
let arith_prov1,ARITH_PROV1 =
  let PROV1' = REWRITE_RULE[IN] PROV1 in
 OBJECTIFY [ASSUME `!v n. holds v (A n) <=> Ax (termval v n)`; ARITH_AXIOM]
   "arith_prov1" PROV1';;
(* ------------------------------------------------------------------------- *)
(* Our final conclusion.                                                     *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* The crudest conclusion: truth undefinable, provability not, so:           *)
(* ------------------------------------------------------------------------- *)