src/HOL/Algebra/Congruence.thy
author haftmann
Fri, 01 Nov 2013 18:51:14 +0100
changeset 54230 b1d955791529
parent 44471 3c2b2c4a7c1c
child 61382 efac889fccbc
permissions -rw-r--r--
more simplification rules on unary and binary minus
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41959
b460124855b8 tuned headers;
wenzelm
parents: 40293
diff changeset
     1
(*  Title:      HOL/Algebra/Congruence.thy
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     2
    Author:     Clemens Ballarin, started 3 January 2008
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     3
    Copyright:  Clemens Ballarin
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
     4
*)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
     5
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     6
theory Congruence
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     7
imports Main
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     8
begin
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
     9
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    10
section {* Objects *}
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    11
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
    12
subsection {* Structure with Carrier Set. *}
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    13
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    14
record 'a partial_object =
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    15
  carrier :: "'a set"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    16
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
    17
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
    18
subsection {* Structure with Carrier and Equivalence Relation @{text eq} *}
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    19
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    20
record 'a eq_object = "'a partial_object" +
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    21
  eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl ".=\<index>" 50)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    22
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 35355
diff changeset
    23
definition
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    24
  elem :: "_ \<Rightarrow> 'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixl ".\<in>\<index>" 50)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    25
  where "x .\<in>\<^bsub>S\<^esub> A \<longleftrightarrow> (\<exists>y \<in> A. x .=\<^bsub>S\<^esub> y)"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    26
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 35355
diff changeset
    27
definition
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    28
  set_eq :: "_ \<Rightarrow> 'a set \<Rightarrow> 'a set \<Rightarrow> bool" (infixl "{.=}\<index>" 50)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    29
  where "A {.=}\<^bsub>S\<^esub> B \<longleftrightarrow> ((\<forall>x \<in> A. x .\<in>\<^bsub>S\<^esub> B) \<and> (\<forall>x \<in> B. x .\<in>\<^bsub>S\<^esub> A))"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    30
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 35355
diff changeset
    31
definition
44471
3c2b2c4a7c1c tuned syntax -- avoid ambiguities;
wenzelm
parents: 41959
diff changeset
    32
  eq_class_of :: "_ \<Rightarrow> 'a \<Rightarrow> 'a set" ("class'_of\<index>")
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    33
  where "class_of\<^bsub>S\<^esub> x = {y \<in> carrier S. x .=\<^bsub>S\<^esub> y}"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    34
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 35355
diff changeset
    35
definition
44471
3c2b2c4a7c1c tuned syntax -- avoid ambiguities;
wenzelm
parents: 41959
diff changeset
    36
  eq_closure_of :: "_ \<Rightarrow> 'a set \<Rightarrow> 'a set" ("closure'_of\<index>")
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    37
  where "closure_of\<^bsub>S\<^esub> A = {y \<in> carrier S. y .\<in>\<^bsub>S\<^esub> A}"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    38
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 35355
diff changeset
    39
definition
44471
3c2b2c4a7c1c tuned syntax -- avoid ambiguities;
wenzelm
parents: 41959
diff changeset
    40
  eq_is_closed :: "_ \<Rightarrow> 'a set \<Rightarrow> bool" ("is'_closed\<index>")
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    41
  where "is_closed\<^bsub>S\<^esub> A \<longleftrightarrow> A \<subseteq> carrier S \<and> closure_of\<^bsub>S\<^esub> A = A"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    42
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    43
abbreviation
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    44
  not_eq :: "_ \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" (infixl ".\<noteq>\<index>" 50)
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    45
  where "x .\<noteq>\<^bsub>S\<^esub> y == ~(x .=\<^bsub>S\<^esub> y)"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    46
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    47
abbreviation
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    48
  not_elem :: "_ \<Rightarrow> 'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixl ".\<notin>\<index>" 50)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    49
  where "x .\<notin>\<^bsub>S\<^esub> A == ~(x .\<in>\<^bsub>S\<^esub> A)"
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    50
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    51
abbreviation
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    52
  set_not_eq :: "_ \<Rightarrow> 'a set \<Rightarrow> 'a set \<Rightarrow> bool" (infixl "{.\<noteq>}\<index>" 50)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 29237
diff changeset
    53
  where "A {.\<noteq>}\<^bsub>S\<^esub> B == ~(A {.=}\<^bsub>S\<^esub> B)"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    54
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    55
locale equivalence =
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    56
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    57
  assumes refl [simp, intro]: "x \<in> carrier S \<Longrightarrow> x .= x"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    58
    and sym [sym]: "\<lbrakk> x .= y; x \<in> carrier S; y \<in> carrier S \<rbrakk> \<Longrightarrow> y .= x"
