author | Christian Urban <urbanc@in.tum.de> |
Sun, 07 Feb 2010 10:20:29 +0100 | |
changeset 1080 | 2f1377bb4e1f |
parent 787 | 5cf83fa5b36c |
child 1128 | 17ca92ab4660 |
permissions | -rw-r--r-- |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
theory FSet2 |
768
e9e205b904e2
get_fun needed change to cope with "('a fset) fset" types...this needs composition (op o); now id_simps contains also id_o and o_id, and map_id is also added in QuotList.thy; regularize and cleaning needed to be hacked (indicated by "HACK")...THIS NEEDS ATTENTION!!!; except two lemmas in IntEx, all examples go through; added considerable material to FSet3; tuned FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents:
767
diff
changeset
|
2 |
imports "../QuotMain" "../QuotList" List |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
inductive |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
list_eq (infix "\<approx>" 50) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
where |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
"a#b#xs \<approx> b#a#xs" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
| "[] \<approx> []" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
10 |
| "xs \<approx> ys \<Longrightarrow> ys \<approx> xs" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
| "a#a#xs \<approx> a#xs" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
| "xs \<approx> ys \<Longrightarrow> a#xs \<approx> a#ys" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
| "\<lbrakk>xs1 \<approx> xs2; xs2 \<approx> xs3\<rbrakk> \<Longrightarrow> xs1 \<approx> xs3" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
lemma list_eq_refl: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
shows "xs \<approx> xs" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
by (induct xs) (auto intro: list_eq.intros) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
19 |
lemma equivp_list_eq: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
20 |
shows "equivp list_eq" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
21 |
unfolding equivp_reflp_symp_transp reflp_def symp_def transp_def |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
by (auto intro: list_eq.intros list_eq_refl) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
|
787
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents:
768
diff
changeset
|
24 |
quotient_type |
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents:
768
diff
changeset
|
25 |
'a fset = "'a list" / "list_eq" |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
by (rule equivp_list_eq) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
|
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
parents:
766
diff
changeset
|
28 |
quotient_definition |
705
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
29 |
"fempty :: 'a fset" ("{||}") |
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
30 |
as |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
"[]" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
|
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
parents:
766
diff
changeset
|
33 |
quotient_definition |
705
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
34 |
"finsert :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset" |
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
35 |
as |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
"(op #)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
37 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
38 |
lemma finsert_rsp[quot_respect]: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
shows "(op = ===> op \<approx> ===> op \<approx>) (op #) (op #)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
by (auto intro: list_eq.intros) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
|
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
parents:
766
diff
changeset
|
42 |
quotient_definition |
705
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
43 |
"funion :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" ("_ \<union>f _" [65,66] 65) |
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
44 |
as |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
"(op @)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
47 |
lemma append_rsp_aux1: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
48 |
assumes a : "l2 \<approx> r2 " |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
49 |
shows "(h @ l2) \<approx> (h @ r2)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
50 |
using a |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
51 |
apply(induct h) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
52 |
apply(auto intro: list_eq.intros(5)) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
done |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
lemma append_rsp_aux2: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
assumes a : "l1 \<approx> r1" "l2 \<approx> r2 " |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
shows "(l1 @ l2) \<approx> (r1 @ r2)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
58 |
using a |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
59 |
apply(induct arbitrary: l2 r2) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
60 |
apply(simp_all) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
61 |
apply(blast intro: list_eq.intros append_rsp_aux1)+ |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
62 |
done |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
63 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
64 |
lemma append_rsp[quot_respect]: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
65 |
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) op @ op @" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
66 |
by (auto simp add: append_rsp_aux2) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
67 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
|
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
parents:
766
diff
changeset
|
69 |
quotient_definition |
705
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
70 |
"fmem :: 'a \<Rightarrow> 'a fset \<Rightarrow> bool" ("_ \<in>f _" [50, 51] 50) |
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
71 |
as |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
72 |
"(op mem)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
73 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
74 |
lemma memb_rsp_aux: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
75 |
assumes a: "x \<approx> y" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
76 |
shows "(z mem x) = (z mem y)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
77 |
using a by induct auto |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
78 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
79 |
lemma memb_rsp[quot_respect]: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
80 |
shows "(op = ===> (op \<approx> ===> op =)) (op mem) (op mem)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
81 |
by (simp add: memb_rsp_aux) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |
definition |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
84 |
fnot_mem :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" ("_ \<notin>f _" [50, 51] 50) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
85 |
where |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
86 |
"x \<notin>f S \<equiv> \<not>(x \<in>f S)" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
87 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
88 |
definition |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
89 |
"inter_list" :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
90 |
where |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
91 |
"inter_list X Y \<equiv> [x \<leftarrow> X. x\<in>set Y]" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
92 |
|
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
parents:
766
diff
changeset
|
93 |
quotient_definition |
705
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
94 |
"finter::'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" ("_ \<inter>f _" [70, 71] 70) |
f51c6069cd17
New syntax for definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
684
diff
changeset
|
95 |
as |
684
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
96 |
"inter_list" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
97 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
98 |
no_syntax |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
99 |
"@Finset" :: "args => 'a fset" ("{|(_)|}") |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
100 |
syntax |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
101 |
"@Finfset" :: "args => 'a fset" ("{|(_)|}") |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
102 |
translations |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
103 |
"{|x, xs|}" == "CONST finsert x {|xs|}" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
104 |
"{|x|}" == "CONST finsert x {||}" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
105 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
106 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
107 |
subsection {* Empty sets *} |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
108 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
109 |
lemma test: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
110 |
shows "\<not>(x # xs \<approx> [])" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
111 |
sorry |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
112 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
113 |
lemma finsert_not_empty[simp]: |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
114 |
shows "finsert x S \<noteq> {||}" |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
115 |
by (lifting test) |
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
116 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
117 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
118 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
119 |
|
88094aa77026
added an attempt to get a finite set theory
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
120 |
end; |