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