268 Goal "q * qinv (q) = prat_of_pnat (Abs_pnat 1)"; |
268 Goal "q * qinv (q) = prat_of_pnat (Abs_pnat 1)"; |
269 by (rtac (prat_mult_commute RS subst) 1); |
269 by (rtac (prat_mult_commute RS subst) 1); |
270 by (simp_tac (simpset() addsimps [prat_mult_qinv]) 1); |
270 by (simp_tac (simpset() addsimps [prat_mult_qinv]) 1); |
271 qed "prat_mult_qinv_right"; |
271 qed "prat_mult_qinv_right"; |
272 |
272 |
273 Goal "? y. (x::prat) * y = prat_of_pnat (Abs_pnat 1)"; |
273 Goal "EX y. (x::prat) * y = prat_of_pnat (Abs_pnat 1)"; |
274 by (fast_tac (claset() addIs [prat_mult_qinv_right]) 1); |
274 by (fast_tac (claset() addIs [prat_mult_qinv_right]) 1); |
275 qed "prat_qinv_ex"; |
275 qed "prat_qinv_ex"; |
276 |
276 |
277 Goal "?! y. (x::prat) * y = prat_of_pnat (Abs_pnat 1)"; |
277 Goal "EX! y. (x::prat) * y = prat_of_pnat (Abs_pnat 1)"; |
278 by (auto_tac (claset() addIs [prat_mult_qinv_right],simpset())); |
278 by (auto_tac (claset() addIs [prat_mult_qinv_right],simpset())); |
279 by (dres_inst_tac [("f","%x. ya*x")] arg_cong 1); |
279 by (dres_inst_tac [("f","%x. ya*x")] arg_cong 1); |
280 by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc RS sym]) 1); |
280 by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc RS sym]) 1); |
281 by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, |
281 by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, |
282 prat_mult_1,prat_mult_1_right]) 1); |
282 prat_mult_1,prat_mult_1_right]) 1); |
283 qed "prat_qinv_ex1"; |
283 qed "prat_qinv_ex1"; |
284 |
284 |
285 Goal "?! y. y * (x::prat) = prat_of_pnat (Abs_pnat 1)"; |
285 Goal "EX! y. y * (x::prat) = prat_of_pnat (Abs_pnat 1)"; |
286 by (auto_tac (claset() addIs [prat_mult_qinv],simpset())); |
286 by (auto_tac (claset() addIs [prat_mult_qinv],simpset())); |
287 by (dres_inst_tac [("f","%x. x*ya")] arg_cong 1); |
287 by (dres_inst_tac [("f","%x. x*ya")] arg_cong 1); |
288 by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc]) 1); |
288 by (asm_full_simp_tac (simpset() addsimps [prat_mult_assoc]) 1); |
289 by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, |
289 by (asm_full_simp_tac (simpset() addsimps [prat_mult_commute, |
290 prat_mult_1,prat_mult_1_right]) 1); |
290 prat_mult_1,prat_mult_1_right]) 1); |
294 by (cut_inst_tac [("q","y")] prat_mult_qinv 1); |
294 by (cut_inst_tac [("q","y")] prat_mult_qinv 1); |
295 by (res_inst_tac [("x1","y")] (prat_qinv_left_ex1 RS ex1E) 1); |
295 by (res_inst_tac [("x1","y")] (prat_qinv_left_ex1 RS ex1E) 1); |
296 by (Blast_tac 1); |
296 by (Blast_tac 1); |
297 qed "prat_mult_inv_qinv"; |
297 qed "prat_mult_inv_qinv"; |
298 |
298 |
299 Goal "? y. x = qinv y"; |
299 Goal "EX y. x = qinv y"; |
300 by (cut_inst_tac [("x","x")] prat_qinv_ex 1); |
300 by (cut_inst_tac [("x","x")] prat_qinv_ex 1); |
301 by (etac exE 1 THEN dtac prat_mult_inv_qinv 1); |
301 by (etac exE 1 THEN dtac prat_mult_inv_qinv 1); |
302 by (Fast_tac 1); |
302 by (Fast_tac 1); |
303 qed "prat_as_inverse_ex"; |
303 qed "prat_as_inverse_ex"; |
304 |
304 |
384 |
384 |
385 (* [| x < y; ~P ==> y < x |] ==> P *) |
385 (* [| x < y; ~P ==> y < x |] ==> P *) |
386 bind_thm ("prat_less_asym", prat_less_not_sym RS swap); |
386 bind_thm ("prat_less_asym", prat_less_not_sym RS swap); |
387 |
387 |
388 (* half of positive fraction exists- Gleason p. 120- Proposition 9-2.6(i)*) |
388 (* half of positive fraction exists- Gleason p. 120- Proposition 9-2.6(i)*) |
389 Goal "!(q::prat). ? x. x + x = q"; |
389 Goal "!(q::prat). EX x. x + x = q"; |
390 by (rtac allI 1); |
390 by (rtac allI 1); |
391 by (res_inst_tac [("z","q")] eq_Abs_prat 1); |
391 by (res_inst_tac [("z","q")] eq_Abs_prat 1); |
392 by (res_inst_tac [("x","Abs_prat (ratrel ^^ {(x, y+y)})")] exI 1); |
392 by (res_inst_tac [("x","Abs_prat (ratrel ^^ {(x, y+y)})")] exI 1); |
393 by (auto_tac (claset(), |
393 by (auto_tac (claset(), |
394 simpset() addsimps |
394 simpset() addsimps |
395 [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, |
395 [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, |
396 pnat_add_mult_distrib2])); |
396 pnat_add_mult_distrib2])); |
397 qed "lemma_prat_dense"; |
397 qed "lemma_prat_dense"; |
398 |
398 |
399 Goal "? (x::prat). x + x = q"; |
399 Goal "EX (x::prat). x + x = q"; |
400 by (res_inst_tac [("z","q")] eq_Abs_prat 1); |
400 by (res_inst_tac [("z","q")] eq_Abs_prat 1); |
401 by (res_inst_tac [("x","Abs_prat (ratrel ^^ {(x, y+y)})")] exI 1); |
401 by (res_inst_tac [("x","Abs_prat (ratrel ^^ {(x, y+y)})")] exI 1); |
402 by (auto_tac (claset(),simpset() addsimps |
402 by (auto_tac (claset(),simpset() addsimps |
403 [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, |
403 [prat_add,pnat_mult_assoc RS sym,pnat_add_mult_distrib, |
404 pnat_add_mult_distrib2])); |
404 pnat_add_mult_distrib2])); |
405 qed "prat_lemma_dense"; |
405 qed "prat_lemma_dense"; |
406 |
406 |
407 (* there exists a number between any two positive fractions *) |
407 (* there exists a number between any two positive fractions *) |
408 (* Gleason p. 120- Proposition 9-2.6(iv) *) |
408 (* Gleason p. 120- Proposition 9-2.6(iv) *) |
409 Goalw [prat_less_def] |
409 Goalw [prat_less_def] |
410 "!! (q1::prat). q1 < q2 ==> ? x. q1 < x & x < q2"; |
410 "!! (q1::prat). q1 < q2 ==> EX x. q1 < x & x < q2"; |
411 by (auto_tac (claset() addIs [lemma_prat_dense],simpset())); |
411 by (auto_tac (claset() addIs [lemma_prat_dense],simpset())); |
412 by (res_inst_tac [("x","T")] (lemma_prat_dense RS allE) 1); |
412 by (res_inst_tac [("x","T")] (lemma_prat_dense RS allE) 1); |
413 by (etac exE 1); |
413 by (etac exE 1); |
414 by (res_inst_tac [("x","q1 + x")] exI 1); |
414 by (res_inst_tac [("x","q1 + x")] exI 1); |
415 by (auto_tac (claset() addIs [prat_lemma_dense], |
415 by (auto_tac (claset() addIs [prat_lemma_dense], |
440 by (auto_tac (claset() addDs [prat_mult_less2_mono1], |
440 by (auto_tac (claset() addDs [prat_mult_less2_mono1], |
441 simpset() addsimps [prat_mult_commute])); |
441 simpset() addsimps [prat_mult_commute])); |
442 qed "prat_mult_left_less2_mono1"; |
442 qed "prat_mult_left_less2_mono1"; |
443 |
443 |
444 (* there is no smallest positive fraction *) |
444 (* there is no smallest positive fraction *) |
445 Goalw [prat_less_def] "? (x::prat). x < y"; |
445 Goalw [prat_less_def] "EX (x::prat). x < y"; |
446 by (cut_facts_tac [lemma_prat_dense] 1); |
446 by (cut_facts_tac [lemma_prat_dense] 1); |
447 by (Fast_tac 1); |
447 by (Fast_tac 1); |
448 qed "qless_Ex"; |
448 qed "qless_Ex"; |
449 |
449 |
450 (* lemma for proving $< is linear *) |
450 (* lemma for proving $< is linear *) |
763 |
763 |
764 (*** prove witness that will be required to prove non-emptiness ***) |
764 (*** prove witness that will be required to prove non-emptiness ***) |
765 (*** of preal type as defined using Dedekind Sections in PReal ***) |
765 (*** of preal type as defined using Dedekind Sections in PReal ***) |
766 (*** Show that exists positive real `one' ***) |
766 (*** Show that exists positive real `one' ***) |
767 |
767 |
768 Goal "? q. q: {x::prat. x < prat_of_pnat (Abs_pnat 1)}"; |
768 Goal "EX q. q: {x::prat. x < prat_of_pnat (Abs_pnat 1)}"; |
769 by (fast_tac (claset() addIs [prat_less_qinv_2_1]) 1); |
769 by (fast_tac (claset() addIs [prat_less_qinv_2_1]) 1); |
770 qed "lemma_prat_less_1_memEx"; |
770 qed "lemma_prat_less_1_memEx"; |
771 |
771 |
772 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} ~= {}"; |
772 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} ~= {}"; |
773 by (rtac notI 1); |
773 by (rtac notI 1); |
779 by (asm_full_simp_tac (simpset() addsimps |
779 by (asm_full_simp_tac (simpset() addsimps |
780 [lemma_prat_less_1_set_non_empty RS not_sym]) 1); |
780 [lemma_prat_less_1_set_non_empty RS not_sym]) 1); |
781 qed "empty_set_psubset_lemma_prat_less_1_set"; |
781 qed "empty_set_psubset_lemma_prat_less_1_set"; |
782 |
782 |
783 (*** exists rational not in set --- prat_of_pnat (Abs_pnat 1) itself ***) |
783 (*** exists rational not in set --- prat_of_pnat (Abs_pnat 1) itself ***) |
784 Goal "? q. q ~: {x::prat. x < prat_of_pnat (Abs_pnat 1)}"; |
784 Goal "EX q. q ~: {x::prat. x < prat_of_pnat (Abs_pnat 1)}"; |
785 by (res_inst_tac [("x","prat_of_pnat (Abs_pnat 1)")] exI 1); |
785 by (res_inst_tac [("x","prat_of_pnat (Abs_pnat 1)")] exI 1); |
786 by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl])); |
786 by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl])); |
787 qed "lemma_prat_less_1_not_memEx"; |
787 qed "lemma_prat_less_1_not_memEx"; |
788 |
788 |
789 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} ~= UNIV"; |
789 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} ~= UNIV"; |
801 |
801 |
802 (*** prove non_emptiness of type ***) |
802 (*** prove non_emptiness of type ***) |
803 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} : {A. {} < A & \ |
803 Goal "{x::prat. x < prat_of_pnat (Abs_pnat 1)} : {A. {} < A & \ |
804 \ A < UNIV & \ |
804 \ A < UNIV & \ |
805 \ (!y: A. ((!z. z < y --> z: A) & \ |
805 \ (!y: A. ((!z. z < y --> z: A) & \ |
806 \ (? u: A. y < u)))}"; |
806 \ (EX u: A. y < u)))}"; |
807 by (auto_tac (claset() addDs [prat_less_trans], |
807 by (auto_tac (claset() addDs [prat_less_trans], |
808 simpset() addsimps [empty_set_psubset_lemma_prat_less_1_set, |
808 simpset() addsimps [empty_set_psubset_lemma_prat_less_1_set, |
809 lemma_prat_less_1_set_psubset_rat_set])); |
809 lemma_prat_less_1_set_psubset_rat_set])); |
810 by (dtac prat_dense 1); |
810 by (dtac prat_dense 1); |
811 by (Fast_tac 1); |
811 by (Fast_tac 1); |