author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Fri, 19 Aug 2011 17:05:10 +0900 | |
changeset 45164 | 83c4f8ba0aa3 |
parent 44797 | 3264fbfd87d6 |
child 45731 | 56101fa00193 |
permissions | -rw-r--r-- |
krauss@44664 | 1 |
(* Title: HOL/Quotient_Examples/Cset.thy |
krauss@44664 | 2 |
Author: Florian Haftmann, Alexander Krauss, TU Muenchen |
krauss@44664 | 3 |
*) |
krauss@44664 | 4 |
|
krauss@44664 | 5 |
header {* A variant of theory Cset from Library, defined as a quotient *} |
krauss@44664 | 6 |
|
krauss@44664 | 7 |
theory Cset |
krauss@44664 | 8 |
imports "~~/src/HOL/Library/More_Set" "~~/src/HOL/Library/More_List" "~~/src/HOL/Library/Quotient_Syntax" |
krauss@44664 | 9 |
begin |
krauss@44664 | 10 |
|
krauss@44664 | 11 |
subsection {* Lifting *} |
krauss@44664 | 12 |
|
krauss@44664 | 13 |
(*FIXME: quotient package requires a dedicated constant*) |
krauss@44664 | 14 |
definition set_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" |
krauss@44664 | 15 |
where [simp]: "set_eq \<equiv> op =" |
krauss@44664 | 16 |
|
krauss@44664 | 17 |
quotient_type 'a set = "'a Set.set" / "set_eq" |
krauss@44664 | 18 |
by (simp add: identity_equivp) |
krauss@44664 | 19 |
|
krauss@44664 | 20 |
hide_type (open) set |
krauss@44664 | 21 |
|
krauss@44664 | 22 |
subsection {* Operations *} |
krauss@44664 | 23 |
|
krauss@44664 | 24 |
lemma [quot_respect]: |
krauss@44664 | 25 |
"(op = ===> set_eq ===> op =) (op \<in>) (op \<in>)" |
krauss@44664 | 26 |
"(op = ===> set_eq) Collect Collect" |
krauss@44664 | 27 |
"(set_eq ===> op =) More_Set.is_empty More_Set.is_empty" |
krauss@44664 | 28 |
"(op = ===> set_eq ===> set_eq) Set.insert Set.insert" |
krauss@44664 | 29 |
"(op = ===> set_eq ===> set_eq) More_Set.remove More_Set.remove" |
krauss@44664 | 30 |
"(op = ===> set_eq ===> set_eq) image image" |
krauss@44664 | 31 |
"(op = ===> set_eq ===> set_eq) More_Set.project More_Set.project" |
krauss@44664 | 32 |
"(set_eq ===> op =) Ball Ball" |
krauss@44664 | 33 |
"(set_eq ===> op =) Bex Bex" |
krauss@44664 | 34 |
"(set_eq ===> op =) Finite_Set.card Finite_Set.card" |
krauss@44664 | 35 |
"(set_eq ===> set_eq ===> op =) (op \<subseteq>) (op \<subseteq>)" |
krauss@44664 | 36 |
"(set_eq ===> set_eq ===> op =) (op \<subset>) (op \<subset>)" |
krauss@44664 | 37 |
"(set_eq ===> set_eq ===> set_eq) (op \<inter>) (op \<inter>)" |
krauss@44664 | 38 |
"(set_eq ===> set_eq ===> set_eq) (op \<union>) (op \<union>)" |
krauss@44664 | 39 |
"set_eq {} {}" |
krauss@44664 | 40 |
"set_eq UNIV UNIV" |
krauss@44664 | 41 |
"(set_eq ===> set_eq) uminus uminus" |
krauss@44664 | 42 |
"(set_eq ===> set_eq ===> set_eq) minus minus" |
kaliszyk@45164 | 43 |
"(set_eq ===> op =) Inf Inf" |
kaliszyk@45164 | 44 |
"(set_eq ===> op =) Sup Sup" |
krauss@44664 | 45 |
"(op = ===> set_eq) List.set List.set" |
krauss@44797 | 46 |
"(set_eq ===> (op = ===> set_eq) ===> set_eq) UNION UNION" |
krauss@44664 | 47 |
by (auto simp: fun_rel_eq) |
krauss@44664 | 48 |
|
krauss@44664 | 49 |
quotient_definition "member :: 'a => 'a Cset.set => bool" |
krauss@44664 | 50 |
is "op \<in>" |
krauss@44664 | 51 |
quotient_definition "Set :: ('a => bool) => 'a Cset.set" |
krauss@44664 | 52 |
is Collect |
krauss@44664 | 53 |
quotient_definition is_empty where "is_empty :: 'a Cset.set \<Rightarrow> bool" |
krauss@44664 | 54 |
is More_Set.is_empty |
krauss@44664 | 55 |
quotient_definition insert where "insert :: 'a \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 56 |
is Set.insert |
krauss@44664 | 57 |
quotient_definition remove where "remove :: 'a \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 58 |
is More_Set.remove |
krauss@44664 | 59 |
quotient_definition map where "map :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a Cset.set \<Rightarrow> 'b Cset.set" |
krauss@44664 | 60 |
is image |
krauss@44664 | 61 |
quotient_definition filter where "filter :: ('a \<Rightarrow> bool) \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 62 |
is More_Set.project |
krauss@44664 | 63 |
quotient_definition "forall :: 'a Cset.set \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" |
krauss@44664 | 64 |
is Ball |
krauss@44664 | 65 |
quotient_definition "exists :: 'a Cset.set \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" |
krauss@44664 | 66 |
is Bex |
krauss@44664 | 67 |
quotient_definition card where "card :: 'a Cset.set \<Rightarrow> nat" |
krauss@44664 | 68 |
is Finite_Set.card |
krauss@44664 | 69 |
quotient_definition set where "set :: 'a list => 'a Cset.set" |
krauss@44664 | 70 |
is List.set |
krauss@44664 | 71 |
quotient_definition subset where "subset :: 'a Cset.set \<Rightarrow> 'a Cset.set \<Rightarrow> bool" |
krauss@44664 | 72 |
is "op \<subseteq> :: 'a set \<Rightarrow> 'a set \<Rightarrow> bool" |
krauss@44664 | 73 |
quotient_definition psubset where "psubset :: 'a Cset.set \<Rightarrow> 'a Cset.set \<Rightarrow> bool" |
krauss@44664 | 74 |
is "op \<subset> :: 'a set \<Rightarrow> 'a set \<Rightarrow> bool" |
krauss@44664 | 75 |
quotient_definition inter where "inter :: 'a Cset.set \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 76 |
is "op \<inter> :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" |
krauss@44664 | 77 |
quotient_definition union where "union :: 'a Cset.set \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 78 |
is "op \<union> :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" |
krauss@44664 | 79 |
quotient_definition empty where "empty :: 'a Cset.set" |
krauss@44664 | 80 |
is "{} :: 'a set" |
krauss@44664 | 81 |
quotient_definition UNIV where "UNIV :: 'a Cset.set" |
krauss@44664 | 82 |
is "Set.UNIV :: 'a set" |
krauss@44664 | 83 |
quotient_definition uminus where "uminus :: 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 84 |
is "uminus_class.uminus :: 'a set \<Rightarrow> 'a set" |
krauss@44664 | 85 |
quotient_definition minus where "minus :: 'a Cset.set \<Rightarrow> 'a Cset.set \<Rightarrow> 'a Cset.set" |
krauss@44664 | 86 |
is "(op -) :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" |
kaliszyk@45164 | 87 |
quotient_definition Inf where "Inf :: ('a :: Inf) Cset.set \<Rightarrow> 'a" |
kaliszyk@45164 | 88 |
is "Inf_class.Inf :: ('a :: Inf) set \<Rightarrow> 'a" |
kaliszyk@45164 | 89 |
quotient_definition Sup where "Sup :: ('a :: Sup) Cset.set \<Rightarrow> 'a" |
kaliszyk@45164 | 90 |
is "Sup_class.Sup :: ('a :: Sup) set \<Rightarrow> 'a" |
krauss@44797 | 91 |
quotient_definition UNION where "UNION :: 'a Cset.set \<Rightarrow> ('a \<Rightarrow> 'b Cset.set) \<Rightarrow> 'b Cset.set" |
krauss@44797 | 92 |
is "Complete_Lattice.UNION :: 'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" |
krauss@44664 | 93 |
|
krauss@44664 | 94 |
hide_const (open) is_empty insert remove map filter forall exists card |
krauss@44797 | 95 |
set subset psubset inter union empty UNIV uminus minus Inf Sup UNION |
krauss@44664 | 96 |
|
krauss@44664 | 97 |
hide_fact (open) is_empty_def insert_def remove_def map_def filter_def |
krauss@44664 | 98 |
forall_def exists_def card_def set_def subset_def psubset_def |
krauss@44664 | 99 |
inter_def union_def empty_def UNIV_def uminus_def minus_def Inf_def Sup_def |
krauss@44797 | 100 |
UNION_def |
krauss@44664 | 101 |
|
krauss@44664 | 102 |
end |