src/HOL/Rat.thy
changeset 38857 97775f3e8722
parent 38287 796302ca3611
child 39910 10097e0a9dbd
equal deleted inserted replaced
38856:168dba35ecf3 38857:97775f3e8722
  1081 proof (cases p)
  1081 proof (cases p)
  1082   case (Fract a b) then show ?thesis
  1082   case (Fract a b) then show ?thesis
  1083   by (cases "0::int" a rule: linorder_cases) (simp_all add: quotient_of_Fract)
  1083   by (cases "0::int" a rule: linorder_cases) (simp_all add: quotient_of_Fract)
  1084 qed
  1084 qed
  1085 
  1085 
  1086 instantiation rat :: eq
  1086 instantiation rat :: equal
  1087 begin
  1087 begin
  1088 
  1088 
  1089 definition [code]:
  1089 definition [code]:
  1090   "eq_class.eq a b \<longleftrightarrow> quotient_of a = quotient_of b"
  1090   "HOL.equal a b \<longleftrightarrow> quotient_of a = quotient_of b"
  1091 
  1091 
  1092 instance proof
  1092 instance proof
  1093 qed (simp add: eq_rat_def quotient_of_inject_eq)
  1093 qed (simp add: equal_rat_def quotient_of_inject_eq)
  1094 
  1094 
  1095 lemma rat_eq_refl [code nbe]:
  1095 lemma rat_eq_refl [code nbe]:
  1096   "eq_class.eq (r::rat) r \<longleftrightarrow> True"
  1096   "HOL.equal (r::rat) r \<longleftrightarrow> True"
  1097   by (rule HOL.eq_refl)
  1097   by (rule equal_refl)
  1098 
  1098 
  1099 end
  1099 end
  1100 
  1100 
  1101 lemma rat_less_eq_code [code]:
  1101 lemma rat_less_eq_code [code]:
  1102   "p \<le> q \<longleftrightarrow> (let (a, c) = quotient_of p; (b, d) = quotient_of q in a * d \<le> c * b)"
  1102   "p \<le> q \<longleftrightarrow> (let (a, c) = quotient_of p; (b, d) = quotient_of q in a * d \<le> c * b)"