diff -r 42b90994ac77 -r 89d772dae4d4 Quot/Examples/FSet3.thy --- a/Quot/Examples/FSet3.thy Fri Jan 08 15:02:12 2010 +0100 +++ b/Quot/Examples/FSet3.thy Fri Jan 08 19:46:22 2010 +0100 @@ -77,32 +77,28 @@ text {* raw section *} -lemma nil_not_cons: - shows "\[] \ x # xs" -by auto +lemma nil_not_cons: + shows "\[] \ x # xs" + by auto lemma memb_cons_iff: shows "memb x (y # xs) = (x = y \ memb x xs)" -by (induct xs) (auto simp add: memb_def) + by (induct xs) (auto simp add: memb_def) lemma memb_consI1: shows "memb x (x # xs)" -by (simp add: memb_def) + by (simp add: memb_def) -lemma memb_consI2: +lemma memb_consI2: shows "memb x xs \ memb x (y # xs)" by (simp add: memb_def) lemma memb_absorb: - shows "memb x xs \ (x # xs) \ xs" -by (induct xs) (auto simp add: memb_def) + shows "memb x xs \ x # xs \ xs" + by (induct xs) (auto simp add: memb_def id_simps) text {* lifted section *} -lemma fempty_not_finsert[simp]: - shows "{||} \ finsert x S" -by (lifting nil_not_cons) - lemma fin_finsert_iff[simp]: "x |\| finsert y S = (x = y \ x |\| S)" by (lifting memb_cons_iff) @@ -112,9 +108,10 @@ and finsertI2: "x |\| S \ x |\| finsert y S" by (lifting memb_consI1, lifting memb_consI2) + lemma finsert_absorb [simp]: shows "x |\| S \ finsert x S = S" -by (lifting memb_absorb) + by (lifting memb_absorb) section {* Singletons *} @@ -123,18 +120,22 @@ lemma singleton_list_eq: shows "[x] \ [y] \ x = y" -by auto + by (simp add: id_simps) auto text {* lifted section *} +lemma fempty_not_finsert[simp]: + shows "{||} \ finsert x S" + by (lifting nil_not_cons) + lemma fsingleton_eq[simp]: shows "{|x|} = {|y|} \ x = y" -by (lifting singleton_list_eq) + by (lifting singleton_list_eq) section {* Union *} quotient_definition - "funion :: 'a fset \ 'a fset \ 'a fset" (infixl "|\|" 65) + "funion :: 'a fset \ 'a fset \ 'a fset" (infixl "|\|" 65) as "op @" @@ -244,21 +245,21 @@ (* concat.simps(1) and concat.simps(2) contain the *) (* type variables ?'a1.0 (which are turned into frees *) (* 'a_1 *) -lemma concat1: +lemma concat1: shows "concat [] \ []" -by (simp) +by (simp add: id_simps) -lemma concat2: - shows "concat (x # xs) \ x @ concat xs" -by (simp) +lemma concat2: + shows "concat (x # xs) \ x @ concat xs" +by (simp add: id_simps) lemma concat_rsp[quot_respect]: shows "(list_rel op \ OO op \ OO list_rel op \ ===> op \) concat concat" sorry lemma nil_rsp2[quot_respect]: "(list_rel op \ OO op \ OO list_rel op \) [] []" -apply (metis FSet3.nil_rsp list_rel.simps(1) pred_comp.intros) -done + apply (metis FSet3.nil_rsp list_rel.simps(1) pred_comp.intros) + done lemma set_in_eq: "(\e. ((e \ A) \ (e \ B))) \ A = B" apply (rule eq_reflection) @@ -350,22 +351,25 @@ apply(rule refl) done +(* Should be true *) + +lemma insert_rsp2[quot_respect]: + "(op \ ===> list_rel op \ OO op \ OO list_rel op \ ===> list_rel op \ OO op \ OO list_rel op \) op # op #" +apply auto +apply (simp add: set_in_eq) +sorry + +lemma append_rsp[quot_respect]: + "(op \ ===> op \ ===> op \) op @ op @" + by (auto) + lemma fconcat_insert: shows "fconcat (finsert x S) = x |\| fconcat S" apply(lifting concat2) -apply(injection) -(* The Relation is wrong to apply rep_abs_rsp *) -thm rep_abs_rsp[of "(op \ ===> op =)"] -defer -apply (simp only: finsert_def[simplified id_simps]) -apply (simp only: fconcat_def[simplified id_simps]) apply(cleaning) -(* finsert_def doesn't get folded, since rep-abs types are incorrect *) -apply(simp add: comp_def) -apply (simp add: fconcat_def[simplified id_simps]) +apply (simp add: finsert_def fconcat_def comp_def) apply cleaning -(* The Relation is wrong again. *) -sorry +done text {* raw section *} @@ -493,13 +497,13 @@ "a \ set A \ a # A \ A" by auto -lemma cons_left_comm: - "x #y # A \ y # x # A" -by auto +lemma cons_left_comm: + "x # y # A \ y # x # A" +by (auto simp add: id_simps) -lemma cons_left_idem: +lemma cons_left_idem: "x # x # A \ x # A" -by auto +by (auto simp add: id_simps) lemma finite_set_raw_strong_cases: "(X = []) \ (\a Y. ((a \ set Y) \ (X \ a # Y)))" @@ -593,10 +597,6 @@ apply(auto) sorry -lemma append_rsp[quot_respect]: - "(op \ ===> op \ ===> op \) op @ op @" -by auto - primrec inter_raw where