src/HOL/Real/PNat.ML
changeset 9108 9fff97d29837
parent 9043 ca761fe227d8
child 9422 4b6bc2b347e5
equal deleted inserted replaced
9107:67202a50ee6d 9108:9fff97d29837
     8 
     8 
     9 Goal "mono(%X. {1} Un (Suc``X))";
     9 Goal "mono(%X. {1} Un (Suc``X))";
    10 by (REPEAT (ares_tac [monoI, subset_refl, image_mono, Un_mono] 1));
    10 by (REPEAT (ares_tac [monoI, subset_refl, image_mono, Un_mono] 1));
    11 qed "pnat_fun_mono";
    11 qed "pnat_fun_mono";
    12 
    12 
    13 val pnat_unfold = pnat_fun_mono RS (pnat_def RS def_lfp_Tarski);
    13 bind_thm ("pnat_unfold", pnat_fun_mono RS (pnat_def RS def_lfp_Tarski));
    14 
    14 
    15 Goal "1 : pnat";
    15 Goal "1 : pnat";
    16 by (stac pnat_unfold 1);
    16 by (stac pnat_unfold 1);
    17 by (rtac (singletonI RS UnI1) 1);
    17 by (rtac (singletonI RS UnI1) 1);
    18 qed "one_RepI";
    18 qed "one_RepI";
   142 bind_thm ("one_not_pSuc", pSuc_not_one RS not_sym);
   142 bind_thm ("one_not_pSuc", pSuc_not_one RS not_sym);
   143 
   143 
   144 AddIffs [pSuc_not_one,one_not_pSuc];
   144 AddIffs [pSuc_not_one,one_not_pSuc];
   145 
   145 
   146 bind_thm ("pSuc_neq_one", (pSuc_not_one RS notE));
   146 bind_thm ("pSuc_neq_one", (pSuc_not_one RS notE));
   147 val one_neq_pSuc = sym RS pSuc_neq_one;
   147 bind_thm ("one_neq_pSuc", pSuc_neq_one RS pSuc_neq_one);
   148 
   148 
   149 (** Injectiveness of pSuc **)
   149 (** Injectiveness of pSuc **)
   150 
   150 
   151 Goalw [pnat_Suc_def] "inj(pSuc)";
   151 Goalw [pnat_Suc_def] "inj(pSuc)";
   152 by (rtac injI 1);
   152 by (rtac injI 1);
   154 by (REPEAT (resolve_tac [Rep_pnat, pnat_Suc_RepI] 1));
   154 by (REPEAT (resolve_tac [Rep_pnat, pnat_Suc_RepI] 1));
   155 by (dtac (inj_Suc RS injD) 1);
   155 by (dtac (inj_Suc RS injD) 1);
   156 by (etac (inj_Rep_pnat RS injD) 1);
   156 by (etac (inj_Rep_pnat RS injD) 1);
   157 qed "inj_pSuc"; 
   157 qed "inj_pSuc"; 
   158 
   158 
   159 val pSuc_inject = inj_pSuc RS injD;
   159 bind_thm ("pSuc_inject", inj_pSuc RS injD);
   160 
   160 
   161 Goal "(pSuc(m)=pSuc(n)) = (m=n)";
   161 Goal "(pSuc(m)=pSuc(n)) = (m=n)";
   162 by (EVERY1 [rtac iffI, etac pSuc_inject, etac arg_cong]); 
   162 by (EVERY1 [rtac iffI, etac pSuc_inject, etac arg_cong]); 
   163 qed "pSuc_pSuc_eq";
   163 qed "pSuc_pSuc_eq";
   164 
   164 
   207 by (simp_tac (simpset() addsimps [sum_Rep_pnat RS 
   207 by (simp_tac (simpset() addsimps [sum_Rep_pnat RS 
   208           Abs_pnat_inverse,add_left_commute]) 1);
   208           Abs_pnat_inverse,add_left_commute]) 1);
   209 qed "pnat_add_left_commute";
   209 qed "pnat_add_left_commute";
   210 
   210 
   211 (*Addition is an AC-operator*)
   211 (*Addition is an AC-operator*)
   212 val pnat_add_ac = [pnat_add_assoc, pnat_add_commute, pnat_add_left_commute];
   212 bind_thms ("pnat_add_ac", [pnat_add_assoc, pnat_add_commute, pnat_add_left_commute]);
   213 
   213 
   214 Goalw [pnat_add_def] "((x::pnat) + y = x + z) = (y = z)";
   214 Goalw [pnat_add_def] "((x::pnat) + y = x + z) = (y = z)";
   215 by (auto_tac (claset() addDs [inj_on_Abs_pnat RS inj_onD,
   215 by (auto_tac (claset() addDs [inj_on_Abs_pnat RS inj_onD,
   216      inj_Rep_pnat RS injD],simpset() addsimps [sum_Rep_pnat]));
   216      inj_Rep_pnat RS injD],simpset() addsimps [sum_Rep_pnat]));
   217 qed "pnat_add_left_cancel";
   217 qed "pnat_add_left_cancel";
   304 
   304 
   305 Goalw [pnat_le_def] "(x::pnat) <= y ==> ~ y < x";
   305 Goalw [pnat_le_def] "(x::pnat) <= y ==> ~ y < x";
   306 by (assume_tac 1);
   306 by (assume_tac 1);
   307 qed "pnat_leD";
   307 qed "pnat_leD";
   308 
   308 
   309 val pnat_leE = make_elim pnat_leD;
   309 bind_thm ("pnat_leE", make_elim pnat_leD);
   310 
   310 
   311 Goal "(~ (x::pnat) < y) = (y <= x)";
   311 Goal "(~ (x::pnat) < y) = (y <= x)";
   312 by (blast_tac (claset() addIs [pnat_leI] addEs [pnat_leE]) 1);
   312 by (blast_tac (claset() addIs [pnat_leI] addEs [pnat_leE]) 1);
   313 qed "pnat_not_less_iff_le";
   313 qed "pnat_not_less_iff_le";
   314 
   314 
   592 by (full_simp_tac (simpset() addsimps [pnat_mult_1,
   592 by (full_simp_tac (simpset() addsimps [pnat_mult_1,
   593                    pnat_mult_commute]) 1);
   593                    pnat_mult_commute]) 1);
   594 qed "pnat_mult_1_left";
   594 qed "pnat_mult_1_left";
   595 
   595 
   596 (*Multiplication is an AC-operator*)
   596 (*Multiplication is an AC-operator*)
   597 val pnat_mult_ac = [pnat_mult_assoc, pnat_mult_commute, pnat_mult_left_commute];
   597 bind_thms ("pnat_mult_ac", [pnat_mult_assoc, pnat_mult_commute, pnat_mult_left_commute]);
   598 
   598 
   599 Goal "!!i j k::pnat. i<=j ==> i * k <= j * k";
   599 Goal "!!i j k::pnat. i<=j ==> i * k <= j * k";
   600 by (asm_full_simp_tac (simpset() addsimps [pnat_le_iff_Rep_pnat_le,
   600 by (asm_full_simp_tac (simpset() addsimps [pnat_le_iff_Rep_pnat_le,
   601                      mult_Rep_pnat_mult RS sym,mult_le_mono1]) 1);
   601                      mult_Rep_pnat_mult RS sym,mult_le_mono1]) 1);
   602 qed "pnat_mult_le_mono1";
   602 qed "pnat_mult_le_mono1";