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