40293
cd932ab8cb59 Minor reformat.
ballarin
parents: 35849
diff changeset
    59
    and trans [trans]:
cd932ab8cb59 Minor reformat.
ballarin
parents: 35849
diff changeset
    60
      "\<lbrakk> x .= y; y .= z; x \<in> carrier S; y \<in> carrier S; z \<in> carrier S \<rbrakk> \<Longrightarrow> x .= z"
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    61
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
    62
(* Lemmas by Stephan Hohe *)
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
    63
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    64
lemma elemI:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    65
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    66
  assumes "a' \<in> A" and "a .= a'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    67
  shows "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    68
unfolding elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    69
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    70
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    71
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    72
lemma (in equivalence) elem_exact:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    73
  assumes "a \<in> carrier S" and "a \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    74
  shows "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    75
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    76
by (fast intro: elemI)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    77
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    78
lemma elemE:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    79
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    80
  assumes "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    81
    and "\<And>a'. \<lbrakk>a' \<in> A; a .= a'\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    82
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    83
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    84
unfolding elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    85
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    86
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    87
lemma (in equivalence) elem_cong_l [trans]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    88
  assumes cong: "a' .= a"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    89
    and a: "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    90
    and carr: "a \<in> carrier S"  "a' \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    91
    and Acarr: "A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    92
  shows "a' .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    93
using a
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    94
apply (elim elemE, intro elemI)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    95
proof assumption
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    96
  fix b
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    97
  assume bA: "b \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    98
  note [simp] = carr bA[THEN subsetD[OF Acarr]]
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
    99
  note cong
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   100
  also assume "a .= b"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   101
  finally show "a' .= b" by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   102
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   103
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   104
lemma (in equivalence) elem_subsetD:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   105
  assumes "A \<subseteq> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   106
    and aA: "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   107
  shows "a .\<in> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   108
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   109
by (fast intro: elemI elim: elemE dest: subsetD)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   110
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   111
lemma (in equivalence) mem_imp_elem [simp, intro]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   112
  "[| x \<in> A; x \<in> carrier S |] ==> x .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   113
  unfolding elem_def by blast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   114
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   115
lemma set_eqI:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   116
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   117
  assumes ltr: "\<And>a. a \<in> A \<Longrightarrow> a .\<in> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   118
    and rtl: "\<And>b. b \<in> B \<Longrightarrow> b .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   119
  shows "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   120
