src/HOL/Real/RealDef.ML
changeset 9391 a6ab3a442da6
parent 9369 139fde7af7bd
child 9422 4b6bc2b347e5
equal deleted inserted replaced
9390:e6b96d953965 9391:a6ab3a442da6
    50 by (pair_tac "x" 1);
    50 by (pair_tac "x" 1);
    51 by (rtac realrelI 1);
    51 by (rtac realrelI 1);
    52 by (rtac refl 1);
    52 by (rtac refl 1);
    53 qed "realrel_refl";
    53 qed "realrel_refl";
    54 
    54 
    55 Goalw [equiv_def, refl_def, sym_def, trans_def]
    55 Goalw [equiv_def, refl_def, sym_def, trans_def] "equiv UNIV realrel";
    56     "equiv {x::(preal*preal).True} realrel";
       
    57 by (fast_tac (claset() addSIs [realrel_refl] 
    56 by (fast_tac (claset() addSIs [realrel_refl] 
    58                       addSEs [sym,preal_trans_lemma]) 1);
    57                        addSEs [sym, preal_trans_lemma]) 1);
    59 qed "equiv_realrel";
    58 qed "equiv_realrel";
    60 
    59 
       
    60 (* (realrel ^^ {x} = realrel ^^ {y}) = ((x,y) : realrel) *)
    61 bind_thm ("equiv_realrel_iff",
    61 bind_thm ("equiv_realrel_iff",
    62     [TrueI, TrueI] MRS 
    62     	  [equiv_realrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff);
    63     ([CollectI, CollectI] MRS 
       
    64     (equiv_realrel RS eq_equiv_class_iff)));
       
    65 
    63 
    66 Goalw  [real_def,realrel_def,quotient_def] "realrel^^{(x,y)}:real";
    64 Goalw  [real_def,realrel_def,quotient_def] "realrel^^{(x,y)}:real";
    67 by (Blast_tac 1);
    65 by (Blast_tac 1);
    68 qed "realrel_in_real";
    66 qed "realrel_in_real";
    69 
    67 
   112   "congruent realrel (%p. (%(x,y). realrel^^{(y,x)}) p)";
   110   "congruent realrel (%p. (%(x,y). realrel^^{(y,x)}) p)";
   113 by Safe_tac;
   111 by Safe_tac;
   114 by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1);
   112 by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1);
   115 qed "real_minus_congruent";
   113 qed "real_minus_congruent";
   116 
   114 
   117 (*Resolve th against the corresponding facts for real_minus*)
       
   118 val real_minus_ize = RSLIST [equiv_realrel, real_minus_congruent];
       
   119 
       
   120 Goalw [real_minus_def]
   115 Goalw [real_minus_def]
   121       "- (Abs_real(realrel^^{(x,y)})) = Abs_real(realrel ^^ {(y,x)})";
   116       "- (Abs_real(realrel^^{(x,y)})) = Abs_real(realrel ^^ {(y,x)})";
   122 by (res_inst_tac [("f","Abs_real")] arg_cong 1);
   117 by (res_inst_tac [("f","Abs_real")] arg_cong 1);
   123 by (simp_tac (simpset() addsimps 
   118 by (simp_tac (simpset() addsimps 
   124    [realrel_in_real RS Abs_real_inverse,real_minus_ize UN_equiv_class]) 1);
   119    [realrel_in_real RS Abs_real_inverse,
       
   120     [equiv_realrel, real_minus_congruent] MRS UN_equiv_class]) 1);
   125 qed "real_minus";
   121 qed "real_minus";
   126 
   122 
   127 Goal "- (- z) = (z::real)";
   123 Goal "- (- z) = (z::real)";
   128 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   124 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   129 by (asm_simp_tac (simpset() addsimps [real_minus]) 1);
   125 by (asm_simp_tac (simpset() addsimps [real_minus]) 1);
   160 by (res_inst_tac [("z1.1","x1a")] (preal_add_left_commute RS ssubst) 1);
   156 by (res_inst_tac [("z1.1","x1a")] (preal_add_left_commute RS ssubst) 1);
   161 by (asm_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1);
   157 by (asm_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1);
   162 by (asm_simp_tac (simpset() addsimps preal_add_ac) 1);
   158 by (asm_simp_tac (simpset() addsimps preal_add_ac) 1);
   163 qed "real_add_congruent2";
   159 qed "real_add_congruent2";
   164 
   160 
   165 (*Resolve th against the corresponding facts for real_add*)
       
   166 val real_add_ize = RSLIST [equiv_realrel, real_add_congruent2];
       
   167 
       
   168 Goalw [real_add_def]
   161 Goalw [real_add_def]
   169   "Abs_real(realrel^^{(x1,y1)}) + Abs_real(realrel^^{(x2,y2)}) = \
   162   "Abs_real(realrel^^{(x1,y1)}) + Abs_real(realrel^^{(x2,y2)}) = \
   170 \  Abs_real(realrel^^{(x1+x2, y1+y2)})";
   163 \  Abs_real(realrel^^{(x1+x2, y1+y2)})";
   171 by (asm_simp_tac (simpset() addsimps [real_add_ize UN_equiv_class2]) 1);
   164 by (simp_tac (simpset() addsimps 
       
   165               [[equiv_realrel, real_add_congruent2] MRS UN_equiv_class2]) 1);
   172 qed "real_add";
   166 qed "real_add";
   173 
   167 
   174 Goal "(z::real) + w = w + z";
   168 Goal "(z::real) + w = w + z";
   175 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   169 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   176 by (res_inst_tac [("z","w")] eq_Abs_real 1);
   170 by (res_inst_tac [("z","w")] eq_Abs_real 1);
   327 by (rewtac split_def);
   321 by (rewtac split_def);
   328 by (asm_simp_tac (simpset() addsimps [preal_mult_commute,preal_add_commute]) 1);
   322 by (asm_simp_tac (simpset() addsimps [preal_mult_commute,preal_add_commute]) 1);
   329 by (auto_tac (claset(),simpset() addsimps [real_mult_congruent2_lemma]));
   323 by (auto_tac (claset(),simpset() addsimps [real_mult_congruent2_lemma]));
   330 qed "real_mult_congruent2";
   324 qed "real_mult_congruent2";
   331 
   325 
   332 (*Resolve th against the corresponding facts for real_mult*)
       
   333 val real_mult_ize = RSLIST [equiv_realrel, real_mult_congruent2];
       
   334 
       
   335 Goalw [real_mult_def]
   326 Goalw [real_mult_def]
   336    "Abs_real((realrel^^{(x1,y1)})) * Abs_real((realrel^^{(x2,y2)})) =   \
   327    "Abs_real((realrel^^{(x1,y1)})) * Abs_real((realrel^^{(x2,y2)})) =   \
   337 \   Abs_real(realrel ^^ {(x1*x2+y1*y2,x1*y2+x2*y1)})";
   328 \   Abs_real(realrel ^^ {(x1*x2+y1*y2,x1*y2+x2*y1)})";
   338 by (simp_tac (simpset() addsimps [real_mult_ize UN_equiv_class2]) 1);
   329 by (simp_tac (simpset() addsimps
       
   330                [[equiv_realrel, real_mult_congruent2] MRS UN_equiv_class2]) 1);
   339 qed "real_mult";
   331 qed "real_mult";
   340 
   332 
   341 Goal "(z::real) * w = w * z";
   333 Goal "(z::real) * w = w * z";
   342 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   334 by (res_inst_tac [("z","z")] eq_Abs_real 1);
   343 by (res_inst_tac [("z","w")] eq_Abs_real 1);
   335 by (res_inst_tac [("z","w")] eq_Abs_real 1);
   395 Goal "-(x * y) = (-x) * (y::real)";
   387 Goal "-(x * y) = (-x) * (y::real)";
   396 by (res_inst_tac [("z","x")] eq_Abs_real 1);
   388 by (res_inst_tac [("z","x")] eq_Abs_real 1);
   397 by (res_inst_tac [("z","y")] eq_Abs_real 1);
   389 by (res_inst_tac [("z","y")] eq_Abs_real 1);
   398 by (auto_tac (claset(),
   390 by (auto_tac (claset(),
   399 	      simpset() addsimps [real_minus,real_mult] 
   391 	      simpset() addsimps [real_minus,real_mult] 
   400     @ preal_mult_ac @ preal_add_ac));
   392                                  @ preal_mult_ac @ preal_add_ac));
   401 qed "real_minus_mult_eq1";
   393 qed "real_minus_mult_eq1";
   402 
   394 
   403 Goal "-(x * y) = x * (- y :: real)";
   395 Goal "-(x * y) = x * (- y :: real)";
   404 by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute,
   396 by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute,
   405 				  real_minus_mult_eq1]) 1);
   397 				  real_minus_mult_eq1]) 1);