src/HOL/ex/Locales.thy
changeset 12937 0c4fd7529467
parent 12574 ff84d5f14085
child 12955 f4d60f358cb6
equal deleted inserted replaced
12936:84eb6c75cfe3 12937:0c4fd7529467
   141   context elements (parameters, assumptions, etc.) in a casual manner;
   141   context elements (parameters, assumptions, etc.) in a casual manner;
   142   these are discharged when the proof is finished.
   142   these are discharged when the proof is finished.
   143 *}
   143 *}
   144 
   144 
   145 theorem (in group_context)
   145 theorem (in group_context)
   146   (assumes eq: "e \<cdot> x = x")
   146   assumes eq: "e \<cdot> x = x"
   147   one_equality: "\<one> = e"
   147   shows one_equality: "\<one> = e"
   148 proof -
   148 proof -
   149   have "\<one> = x \<cdot> x\<inv>" by (simp only: right_inv)
   149   have "\<one> = x \<cdot> x\<inv>" by (simp only: right_inv)
   150   also have "\<dots> = (e \<cdot> x) \<cdot> x\<inv>" by (simp only: eq)
   150   also have "\<dots> = (e \<cdot> x) \<cdot> x\<inv>" by (simp only: eq)
   151   also have "\<dots> = e \<cdot> (x \<cdot> x\<inv>)" by (simp only: assoc)
   151   also have "\<dots> = e \<cdot> (x \<cdot> x\<inv>)" by (simp only: assoc)
   152   also have "\<dots> = e \<cdot> \<one>" by (simp only: right_inv)
   152   also have "\<dots> = e \<cdot> \<one>" by (simp only: right_inv)
   153   also have "\<dots> = e" by (simp only: right_one)
   153   also have "\<dots> = e" by (simp only: right_one)
   154   finally show ?thesis .
   154   finally show ?thesis .
   155 qed
   155 qed
   156 
   156 
   157 theorem (in group_context)
   157 theorem (in group_context)
   158   (assumes eq: "x' \<cdot> x = \<one>")
   158   assumes eq: "x' \<cdot> x = \<one>"
   159   inv_equality: "x\<inv> = x'"
   159   shows inv_equality: "x\<inv> = x'"
   160 proof -
   160 proof -
   161   have "x\<inv> = \<one> \<cdot> x\<inv>" by (simp only: left_one)
   161   have "x\<inv> = \<one> \<cdot> x\<inv>" by (simp only: left_one)
   162   also have "\<dots> = (x' \<cdot> x) \<cdot> x\<inv>" by (simp only: eq)
   162   also have "\<dots> = (x' \<cdot> x) \<cdot> x\<inv>" by (simp only: eq)
   163   also have "\<dots> = x' \<cdot> (x \<cdot> x\<inv>)" by (simp only: assoc)
   163   also have "\<dots> = x' \<cdot> (x \<cdot> x\<inv>)" by (simp only: assoc)
   164   also have "\<dots> = x' \<cdot> \<one>" by (simp only: right_inv)
   164   also have "\<dots> = x' \<cdot> \<one>" by (simp only: right_inv)
   212 proof (rule inv_equality)
   212 proof (rule inv_equality)
   213   show "x \<cdot> x\<inv> = \<one>" by (simp only: right_inv)
   213   show "x \<cdot> x\<inv> = \<one>" by (simp only: right_inv)
   214 qed
   214 qed
   215 
   215 
   216 theorem (in group_context)
   216 theorem (in group_context)
   217   (assumes eq: "x\<inv> = y\<inv>")
   217   assumes eq: "x\<inv> = y\<inv>"
   218   inv_inject: "x = y"
   218   shows inv_inject: "x = y"
   219 proof -
   219 proof -
   220   have "x = x \<cdot> \<one>" by (simp only: right_one)
   220   have "x = x \<cdot> \<one>" by (simp only: right_one)
   221   also have "\<dots> = x \<cdot> (y\<inv> \<cdot> y)" by (simp only: left_inv)
   221   also have "\<dots> = x \<cdot> (y\<inv> \<cdot> y)" by (simp only: left_inv)
   222   also have "\<dots> = x \<cdot> (x\<inv> \<cdot> y)" by (simp only: eq)
   222   also have "\<dots> = x \<cdot> (x\<inv> \<cdot> y)" by (simp only: eq)
   223   also have "\<dots> = (x \<cdot> x\<inv>) \<cdot> y" by (simp only: assoc)
   223   also have "\<dots> = (x \<cdot> x\<inv>) \<cdot> y" by (simp only: assoc)
   333   The following synthetic example demonstrates how to refer to several
   333   The following synthetic example demonstrates how to refer to several
   334   structures of type @{text group} succinctly.  We work with two
   334   structures of type @{text group} succinctly.  We work with two
   335   versions of the @{text group} locale above.
   335   versions of the @{text group} locale above.
   336 *}
   336 *}
   337 
   337 
   338 lemma (uses group G + group H)
   338 lemma
   339   "x \<cdot> y \<cdot> \<one> = prod G (prod G x y) (one G)" and
   339   uses group G + group H
       
   340   shows "x \<cdot> y \<cdot> \<one> = prod G (prod G x y) (one G)" and
   340   "x \<cdot>\<^sub>2 y \<cdot>\<^sub>2 \<one>\<^sub>2 = prod H (prod H x y) (one H)" and
   341   "x \<cdot>\<^sub>2 y \<cdot>\<^sub>2 \<one>\<^sub>2 = prod H (prod H x y) (one H)" and
   341   "x \<cdot> \<one>\<^sub>2 = prod G x (one H)" by (rule refl)+
   342   "x \<cdot> \<one>\<^sub>2 = prod G x (one H)" by (rule refl)+
   342 
   343 
   343 text {*
   344 text {*
   344   Note that the trivial statements above need to be given as a
   345   Note that the trivial statements above need to be given as a