src/HOL/Complex/NSInduct.ML
author kleing
Tue, 13 May 2003 08:59:21 +0200
changeset 14024 213dcc39358f
parent 13957 10dbf16be15f
child 14371 c78c7da09519
permissions -rw-r--r--
HOL-Real -> HOL-Complex
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13957
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     1
(*  Title:       NSInduct.ML
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     2
    Author:      Jacques D. Fleuriot
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     3
    Copyright:   2001  University of Edinburgh
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     4
    Description: Nonstandard characterization of induction etc.
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     5
*)
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     6
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     7
Goalw [starPNat_def]
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     8
"(( *pNat* P) (Abs_hypnat(hypnatrel``{%n. X n}))) = \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
     9
\     ({n. P (X n)} : FreeUltrafilterNat)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    10
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    11
by (Ultra_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    12
qed "starPNat";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    13
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    14
Goalw [hypnat_of_nat_def] "( *pNat* P) (hypnat_of_nat n) = P n";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    15
by (auto_tac (claset(),simpset() addsimps [starPNat]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    16
qed "starPNat_hypnat_of_nat";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    17
Addsimps [starPNat_hypnat_of_nat];
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    18
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    19
Goalw [hypnat_zero_def,hypnat_one_def]
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    20
    "!!P. (( *pNat* P) 0 &   \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    21
\           (ALL n. ( *pNat* P)(n) --> ( *pNat* P)(n + 1))) \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    22
\      --> ( *pNat* P)(n)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    23
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    24
by (auto_tac (claset(),simpset() addsimps [starPNat]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    25
by (Ultra_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    26
by (etac nat_induct 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    27
by (dres_inst_tac [("x","hypnat_of_nat n")] spec 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    28
by (rtac ccontr 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    29
by (auto_tac (claset(),simpset() addsimps [starPNat,
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    30
    hypnat_of_nat_def,hypnat_add]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    31
qed "hypnat_induct_obj";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    32
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    33
Goal
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    34
  "!!P. [| ( *pNat* P) 0;   \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    35
\        !!n. ( *pNat* P)(n) ==> ( *pNat* P)(n + 1)|] \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    36
\    ==> ( *pNat* P)(n)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    37
by (cut_inst_tac [("P","P"),("n","n")] hypnat_induct_obj 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    38
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    39
qed "hypnat_induct";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    40
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    41
fun hypnat_ind_tac a i = 
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    42
  res_inst_tac [("n",a)] hypnat_induct i  THEN  rename_last_tac a [""] (i+1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    43
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    44
Goalw [starPNat2_def]
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    45
"(( *pNat2* P) (Abs_hypnat(hypnatrel``{%n. X n})) \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    46
\            (Abs_hypnat(hypnatrel``{%n. Y n}))) = \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    47
\     ({n. P (X n) (Y n)} : FreeUltrafilterNat)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    48
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    49
by (Ultra_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    50
qed "starPNat2";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    51
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    52
Goalw [starPNat2_def] "( *pNat2* (op =)) = (op =)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    53
by (rtac ext 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    54
by (rtac ext 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    55
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    56
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    57
by (Auto_tac THEN Ultra_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    58
qed "starPNat2_eq_iff";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    59
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    60
Goal "( *pNat2* (%x y. x = y)) X Y = (X = Y)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    61
by (simp_tac (simpset() addsimps [starPNat2_eq_iff]) 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    62
qed "starPNat2_eq_iff2";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    63
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    64
Goal "(EX h. P(h::hypnat)) = (EX x. P(Abs_hypnat(hypnatrel `` {x})))";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    65
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    66
by (res_inst_tac [("z","h")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    67
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    68
val lemma_hyp = result();
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    69
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    70
Goal "(EX (v::nat=>nat). ALL (x::nat). P (g v) (f x)) = \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    71
\     (EX (v::nat=>nat). ALL x. EX f': Rep_hypnat(f x). P (g v) (Abs_hypnat(hypnatrel `` {f'})))"; 
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    72
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    73
by (ALLGOALS(res_inst_tac [("x","v")] exI));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    74
by (Step_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    75
by (ALLGOALS(res_inst_tac [("z","f x")] eq_Abs_hypnat));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    76
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    77
by (rtac bexI 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    78
by (dres_inst_tac [("x","x")] spec 3);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    79
by (dtac sym 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    80
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    81
by (subgoal_tac 
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    82
    "Abs_hypnat (hypnatrel `` {X}) = Abs_hypnat (hypnatrel `` {Y})" 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    83
by (Asm_simp_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    84
by (Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    85
val lemma_hyp2 = result();
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    86
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    87
Goalw [hSuc_def] "hSuc m ~= 0";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    88
by Auto_tac;
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    89
qed "hSuc_not_zero";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    90
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    91
bind_thm ("zero_not_hSuc", hSuc_not_zero RS not_sym);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    92
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    93
Goalw [hSuc_def,hypnat_one_def] 
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    94
      "(hSuc m = hSuc n) = (m = n)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    95
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    96
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    97
by (auto_tac (claset(),simpset() addsimps [hypnat_add]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    98
qed "hSuc_hSuc_eq";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
    99
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   100
AddIffs [hSuc_not_zero,zero_not_hSuc,hSuc_hSuc_eq];
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   101
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   102
Goalw [hypnat_le_def] "m <= (n::hypnat) | n <= m";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   103
by (auto_tac (claset() addDs [hypnat_less_trans],simpset()));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   104
qed "hypnat_le_linear";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   105
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   106
val hypnat_less_le = hypnat_less_imp_le;
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   107
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   108
Goal "c : (S :: nat set) ==> (LEAST n. n : S) : S";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   109
by (etac LeastI 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   110
qed "nonempty_nat_set_Least_mem";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   111
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   112
Goalw [InternalNatSets_def,starsetNat_n_def]
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   113
    "[| S : InternalNatSets; S ~= {} |] ==> EX n: S. ALL m: S. n <= m";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   114
by (auto_tac (claset(),simpset() addsimps [lemma_hyp]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   115
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   116
by (auto_tac (claset() addSDs [bspec],simpset() addsimps [hypnat_le]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   117
by (dres_inst_tac [("x","%m. LEAST n. n : As m")] spec 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   118
by Auto_tac;
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   119
by (ultra_tac (claset() addDs [nonempty_nat_set_Least_mem],simpset()) 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   120
by (dres_inst_tac [("x","x")] bspec 1 THEN Auto_tac);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   121
by (ultra_tac (claset() addIs [Least_le],simpset()) 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   122
qed "nonempty_InternalNatSet_has_least";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   123
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   124
(* Goldblatt p 129 Thm 11.3.2 *)
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   125
Goal "[| X : InternalNatSets; 0 : X; ALL n. n : X --> n + 1 : X |] \
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   126
\     ==> X = (UNIV:: hypnat set)";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   127
by (rtac ccontr 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   128
by (ftac InternalNatSets_Compl 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   129
by (dres_inst_tac [("S","- X")] nonempty_InternalNatSet_has_least 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   130
by Auto_tac;
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   131
by (subgoal_tac "1 <= n" 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   132
by (dres_inst_tac [("x","n - 1")] bspec 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   133
by (Step_tac 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   134
by (dres_inst_tac [("x","n - 1")] spec 1);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   135
by (dres_inst_tac [("x","1"),("q1.0","n")] hypnat_add_le_mono1 2);
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   136
by (auto_tac (claset(),simpset() addsimps [hypnat_le_def]));
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   137
qed "internal_induct";
10dbf16be15f new session Complex for the complex numbers
paulson
parents:
diff changeset
   138