src/HOL/Old_Number_Theory/Residues.thy
changeset 61382 efac889fccbc
parent 58889 5b7a9633cfa8
child 64267 b9a1486e79be
equal deleted inserted replaced
61381:ddca85598c65 61382:efac889fccbc
     1 (*  Title:      HOL/Old_Number_Theory/Residues.thy
     1 (*  Title:      HOL/Old_Number_Theory/Residues.thy
     2     Authors:    Jeremy Avigad, David Gray, and Adam Kramer
     2     Authors:    Jeremy Avigad, David Gray, and Adam Kramer
     3 *)
     3 *)
     4 
     4 
     5 section {* Residue Sets *}
     5 section \<open>Residue Sets\<close>
     6 
     6 
     7 theory Residues
     7 theory Residues
     8 imports Int2
     8 imports Int2
     9 begin
     9 begin
    10 
    10 
    11 text {*
    11 text \<open>
    12   \medskip Define the residue of a set, the standard residue,
    12   \medskip Define the residue of a set, the standard residue,
    13   quadratic residues, and prove some basic properties. *}
    13   quadratic residues, and prove some basic properties.\<close>
    14 
    14 
    15 definition ResSet :: "int => int set => bool"
    15 definition ResSet :: "int => int set => bool"
    16   where "ResSet m X = (\<forall>y1 y2. (y1 \<in> X & y2 \<in> X & [y1 = y2] (mod m) --> y1 = y2))"
    16   where "ResSet m X = (\<forall>y1 y2. (y1 \<in> X & y2 \<in> X & [y1 = y2] (mod m) --> y1 = y2))"
    17 
    17 
    18 definition StandardRes :: "int => int => int"
    18 definition StandardRes :: "int => int => int"
    31 
    31 
    32 definition SRStar :: "int => int set"
    32 definition SRStar :: "int => int set"
    33   where "SRStar p = {x. (0 < x) & (x < p)}"
    33   where "SRStar p = {x. (0 < x) & (x < p)}"
    34 
    34 
    35 
    35 
    36 subsection {* Some useful properties of StandardRes *}
    36 subsection \<open>Some useful properties of StandardRes\<close>
    37 
    37 
    38 lemma StandardRes_prop1: "[x = StandardRes m x] (mod m)"
    38 lemma StandardRes_prop1: "[x = StandardRes m x] (mod m)"
    39   by (auto simp add: StandardRes_def zcong_zmod)
    39   by (auto simp add: StandardRes_def zcong_zmod)
    40 
    40 
    41 lemma StandardRes_prop2: "0 < m ==> (StandardRes m x1 = StandardRes m x2)
    41 lemma StandardRes_prop2: "0 < m ==> (StandardRes m x1 = StandardRes m x2)
    59 lemma StandardRes_eq_zcong: 
    59 lemma StandardRes_eq_zcong: 
    60    "(StandardRes m x = 0) = ([x = 0](mod m))"
    60    "(StandardRes m x = 0) = ([x = 0](mod m))"
    61   by (auto simp add: StandardRes_def zcong_eq_zdvd_prop dvd_def) 
    61   by (auto simp add: StandardRes_def zcong_eq_zdvd_prop dvd_def) 
    62 
    62 
    63 
    63 
    64 subsection {* Relations between StandardRes, SRStar, and SR *}
    64 subsection \<open>Relations between StandardRes, SRStar, and SR\<close>
    65 
    65 
    66 lemma SRStar_SR_prop: "x \<in> SRStar p ==> x \<in> SR p"
    66 lemma SRStar_SR_prop: "x \<in> SRStar p ==> x \<in> SR p"
    67   by (auto simp add: SRStar_def SR_def)
    67   by (auto simp add: SRStar_def SR_def)
    68 
    68 
    69 lemma StandardRes_SR_prop: "x \<in> SR p ==> StandardRes p x = x"
    69 lemma StandardRes_SR_prop: "x \<in> SR p ==> StandardRes p x = x"
   113 
   113 
   114 lemma SRStar_finite: "2 < p ==> finite( SRStar p)"
   114 lemma SRStar_finite: "2 < p ==> finite( SRStar p)"
   115   by (auto simp add: SRStar_def bdd_int_set_l_l_finite)
   115   by (auto simp add: SRStar_def bdd_int_set_l_l_finite)
   116 
   116 
   117 
   117 
   118 subsection {* Properties relating ResSets with StandardRes *}
   118 subsection \<open>Properties relating ResSets with StandardRes\<close>
   119 
   119 
   120 lemma aux: "x mod m = y mod m ==> [x = y] (mod m)"
   120 lemma aux: "x mod m = y mod m ==> [x = y] (mod m)"
   121   apply (subgoal_tac "x = y ==> [x = y](mod m)")
   121   apply (subgoal_tac "x = y ==> [x = y](mod m)")
   122   apply (subgoal_tac "[x mod m = y mod m] (mod m) ==> [x = y] (mod m)")
   122   apply (subgoal_tac "[x mod m = y mod m] (mod m) ==> [x = y] (mod m)")
   123   apply (auto simp add: zcong_zmod [of x y m])
   123   apply (auto simp add: zcong_zmod [of x y m])
   156   "[| 0 < m; ResSet m A; \<forall>x \<in> A. \<forall>y \<in> A. ([f x = f y](mod m) --> x = y) |] ==>
   156   "[| 0 < m; ResSet m A; \<forall>x \<in> A. \<forall>y \<in> A. ([f x = f y](mod m) --> x = y) |] ==>
   157     ResSet m (f ` A)"
   157     ResSet m (f ` A)"
   158   by (auto simp add: ResSet_def)
   158   by (auto simp add: ResSet_def)
   159 
   159 
   160 
   160 
   161 subsection {* Property for SRStar *}
   161 subsection \<open>Property for SRStar\<close>
   162 
   162 
   163 lemma ResSet_SRStar_prop: "ResSet p (SRStar p)"
   163 lemma ResSet_SRStar_prop: "ResSet p (SRStar p)"
   164   by (auto simp add: SRStar_def ResSet_def zcong_zless_imp_eq)
   164   by (auto simp add: SRStar_def ResSet_def zcong_zless_imp_eq)
   165 
   165 
   166 end
   166 end