unfolding set_eq_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   121
by (fast intro: ltr rtl)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   122
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   123
lemma set_eqI2:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   124
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   125
  assumes ltr: "\<And>a b. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a .= b"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   126
    and rtl: "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. b .= a"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   127
  shows "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   128
  by (intro set_eqI, unfold elem_def) (fast intro: ltr rtl)+
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   129
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   130
lemma set_eqD1:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   131
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   132
  assumes AA': "A {.=} A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   133
    and "a \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   134
  shows "\<exists>a'\<in>A'. a .= a'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   135
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   136
unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   137
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   138
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   139
lemma set_eqD2:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   140
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   141
  assumes AA': "A {.=} A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   142
    and "a' \<in> A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   143
  shows "\<exists>a\<in>A. a' .= a"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   144
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   145
unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   146
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   147
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   148
lemma set_eqE:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   149
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   150
  assumes AB: "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   151
    and r: "\<lbrakk>\<forall>a\<in>A. a .\<in> B; \<forall>b\<in>B. b .\<in> A\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   152
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   153
using AB
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   154
unfolding set_eq_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   155
by (blast dest: r)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   156
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   157
lemma set_eqE2:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   158
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   159
  assumes AB: "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   160
    and r: "\<lbrakk>\<forall>a\<in>A. (\<exists>b\<in>B. a .= b); \<forall>b\<in>B. (\<exists>a\<in>A. b .= a)\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   161
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   162
using AB
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   163
unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   164
by (blast dest: r)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   165
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   166
lemma set_eqE':
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   167
  fixes R (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   168
  assumes AB: "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   169
    and aA: "a \<in> A" and bB: "b \<in> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   170
    and r: "\<And>a' b'. \<lbrakk>a' \<in> A; b .= a'; b' \<in> B; a .= b'\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   171
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   172
proof -
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   173
  from AB aA
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   174
      have "\<exists>b'\<in>B. a .= b'" by (rule set_eqD1)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   175
  from this obtain b'
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   176
      where b': "b' \<in> B" "a .= b'" by auto
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   177
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   178
  from AB bB
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   179
      have "\<exists>a'\<in>A. b .= a'" by (rule set_eqD2)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   180
  from this obtain a'
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   181
      where a': "a' \<in> A" "b .= a'" by auto
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   182
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   183
  from a' b'
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   184
      show "P" by (rule r)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   185
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   186
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   187
lemma (in equivalence) eq_elem_cong_r [trans]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   188
  assumes a: "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   189
    and cong: "A {.=} A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   190
    and carr: "a \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   191
    and Carr: "A \<subseteq> carrier S" "A' \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   192
  shows "a .\<in> A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   193
using a cong
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   194
proof (elim elemE set_eqE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   195
  fix b
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   196
  assume bA: "b \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   197
     and inA': "\<forall>b\<in>A. b .\<in> A'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   198
  note [simp] = carr Carr Carr[THEN subsetD] bA
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   199
  assume "a .= b"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   200
  also from bA inA'
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   201
       have "b .\<in> A'" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   202
  finally
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   203
       show "a .\<in> A'" by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   204
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   205
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   206
lemma (in equivalence) set_eq_sym [sym]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   207
  assumes "A {.=} B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   208
    and "A \<subseteq> carrier S" "B \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   209
  shows "B {.=} A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   210
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   211
unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   212
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   213
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   214
(* FIXME: the following two required in Isabelle 2008, not Isabelle 2007 *)
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
   215
(* alternatively, could declare lemmas [trans] = ssubst [where 'a = "'a set"] *)
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   216
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   217
lemma (in equivalence) equal_set_eq_trans [trans]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   218
  assumes AB: "A = B" and BC: "B {.=} C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   219
  shows "A {.=} C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   220
  using AB BC by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   221
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   222
lemma (in equivalence) set_eq_equal_trans [trans]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   223
  assumes AB: "A {.=} B" and BC: "B = C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   224
  shows "A {.=} C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   225
  using AB BC by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   226
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27701
diff changeset
   227
27701
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   228
lemma (in equivalence) set_eq_trans [trans]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   229
  assumes AB: "A {.=} B" and BC: "B {.=} C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   230
    and carr: "A \<subseteq> carrier S"  "B \<subseteq> carrier S"  "C \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   231
  shows "A {.=} C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   232
proof (intro set_eqI)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   233
  fix a
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   234
  assume aA: "a \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   235
  with carr have "a \<in> carrier S" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   236
  note [simp] = carr this
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   237
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   238
  from aA
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   239
       have "a .\<in> A" by (simp add: elem_exact)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   240
  also note AB
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   241
  also note BC
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   242
  finally
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   243
       show "a .\<in> C" by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   244
next
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   245
  fix c
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   246
  assume cC: "c \<in> C"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   247
  with carr have "c \<in> carrier S" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   248
  note [simp] = carr this
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   249
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   250
  from cC
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   251
       have "c .\<in> C" by (simp add: elem_exact)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   252
  also note BC[symmetric]
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   253
  also note AB[symmetric]
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   254
  finally
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   255
       show "c .\<in> A" by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   256
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   257
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   258
(* FIXME: generalise for insert *)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   259
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   260
(*
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   261
lemma (in equivalence) set_eq_insert:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   262
  assumes x: "x .= x'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   263
    and carr: "x \<in> carrier S" "x' \<in> carrier S" "A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   264
  shows "insert x A {.=} insert x' A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   265
  unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   266
apply rule
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   267
apply rule
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   268
apply (case_tac "xa = x")
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   269
using x apply fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   270
apply (subgoal_tac "xa \<in> A") prefer 2 apply fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   271
apply (rule_tac x=xa in bexI)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   272
using carr apply (rule_tac refl) apply auto [1]
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   273
apply safe
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   274
*)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   275
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   276
lemma (in equivalence) set_eq_pairI:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   277
  assumes xx': "x .= x'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   278
    and carr: "x \<in> carrier S" "x' \<in> carrier S" "y \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   279
  shows "{x, y} {.=} {x', y}"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   280
unfolding set_eq_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   281
proof safe
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   282
  have "x' \<in> {x', y}" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   283
  with xx' show "\<exists>b\<in>{x', y}. x .= b" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   284
next
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   285
  have "y \<in> {x', y}" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   286
  with carr show "\<exists>b\<in>{x', y}. y .= b" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   287
next
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   288
  have "x \<in> {x, y}" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   289
  with xx'[symmetric] carr
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   290
  show "\<exists>a\<in>{x, y}. x' .= a" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   291
next
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   292
  have "y \<in> {x, y}" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   293
  with carr show "\<exists>a\<in>{x, y}. y .= a" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   294
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   295
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   296
lemma (in equivalence) is_closedI:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   297
  assumes closed: "!!x y. [| x .= y; x \<in> A; y \<in> carrier S |] ==> y \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   298
    and S: "A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   299
  shows "is_closed A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   300
  unfolding eq_is_closed_def eq_closure_of_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   301
  using S
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   302
  by (blast dest: closed sym)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   303
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   304
lemma (in equivalence) closure_of_eq:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   305
  "[| x .= x'; A \<subseteq> carrier S; x \<in> closure_of A; x \<in> carrier S; x' \<in> carrier S |] ==> x' \<in> closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   306
  unfolding eq_closure_of_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   307
  by (blast intro: trans sym)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   308
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   309
lemma (in equivalence) is_closed_eq [dest]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   310
  "[| x .= x'; x \<in> A; is_closed A; x \<in> carrier S; x' \<in> carrier S |] ==> x' \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   311
  unfolding eq_is_closed_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   312
  using closure_of_eq [where A = A]
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   313
  by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   314
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   315
lemma (in equivalence) is_closed_eq_rev [dest]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   316
  "[| x .= x'; x' \<in> A; is_closed A; x \<in> carrier S; x' \<in> carrier S |] ==> x \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   317
  by (drule sym) (simp_all add: is_closed_eq)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   318
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   319
lemma closure_of_closed [simp, intro]:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   320
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   321
  shows "closure_of A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   322
unfolding eq_closure_of_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   323
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   324
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   325
lemma closure_of_memI:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   326
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   327
  assumes "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   328
    and "a \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   329
  shows "a \<in> closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   330
unfolding eq_closure_of_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   331
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   332
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   333
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   334
lemma closure_ofI2:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   335
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   336
  assumes "a .= a'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   337
    and "a' \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   338
    and "a \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   339
  shows "a \<in> closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   340
unfolding eq_closure_of_def elem_def
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   341
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   342
by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   343
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   344
lemma closure_of_memE:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   345
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   346
  assumes p: "a \<in> closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   347
    and r: "\<lbrakk>a \<in> carrier S; a .\<in> A\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   348
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   349
proof -
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   350
  from p
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   351
      have acarr: "a \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   352
      and "a .\<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   353
      by (simp add: eq_closure_of_def)+
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   354
  thus "P" by (rule r)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   355
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   356
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   357
lemma closure_ofE2:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   358
  fixes S (structure)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   359
  assumes p: "a \<in> closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   360
    and r: "\<And>a'. \<lbrakk>a \<in> carrier S; a' \<in> A; a .= a'\<rbrakk> \<Longrightarrow> P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   361
  shows "P"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   362
proof -
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   363
  from p have acarr: "a \<in> carrier S" by (simp add: eq_closure_of_def)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   364
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   365
  from p have "\<exists>a'\<in>A. a .= a'" by (simp add: eq_closure_of_def elem_def)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   366
  from this obtain a'
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   367
      where "a' \<in> A" and "a .= a'" by auto
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   368
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   369
  from acarr and this
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   370
      show "P" by (rule r)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   371
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   372
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   373
(*
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   374
lemma (in equivalence) classes_consistent:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   375
  assumes Acarr: "A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   376
  shows "is_closed (closure_of A)"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   377
apply (blast intro: elemI elim elemE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   378
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   379
apply (intro is_closedI closure_of_memI, simp)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   380
 apply (elim elemE closure_of_memE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   381
proof -
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   382
  fix x a' a''
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   383
  assume carr: "x \<in> carrier S" "a' \<in> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   384
  assume a''A: "a'' \<in> A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   385
  with Acarr have "a'' \<in> carrier S" by fast
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   386
  note [simp] = carr this Acarr
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   387
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   388
  assume "x .= a'"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   389
  also assume "a' .= a''"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   390
  also from a''A
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   391
       have "a'' .\<in> A" by (simp add: elem_exact)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   392
  finally show "x .\<in> A" by simp
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   393
qed
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   394
*)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   395
(*
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   396
lemma (in equivalence) classes_small:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   397
  assumes "is_closed B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   398
    and "A \<subseteq> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   399
  shows "closure_of A \<subseteq> B"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   400
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   401
by (blast dest: is_closedD2 elem_subsetD elim: closure_of_memE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   402
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   403
lemma (in equivalence) classes_eq:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   404
  assumes "A \<subseteq> carrier S"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   405
  shows "A {.=} closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   406
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   407
by (blast intro: set_eqI elem_exact closure_of_memI elim: closure_of_memE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   408
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   409
lemma (in equivalence) complete_classes:
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   410
  assumes c: "is_closed A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   411
  shows "A = closure_of A"
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   412
using assms
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   413
by (blast intro: closure_of_memI elem_exact dest: is_closedD1 is_closedD2 closure_of_memE)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   414
*)
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   415
ed7a2e0fab59 New theory on divisibility.
ballarin
parents:
diff changeset
   416
end