src/HOL/Real/PNat.ML
changeset 9043 ca761fe227d8
parent 8866 9ac6a18d363b
child 9108 9fff97d29837
equal deleted inserted replaced
9042:4d4521cbbcca 9043:ca761fe227d8
   287 Goalw [le_def] "1 <= Rep_pnat x";
   287 Goalw [le_def] "1 <= Rep_pnat x";
   288 by (rtac Rep_pnat_not_less_one 1);
   288 by (rtac Rep_pnat_not_less_one 1);
   289 qed "Rep_pnat_le_one";
   289 qed "Rep_pnat_le_one";
   290 
   290 
   291 Goalw [pnat_less_def]
   291 Goalw [pnat_less_def]
   292      "!! (z1::nat). z1 < z2  ==> ? z3. z1 + Rep_pnat z3 = z2";
   292      "!! (z1::nat). z1 < z2  ==> EX z3. z1 + Rep_pnat z3 = z2";
   293 by (dtac less_imp_add_positive 1);
   293 by (dtac less_imp_add_positive 1);
   294 by (force_tac (claset() addSIs [Abs_pnat_inverse],
   294 by (force_tac (claset() addSIs [Abs_pnat_inverse],
   295 	       simpset() addsimps [Collect_pnat_gt_0]) 1);
   295 	       simpset() addsimps [Collect_pnat_gt_0]) 1);
   296 qed "lemma_less_ex_sum_Rep_pnat";
   296 qed "lemma_less_ex_sum_Rep_pnat";
   297 
   297 
   471 qed "pnat_less_add_eq_less";
   471 qed "pnat_less_add_eq_less";
   472 
   472 
   473 (* ordering on positive naturals in terms of existence of sum *)
   473 (* ordering on positive naturals in terms of existence of sum *)
   474 (* could provide alternative definition -- Gleason *)
   474 (* could provide alternative definition -- Gleason *)
   475 Goalw [pnat_less_def,pnat_add_def] 
   475 Goalw [pnat_less_def,pnat_add_def] 
   476       "(z1::pnat) < z2 = (? z3. z1 + z3 = z2)";
   476       "(z1::pnat) < z2 = (EX z3. z1 + z3 = z2)";
   477 by (rtac iffI 1);
   477 by (rtac iffI 1);
   478 by (res_inst_tac [("t","z2")] (Rep_pnat_inverse RS subst) 1);
   478 by (res_inst_tac [("t","z2")] (Rep_pnat_inverse RS subst) 1);
   479 by (dtac lemma_less_ex_sum_Rep_pnat 1);
   479 by (dtac lemma_less_ex_sum_Rep_pnat 1);
   480 by (etac exE 1 THEN res_inst_tac [("x","z3")] exI 1);
   480 by (etac exE 1 THEN res_inst_tac [("x","z3")] exI 1);
   481 by (auto_tac (claset(),simpset() addsimps [sum_Rep_pnat_sum,Rep_pnat_inverse]));
   481 by (auto_tac (claset(),simpset() addsimps [sum_Rep_pnat_sum,Rep_pnat_inverse]));
   482 by (res_inst_tac [("t","Rep_pnat z1")] (add_0_right RS subst) 1);
   482 by (res_inst_tac [("t","Rep_pnat z1")] (add_0_right RS subst) 1);
   483 by (auto_tac (claset(),simpset() addsimps [sum_Rep_pnat_sum RS sym,
   483 by (auto_tac (claset(),simpset() addsimps [sum_Rep_pnat_sum RS sym,
   484                Rep_pnat_gt_zero] delsimps [add_0_right]));
   484                Rep_pnat_gt_zero] delsimps [add_0_right]));
   485 qed "pnat_less_iff";
   485 qed "pnat_less_iff";
   486 
   486 
   487 Goal "(? (x::pnat). z1 + x = z2) | z1 = z2 \
   487 Goal "(EX (x::pnat). z1 + x = z2) | z1 = z2 \
   488 \          |(? x. z2 + x = z1)";
   488 \          |(EX x. z2 + x = z1)";
   489 by (cut_facts_tac [pnat_less_linear] 1);
   489 by (cut_facts_tac [pnat_less_linear] 1);
   490 by (asm_full_simp_tac (simpset() addsimps [pnat_less_iff]) 1);
   490 by (asm_full_simp_tac (simpset() addsimps [pnat_less_iff]) 1);
   491 qed "pnat_linear_Ex_eq";
   491 qed "pnat_linear_Ex_eq";
   492 
   492 
   493 Goal "!!(x::pnat). x + y = z ==> x < z";
   493 Goal "!!(x::pnat). x + y = z ==> x < z";