src/HOL/RealDef.thy
changeset 31203 5c8fb4fd67e0
parent 31100 6a2e67fe4488
child 31641 feea4d3d743d
equal deleted inserted replaced
31202:52d332f8f909 31203:5c8fb4fd67e0
  1124   by (simp add: of_rat_inverse)
  1124   by (simp add: of_rat_inverse)
  1125  
  1125  
  1126 lemma real_divide_code [code]: "Ratreal x / Ratreal y = Ratreal (x / y)"
  1126 lemma real_divide_code [code]: "Ratreal x / Ratreal y = Ratreal (x / y)"
  1127   by (simp add: of_rat_divide)
  1127   by (simp add: of_rat_divide)
  1128 
  1128 
       
  1129 definition (in term_syntax)
       
  1130   valterm_ratreal :: "rat \<times> (unit \<Rightarrow> Code_Eval.term) \<Rightarrow> real \<times> (unit \<Rightarrow> Code_Eval.term)" where
       
  1131   [code inline]: "valterm_ratreal k = Code_Eval.valtermify Ratreal {\<cdot>} k"
       
  1132 
       
  1133 notation fcomp (infixl "o>" 60)
       
  1134 notation scomp (infixl "o\<rightarrow>" 60)
       
  1135 
       
  1136 instantiation real :: random
       
  1137 begin
       
  1138 
       
  1139 definition
       
  1140   "random i = random i o\<rightarrow> (\<lambda>r. Pair (valterm_ratreal r))"
       
  1141 
       
  1142 instance ..
       
  1143 
       
  1144 end
       
  1145 
       
  1146 no_notation fcomp (infixl "o>" 60)
       
  1147 no_notation scomp (infixl "o\<rightarrow>" 60)
       
  1148 
  1129 text {* Setup for SML code generator *}
  1149 text {* Setup for SML code generator *}
  1130 
  1150 
  1131 types_code
  1151 types_code
  1132   real ("(int */ int)")
  1152   real ("(int */ int)")
  1133 attach (term_of) {*
  1153 attach (term_of) {*