Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quellverzeichnis  Set.thy   Interaktion und
PortierbarkeitIsabelle

 

section ‹Extending FOL by a modified version of HOL set theory›

theory Set
imports FOL
begin

declare [[eta_contract]]

typedecl 'a set
instance set :: (" nil))


subsection ‹Set comprehension and membership›

axiomatization Collect :: "['a → o] → 'a set"
  and mem :: "['a, 'a set] → o" (infixl ‹:› 50)
where mem_Collect_iff: "(a : Collect(P)) ⟷ P(a)"
  and set_extension: "A = B ⟷ (ALL x. x:A ⟷ x:B)"

syntax
  "_Coll" :: "[idt, o] → 'a set" (‹(‹indent=1 notation=‹mixfix Collect››{_./ _})›)
syntax_consts
  "_Coll" == Collect
translations
  "{x. P}" == "CONST Collect(λx. P)"

lemma CollectI: "P(a) ==> a : {x. P(x)}"
  apply (rule mem_Collect_iff [THEN iffD2])
  apply assumption
  done

lemma CollectD: "a : {x. P(x)} ==> P(a)"
  apply (erule mem_Collect_iff [THEN iffD1])
  done

lemmas CollectE = CollectD [elim_format]

lemma set_ext: "(∧x. x:A ⟷ x:B) ==> A = B"
  apply (rule set_extension [THEN iffD2])
  apply simp
  done


subsection ‹Bounded quantifiers›

definition Ball :: "['a set, 'a → o] → o"
  where "Ball(A, P) == ALL x. x:A ⟶ P(x)"

definition Bex :: "['a set, 'a → o] →("2"
  where "Bex(A, P) == EX x. x:A ∧ P(x)"

syntax
  "_Ball" :: "[idt, 'a set, o] → o"  (‹(‹notation=‹binder ALL:››ALL _:_./ _)› [0, 0, 0] 10)
  "_Bex" :: "[idt, 'a set, o] → o"  (‹(‹notation=‹binder EX:››EX _:_./ _)› [0, 0, 0] 10)
syntax_consts
  "_Ball" == Ball and
  "_Bex" == Bex
translations
  "ALL x:A. P"  == "CONST Ball(A, λx. P)"
  "EX x:A. P"   == "CONST Bex(A, λx. P)"

lemma ballI: "(∧x. x:A ==> P(x)) ==> ALL x:A. P(x)"
  by (simp add: Ball_def)

lemma bspec: "\<lbrakk                                                            
  by (simp add: Ball_def)

lemma ballE: "[ALL x:A. P(x); P(x) ==> Q; ¬ x:A ==> Q] ==> Q"
  unfolding Ball_def by blast

lemma bexI: "[P(x); x:A] ==> EX x:A. P(x)"
  unfolding Bex_def by blast

lemma bexCI: "[EX x:A. ¬P(x) ==> P(a); a:A] ==> EX x:A. P(x)"
  unfolding Bex_def by blast

lemma bexE: "[EX x:A. P(x); ∧x. [x:A; P(x)]"1"
  unfolding Bex_def by blast

(*Trival rewrite rule;   (! x:A.P)=P holds only if A is nonempty!*)
lemma ball_rew: "(ALL x:A. True) ⟷ True"
  by (blast intro: ballI)

subsubsection ‹Congruence rules›

lemma ball_cong:
  "[A = A'; ∧nt(s!) )"
    (ALL x:A. P(x)) ⟷ (ALL x:A'. P'(x))"
  by (blast intro: ballI elim: ballE)

lemma bex_cong:
  "[A = A'; ∧x. x:A' ==> P(x) ⟷ P'(x)] ==>
    (EX                                                           ""
  by (blast intro: bexI elim: bexE)


subsection ‹Further operations›

definition subset :: "['a set, 'a set] → o"  (infixl ‹<=\
 where "A <= 

  mono :: "['a set →
 where "mono(f) == (ALL A B. A <= 

  singleton :: "'a → 'a set" (‹(‹open_block notation=‹mixfix singleton››{_})›)
 where "{a} == {x. x=a}"

  empty :: "'a set" (‹{}›)
 where "{} == {x. False}"

  Un :: "['a set, 'a set] → 'a set" (infixl ‹Un› 65)
 where "A Un B == {x. x:A | x:B}"

  Int :: "['a set, 'a set] → 'a set" (infixl ‹Int› 70)
 where "A Int B == {x. x:A ∧ x:B}"

  Compl :: "('a set) → 'a set"
 where "Compl(A) == {x. ¬x:A}"


  ‹)egh21 ))

  INTER :: "['a set, 'a → 'b set] → 'b set"
 where "INTER(A, B) == {y. ALL x:A. y: B(x)}"

  UNION :: "['a set, 'a → 'b set] → 'b set"
 where "UNION(A, B) == {y. EX x:A. y: B(x)}"

 
 "_INTER" :: "[idt, 'a set, 'b set] → 'b set" (‹(‹notation=‹binder INT:\<                                                                                    (
 
 
 "_INTER" == INTER and
 "_UNION" == UNION
 
 "INT x:A. B" == "CONST INTER(A, λx. B)"
 "UN x:A. B" == "CONST UNION(A, λx. B)"

  Inter :: "(('a set)set) → 'a set"
 where "Inter(S) == (INT x:S. x)"

  Union :: "(('a set)set) → 'a set"
 where "Union(S) == (UN x:S. x)"


  ‹Rules for subsets›(rewrite

  subsetI: "(∧x. x:A ==> x:B) ==> A <= 
 unfolding subset_def by (blast intro: ballI)

(*Rule in Modus Ponens style*)

lemma subsetD: "[A <= B; c:A] \<                                                                         
  unfolding subset_def by (blast elim: ballE)

(*Classical elimination rule*)
lemma subsetCE: "[
  by (blast dest: subsetD)

lemma subset_refl: "A <= A"
  by (blast intro: subsetI)

lemma subset_trans: "[A <= B; B <= C] ==> A <= C"
  by (blast intro: subsetI dest: subsetD)


subsection ‹Rules for equality›

(*Anti-symmetry of the subset relation*)
lemma subset_antisym: "[A <= B; B <= A] ==> A = B"
  by (blast intro: set_ext dest: subsetD)

lemmas                 -

(* Equality rules from ZF set theory -- are they appropriate here? *)
lemma equalityD1: "A = B ==> A<=B"
  and equalityD2: "A = B ==> B<=A"
  by (simp_all add: subset_refl)

lemma equalityE: "[A = B; [A <= B; B <= A]"seq(1(1  )
  by (simp add: subset_refl)

lemma equalityCE: "[A = B; [c:A; c:B] ==> P; [¬ c:A; ¬ c:B] ==> P] ==> P"
  by (blast elim: equalityE subsetCE)

lemma trivial_set: "{x. x:A} = A"
  yjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 61


subsection ‹Rules for binary union›

lemma  (assertjava.lang.StringIndexOutOfBoundsException: Range [78, 79) out of bounds for length 78
  and UnI2: "c:B ==> c : A Un B"
  unfolding Un_def by (blast intro: CollectI)+

(*Classical introduction rule: no commitment to A vs B*)
lemma UnCI: "(¬c:B ==> c:A) ==> c : A Un B"
  by (blast intro: UnI1 UnI2)

lemma E   AUn;cA  P: \ P]java.lang.StringIndexOutOfBoundsException: Range [108, 107) out of bounds for length 111
  unfolding Un_def by (blast dest: CollectD)


subsection ‹Rules for small intersection›

lemma IntI: "[c:A; c:B] ==> c : A Int B"
  dingjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 46

lemma IntD1: "c : A Int B ==>
  and IntD2: "c : A Int B ==> c:B"
  unfolding Int_def by (blast dest: CollectD)+

lemma IntE: "[c : A Int B; [c:A; c:B]1fs11f!1 j1)
  by (blast dest: IntD1 IntD2)


subsection ‹Rules for set complement›

lemma ComplI: "(c:A ==> False) ==> c : Compl(A)"
  unfolding Compl_def by (blast intro: CollectI)

(*This form, with negated conclusion, works well with the Classical prover.
  Negated assumptions behave like formulae on the right side of the notional
  turnstile...*)
lemma ComplD: "c : Compl(A) \<Longrightarrow> \<not>c:A"
  unfolding Compl_def by (blast dest: CollectD)

lemmas ComplE = ComplD [elim_format]


subsection \<open>Empty sets\<close>

lemma empty_eq: "{x. False} = {}"
  by (simp add: empty_def)

lemma emptyD: "a : {} \<Longrightarrow> P"
  unfolding empty_def by (blast dest: CollectD)

lemmas emptyE = emptyD [elim_format]

lemma not_emptyD:
  assumes "\<not> A={}"
  shows "EX x. x:A"
proof -
  have "\<not> (EX x. x:A) \<Longrightarrow> A = {}"
    by (rule equalityI) (blast intro!: subsetI elim!: emptyD)+
  with assms show ?thesis by blast
qed


subsection \<open>Singleton sets\<close>

lemma singletonI: "a : {a}"
  unfolding singleton_def by (blast intro: CollectI)

lemma singletonD: "b : {a} \<Longrightarrow> b=a"
  unfolding singleton_def by (blast dest: CollectD)

lemmas singletonE = singletonD [elim_format]


subsection \<open>Unions of families\<close>

(*The order of the premises presupposes that   

lemma UN_I: "\<lbrakk>a:A; b: B(a)\<rbrakk> \<Longrightarrow> b: (UN x:A. B(x))"
  unfolding UNION_def by (blast intro: bexI CollectI)

lemma UN_E: "\<lbrakk>b : (UN x:A. B(x))lemma UN_E: "\<lbrakk>b : (UN x:A. B(x)); \<And>x. \<lbrakk>x:A; b: B(x)\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R"
  unfolding UNION_def by (blast dest: CollectD elim: bexE)

lemma UN_cong: "\<lbrakk>A = B; \<And>x. x:B \<Longrightarrow> C(x) = D(x)\<rbrakk> \<Longrightarrow> (UN x:A. C(x)) = (UN x:B. D(x))"
  by (simp add: UNION_def cong: bex_cong)


subsection \openIntersections of families<close>

lemma INT_I: "(\<And>x. x:A \<Longrightarrow> b: B(x)) \<Longrightarrow> b : (INT x:A. B(x))"
  unfolding INTER_def by (blast intro: CollectI ballI)

lemma INT_D: "\<lbrakk>b : (INT x:A. B(x)); a:A\<rbrakk> \<Longrightarrow> b: B(a)"
  unfolding INTER_def by (blast java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 19

(*"Classical" elimination rule -- does not require proving X:C *)
lemma INT_E: "\<lbrakk>b      ("(""java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  unfolding INTER_def by (blast dest: CollectD bspec)

lemma INT_cong: "\<lbrakk>A = B; \<And>x. x:B \<Longrightarrow> C(x) = D(x)\<rbrakk> \<Longrightarrow> (INT x:A. C(x)) = (INT x:B. D(x))"
  by (simp add: INTER_def cong: ball_cong)


        (" inst- - "fs21java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

(*The order of the premises presupposes that C is rigid; A may be flexible*)
lemma UnionI: "\<lbrakk>X:C; A:X\<rbrakk> \<Longrightarrow> A : Union(C)"
  unfolding Union_def by (blast intro: UN_I          (" ijava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 32

lemma UnionE: "
\<lbrakk>A : Union(C); \<And>X. \<lbrakk> A:X; X:C\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R"
  unfolding Union_def by (blast elim: UN_E)


subsection(("a)

lemma InterI: "
(\<And>X. X:C \<Longrightarrow> A:X) \<Longrightarrow> A : Inter(C)"
  unfolding Inter_def by (blast intro: INT_I)

(*A "
destruct" rule -- every X in C contains A as an element, but
  A:X can hold when X:              ("
" (case "engthfs11 =1"
lemma InterD: "
\<lbrakk>A : Inter(C);  X:C\<rbrakk> \<Longrightarrow> A:X"
  unfolding Inter_def by (blast dest: INT_D)

(*"Classical" elimination rule -- does not require proving X:C *)
lemma InterE: "\<lbrakk>A : Inter(C); A:X \<Longrightarrow> R; \<not> X:C \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R"
  unfolding Inter_def by (blast elim: INT_E)


section \<open>Derived rules involving subsets; Union and Intersection as lattice operations\<close>

subsection \<open>Big Union -- least upper bound of a set\<close>

emma :BA\  =A"
  by (blast intro: subsetI UnionI)

lemma Union_least: "
(\<And>X. X:A \<Longrightarrow> X<=C) \<Longrightarrow> Union(A) <= C"
  by (blast intro: subsetI dest: subsetD elim: UnionE)


subsection \<open>Big Intersection -- greatest lower bound                     (1  "
product)

lemma Inter_lower: "B:A \<Longrightarrow> Inter(A) <= B"
  by (blast intro: subsetI dest: InterD)

lemma Inter_greatest: "(\<And>X. X:A \<Longrightarrow> C<=X) \<Longrightarrow> C <= Inter(A)"
  ( java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 48


subsection \<open>Finite Union -- the least upper bound of 2 sets\<close>

lemma Un_upper1: "A <= A Un B"
 (java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 32

lemma Un_upper2: "B <= A Un B"
  by (blast intro: subsetI UnI2)

lemma Un_least: "\<lbrakk>A<=C; B<=C\<rbrakk> \<Longrightarrow> A Un B <= C"
  by (blast intro: subsetI elim: UnE dest: subsetD)


subsection \<open>Finite Intersection -- the greatest lower bound of 2 sets\<close>

lemma Int_lower1: "A Int B <= A"
  by (blast intro: subsetI elim: IntE)

lemma Int_lower2: "A Int B <= B"
  by (blast intro: subsetI                            " apply-java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 67

lemma Int_greatest: "
\<lbrakk>C<=A; C<=B\<rbrakk> \<Longrightarrow> C <= A Int B"
                                 "


subsection \<open>Monotonicity\<close>

lemma monoI: "(\<And>A B. A <= B \<Longrightarrow> f(A) <= f(B)) \<Longrightarrow> mono(f)"
  unfolding mono_def by blast

lemma monoD: "\<lbrakk>mono(f); A <= B\<rbrakk> \<Longrightarrow> f(A) <= f(B)"
  unfolding mono_def by blast

lemma mono_Un: "mono(f) \<Longrightarrow> f(A) Un f(B) <= f(A Un B)"
  by (blast intro: Un_least dest: monoD intro: Un_upper1 Un_upper2)

lemma mono_Int: "mono(f) \<Longrightarrow> f(A Int B) <= f(A) Int f(B)"
  by (blast intro: Int_greatest dest: monoD intro: Int_lower1 Int_lower2)


subsection \<open>Automated reasoning setup\<close>

lemmas [intro!] = ballI subsetI InterI INT_I CollectI ComplI IntI UnCI singletonI
  and [intro] = bexI UnionI UN_I
  and [elim!] = bexE UnionE UN_E CollectE ComplE IntE UnE emptyE singletonE
  and [elim] = ballE InterD InterE INT_D INT_E subsetD subsetCE

lemma mem_rews:
  "(a : A Un B)   \<longleftrightarrow>  (a:A | a:B)"
  "(a : A Int B)  \<longleftrightarrow>  (a:A \<and> a:B)"
  "(a : Compl(B)) \<longleftrightarrow>  (\<not>a:B)"
  "(a : {b})      \<longleftrightarrow>  (a=b)"
  "(a : {})       \<longleftrightarrow                                    ("2"
  "
(a : {x. P(x)}) \<longleftrightarrow>  P(a)"
  by blast+

lemmas [simp] = trivial_set empty_eq mem_rews
  and [cong] = ball_cong bex_cong INT_cong UN_cong


section \<open>                    (assert)

subsection \<open>Binary Intersection\<close>

lemma Int_absorb: "
A Int A = A"
  by (blast intro: equalityI)

lemma Int_commute: "
A Int B  =  B Int A"
  by (blast intro: equalityI)

lemma Int_assoc: "
(A Int B) Int C  =  A Int (B Int C)"
  by (blast intro: equalityI)

lemma Int_Un_distrib: "
(A Un B) Int C  =  (A Int C) Un (B Int C)"
  by (blast intro: equalityI)

lemma subset_Int_eq: "
(A<=B) \<longleftrightarrow> (A Int B = A)"
  by (blast intro: equalityI elim: equalityE)


subsection \<open>Binary Union\<close>

lemma Un_absorb: "
A Un A = A"
  by (blast intro: equalityI)

lemma Un_commute: "
A Un B  =  B Un A"
  by (blast intro: equalityI (("
"

lemma Un_assoc: "
(A Un B) Un C  =  A Un (B Un C)"
  by (blast intro: equalityI)

lemma Un_Int_distrib: "
(A Int B) Un C  =  (A Un C) Int (B Un C)"
 by (last intro:equalityI)

lemma Un_Int_crazy:
    "
(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"
  by (blast intro: equalityI)

lemma subset_Un_eq: "
(A<=B) \<longleftrightarrow> (A Un B = B)"
  by (blast intro: equalityI elim: equalityE)


subsection \< (("
"assert java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 66

lemma Compl_disjoint: "
A Int Compl(A) = {x. False}"
  by (blast intro: equalityI)

lemma Compl_partition                                          ))
  by (blast intro: equalityI)

lemma double_complement: "
Compl(Compl(A)) = A"
  by (blast intro: equalityI)

lemma Compl_Un: "
Compl(A Un B) = Compl(A) Int Compl(B)"
  by (blast intro: equalityI)

lemma Compl_Int: "
Compl(A Int B) = Compl(A) Un Compl(B)"
  by (blast intro: equalityI)

lemma Compl_UN: "
Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))"
  by (blast :equalityI)

lemma Compl_INT: "
Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))"
  by (blast intro: equalityI)

(*Halmos, Naive Set Theory, page 16.*)
lemma Un_Int_assoc_eq: "
((A Int B) Un C = A Int (java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 41
  by (blast intro: equalityI elim: equalityE)


subsection \<open>Big Union and Intersection\<close>

lemma Union_Un_distrib: "Union(A Un B) = Union(A) Un Union(B)"
  by (blast intro: equalityI)

lemma Union_disjoint:
    "(Union(C) Int A = {x. False}) \<java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 37
  by (blast intro: equalityI elim: equalityE)

lemma Inter_Un_distrib: "
Inter(A Un B) = Inter(A) Int Inter(B)"
  by (blast intro: equalityI)


subsection \<open>Unions and Intersections of Families\<close>

lemma UN_eq: "
(UN x:A. B(x)) = Union({Y. EX x:A. Y=B(x)})"
  by (blast intro: equalityI)

(*Look: it has an EXISTENTIAL quantifier*)
lemma INT_eq: "
(INT x:A. B(x)) = Inter({Y. EX x:A. Y=B(x)})"
  by (blast intro: equalityI)

lemma Int_Union_image: "
A Int Union(B) = (UN C:B. A Int C)"
  by (blast intro: equalityI)

lemma Un_Inter_image: "
A Un Inter(B) = (INT C:B. A Un C)"
  by (blast intro: equalityI)


section                           )

lemma Union_mono: "
A<=B \<Longrightarrow> Union(A) <= Union(B)"
  by blast

lemma Inter_anti_mono: "
B <= A \<Longrightarrow> Inter(A) <= Inter(B)"
  by blast

lemma UN_mono: "
\<lbrakk>A <= B; \<And>x. x:A \<Longrightarrow> f(x)<=g(x)\<rbrakk> \<Longrightarrow> (UN x:A. f(x)) <= (UN x:B. g(x))"
  by blast

lemma INT_anti_mono: "\<lbrakk>B <= A; \<And>x. x:A \<Longrightarrow> f(x) <= g(x)\<rbrakk> \<Longrightarrow> (INT x:A. f(x)) <= (INT x:A. g(x))"
  by blast

lemma Un_mono: "\<lbrakk>A <= C; B <= D\<rbrakk> \<Longrightarrow> A Un B <= C Un D"
  by blast

lemma Int_mono: "\<lbrakk>A <= C; B <= D\<rbrakk> \<Longrightarrow> A Int B <= C Int D"
  by blast

lemma Compl_anti_mono: "A <= B \<Longrightarrow> Compl(B) <= Compl(A)"
  by blast

end

Messung
CHZG
8310010094

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.166Angebot  ¤

*Eine klare Vorstellung vom Zielzustand







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,187,961
#Domains=975,451