684
+ − 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>
diff
changeset
+ − 2
imports "../QuotMain" "../QuotList" List
684
+ − 3
begin
+ − 4
+ − 5
inductive
+ − 6
list_eq (infix "\<approx>" 50)
+ − 7
where
+ − 8
"a#b#xs \<approx> b#a#xs"
+ − 9
| "[] \<approx> []"
+ − 10
| "xs \<approx> ys \<Longrightarrow> ys \<approx> xs"
+ − 11
| "a#a#xs \<approx> a#xs"
+ − 12
| "xs \<approx> ys \<Longrightarrow> a#xs \<approx> a#ys"
+ − 13
| "\<lbrakk>xs1 \<approx> xs2; xs2 \<approx> xs3\<rbrakk> \<Longrightarrow> xs1 \<approx> xs3"
+ − 14
+ − 15
lemma list_eq_refl:
+ − 16
shows "xs \<approx> xs"
+ − 17
by (induct xs) (auto intro: list_eq.intros)
+ − 18
+ − 19
lemma equivp_list_eq:
+ − 20
shows "equivp list_eq"
+ − 21
unfolding equivp_reflp_symp_transp reflp_def symp_def transp_def
+ − 22
by (auto intro: list_eq.intros list_eq_refl)
+ − 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>
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>
diff
changeset
+ − 25
'a fset = "'a list" / "list_eq"
684
+ − 26
by (rule equivp_list_eq)
+ − 27
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 28
quotient_definition
705
+ − 29
"fempty :: 'a fset" ("{||}")
+ − 30
as
684
+ − 31
"[]"
+ − 32
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 33
quotient_definition
705
+ − 34
"finsert :: 'a \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
+ − 35
as
684
+ − 36
"(op #)"
+ − 37
+ − 38
lemma finsert_rsp[quot_respect]:
+ − 39
shows "(op = ===> op \<approx> ===> op \<approx>) (op #) (op #)"
+ − 40
by (auto intro: list_eq.intros)
+ − 41
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 42
quotient_definition
705
+ − 43
"funion :: 'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" ("_ \<union>f _" [65,66] 65)
+ − 44
as
684
+ − 45
"(op @)"
+ − 46
+ − 47
lemma append_rsp_aux1:
+ − 48
assumes a : "l2 \<approx> r2 "
+ − 49
shows "(h @ l2) \<approx> (h @ r2)"
+ − 50
using a
+ − 51
apply(induct h)
+ − 52
apply(auto intro: list_eq.intros(5))
+ − 53
done
+ − 54
+ − 55
lemma append_rsp_aux2:
+ − 56
assumes a : "l1 \<approx> r1" "l2 \<approx> r2 "
+ − 57
shows "(l1 @ l2) \<approx> (r1 @ r2)"
+ − 58
using a
+ − 59
apply(induct arbitrary: l2 r2)
+ − 60
apply(simp_all)
+ − 61
apply(blast intro: list_eq.intros append_rsp_aux1)+
+ − 62
done
+ − 63
+ − 64
lemma append_rsp[quot_respect]:
+ − 65
shows "(op \<approx> ===> op \<approx> ===> op \<approx>) op @ op @"
+ − 66
by (auto simp add: append_rsp_aux2)
+ − 67
+ − 68
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 69
quotient_definition
705
+ − 70
"fmem :: 'a \<Rightarrow> 'a fset \<Rightarrow> bool" ("_ \<in>f _" [50, 51] 50)
+ − 71
as
684
+ − 72
"(op mem)"
+ − 73
+ − 74
lemma memb_rsp_aux:
+ − 75
assumes a: "x \<approx> y"
+ − 76
shows "(z mem x) = (z mem y)"
+ − 77
using a by induct auto
+ − 78
+ − 79
lemma memb_rsp[quot_respect]:
+ − 80
shows "(op = ===> (op \<approx> ===> op =)) (op mem) (op mem)"
+ − 81
by (simp add: memb_rsp_aux)
+ − 82
+ − 83
definition
+ − 84
fnot_mem :: "'a \<Rightarrow> 'a fset \<Rightarrow> bool" ("_ \<notin>f _" [50, 51] 50)
+ − 85
where
+ − 86
"x \<notin>f S \<equiv> \<not>(x \<in>f S)"
+ − 87
+ − 88
definition
+ − 89
"inter_list" :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"
+ − 90
where
+ − 91
"inter_list X Y \<equiv> [x \<leftarrow> X. x\<in>set Y]"
+ − 92
767
37285ec4387d
on suggestion of Tobias renamed "quotient_def" to "quotient_definition"; needs new keyword file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 93
quotient_definition
705
+ − 94
"finter::'a fset \<Rightarrow> 'a fset \<Rightarrow> 'a fset" ("_ \<inter>f _" [70, 71] 70)
+ − 95
as
684
+ − 96
"inter_list"
+ − 97
+ − 98
no_syntax
+ − 99
"@Finset" :: "args => 'a fset" ("{|(_)|}")
+ − 100
syntax
+ − 101
"@Finfset" :: "args => 'a fset" ("{|(_)|}")
+ − 102
translations
+ − 103
"{|x, xs|}" == "CONST finsert x {|xs|}"
+ − 104
"{|x|}" == "CONST finsert x {||}"
+ − 105
+ − 106
+ − 107
subsection {* Empty sets *}
+ − 108
+ − 109
lemma test:
+ − 110
shows "\<not>(x # xs \<approx> [])"
+ − 111
sorry
+ − 112
+ − 113
lemma finsert_not_empty[simp]:
+ − 114
shows "finsert x S \<noteq> {||}"
+ − 115
by (lifting test)
+ − 116
+ − 117
+ − 118
+ − 119
+ − 120
end;