(* ========================================================================= *)
(* 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. *)
(* ------------------------------------------------------------------------- *)
let ISAFTERM = prove
(`(~(number x = m) ==> isafterm m (
NPAIR 0 (number x))) /\
isafterm m (
NPAIR 1 0) /\
(isafterm m t ==> isafterm m (
NPAIR 2 t)) /\
(isafterm m s /\ isafterm m t ==> isafterm m (
NPAIR 3 (
NPAIR s t))) /\
(isafterm m s /\ isafterm m t ==> isafterm m (
NPAIR 4 (
NPAIR s t)))`,
REWRITE_TAC[isafterm; gterm] THEN REPEAT CONJ_TAC THENL
[DISCH_TAC THEN EXISTS_TAC `V x`;
EXISTS_TAC `Z`;
DISCH_THEN(X_CHOOSE_THEN `t:term` STRIP_ASSUME_TAC) THEN
EXISTS_TAC `Suc t`;
DISCH_THEN(CONJUNCTS_THEN2
(X_CHOOSE_THEN `s:term` STRIP_ASSUME_TAC)
(X_CHOOSE_THEN `t:term` STRIP_ASSUME_TAC)) THEN
EXISTS_TAC `s ++ t`;
DISCH_THEN(CONJUNCTS_THEN2
(X_CHOOSE_THEN `s:term` STRIP_ASSUME_TAC)
(X_CHOOSE_THEN `t:term` STRIP_ASSUME_TAC)) THEN
EXISTS_TAC `s ** t`] THEN
ASM_REWRITE_TAC[gterm;
FVT;
IMAGE_UNION;
NOT_IN_EMPTY;
IN_SING;
IN_UNION;
IMAGE_CLAUSES]);;
(* ------------------------------------------------------------------------- *)
(* Formula without particular free variable. *)
(* ------------------------------------------------------------------------- *)
let ISAFFORM = prove
(`isafform m (
NPAIR 0 0) /\
isafform m (
NPAIR 0 1) /\
(isafterm m s /\ isafterm m t ==> isafform m (
NPAIR 1 (
NPAIR s t))) /\
(isafterm m s /\ isafterm m t ==> isafform m (
NPAIR 2 (
NPAIR s t))) /\
(isafterm m s /\ isafterm m t ==> isafform m (
NPAIR 3 (
NPAIR s t))) /\
(isafform m p ==> isafform m (
NPAIR 4 p)) /\
(isafform m p /\ isafform m q ==> isafform m (
NPAIR 5 (
NPAIR p q))) /\
(isafform m p /\ isafform m q ==> isafform m (
NPAIR 6 (
NPAIR p q))) /\
(isafform m p /\ isafform m q ==> isafform m (
NPAIR 7 (
NPAIR p q))) /\
(isafform m p /\ isafform m q ==> isafform m (
NPAIR 8 (
NPAIR p q))) /\
(isafform m p ==> isafform m (
NPAIR 9 (
NPAIR x p))) /\
(isafform m p ==> isafform m (
NPAIR 10 (
NPAIR x p))) /\
(isagform p ==> isafform m (
NPAIR 9 (
NPAIR m p))) /\
(isagform p ==> isafform m (
NPAIR 10 (
NPAIR m p)))`,
let tac0 = DISCH_THEN(X_CHOOSE_THEN `p:form` STRIP_ASSUME_TAC)
and tac1 =
DISCH_THEN(CONJUNCTS_THEN2
(X_CHOOSE_THEN `s:term` STRIP_ASSUME_TAC)
(X_CHOOSE_THEN `t:term` STRIP_ASSUME_TAC))
and tac2 =
DISCH_THEN(CONJUNCTS_THEN2
(X_CHOOSE_THEN `p:form` STRIP_ASSUME_TAC)
(X_CHOOSE_THEN `q:form` STRIP_ASSUME_TAC)) in
REWRITE_TAC[isafform; gform; isagform; isafterm] THEN REPEAT CONJ_TAC THENL
[EXISTS_TAC `False`;
EXISTS_TAC `True`;
tac1 THEN EXISTS_TAC `s === t`;
tac1 THEN EXISTS_TAC `s << t`;
tac1 THEN EXISTS_TAC `s <<= t`;
tac0 THEN EXISTS_TAC `Not p`;
tac2 THEN EXISTS_TAC `p && q`;
tac2 THEN EXISTS_TAC `p || q`;
tac2 THEN EXISTS_TAC `p --> q`;
tac2 THEN EXISTS_TAC `p <-> q`;
tac0 THEN EXISTS_TAC `!!(denumber x) p`;
tac0 THEN EXISTS_TAC `??(denumber x) p`;
tac0 THEN EXISTS_TAC `!!(denumber m) p`;
tac0 THEN EXISTS_TAC `??(denumber m) p`] THEN
ASM_REWRITE_TAC[
FV;
IN_DELETE;
NOT_IN_EMPTY;
IN_SING;
IN_UNION; gform;
NUMBER_DENUMBER;
IMAGE_CLAUSES;
IMAGE_UNION] THEN
ASM SET_TAC[
NUMBER_DENUMBER]);;
(* ------------------------------------------------------------------------- *)
(* 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';;
let ARITH_PROV1 = prove
(`(!v t. holds v (A t) <=> Ax(termval v t))
==> (!v s t.
holds v (arith_prov1 A s t) <=>
PROV1 Ax (termval v s) (termval v t))`,
(* ------------------------------------------------------------------------- *)
(* Our final conclusion. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* The crudest conclusion: truth undefinable, provability not, so: *)
(* ------------------------------------------------------------------------- *)