diff -r c8b31085cb5b -r efbc22a6f1a4 Attic/Quot/Examples/FSet3.thy --- a/Attic/Quot/Examples/FSet3.thy Wed Apr 21 10:24:39 2010 +0200 +++ b/Attic/Quot/Examples/FSet3.thy Wed Apr 21 10:34:10 2010 +0200 @@ -9,47 +9,65 @@ shows "\S = {||} \ P; \x S'. S = finsert x S' \ P\ \ P" by (lifting list.exhaust) -(* PROBLEM: these lemmas needs to be restated, since *) -(* concat.simps(1) and concat.simps(2) contain the *) -(* type variables ?'a1.0 (which are turned into frees *) -(* 'a_1 *) - -lemma concat1: - shows "concat [] \ []" -by (simp) +lemma list_rel_find_element: + assumes a: "x \ set a" + and b: "list_rel R a b" + shows "\y. (y \ set b \ R x y)" +proof - + have "length a = length b" using b by (rule list_rel_len) + then show ?thesis using a b proof (induct a b rule: list_induct2) + case Nil + show ?case using Nil.prems by simp + next + case (Cons x xs y ys) + show ?case using Cons by auto + qed +qed -lemma concat2: - shows "concat (x # xs) \ x @ concat xs" -by (simp) - -lemma concat_rsp: - "\list_rel op \ x x'; x' \ y'; list_rel op \ y' y\ \ concat x \ concat y" - apply (induct x y arbitrary: x' y' rule: list_induct2') +lemma concat_rsp_pre: + "\list_rel op \ x x'; x' \ y'; list_rel op \ y' y; \x\set x. xa \ set x\ \ + \x\set y. xa \ set x" + apply clarify + apply (frule list_rel_find_element[of _ "x"]) + apply assumption + apply clarify + apply (subgoal_tac "ya \ set y'") + prefer 2 apply simp - defer defer - apply (simp only: concat.simps) - sorry + apply (frule list_rel_find_element[of _ "y'"]) + apply assumption + apply auto + done lemma [quot_respect]: shows "(list_rel op \ OOO op \ ===> op \) concat concat" apply (simp only: fun_rel_def) apply clarify - apply (rule concat_rsp) + apply (simp (no_asm)) + apply rule + apply rule + apply (erule concat_rsp_pre) apply assumption+ + apply (rule concat_rsp_pre) + prefer 4 + apply assumption + apply (rule list_rel_symp[OF list_eq_equivp]) + apply assumption + apply (rule equivp_symp[OF list_eq_equivp]) + apply assumption + apply (rule list_rel_symp[OF list_eq_equivp]) + apply assumption done lemma nil_rsp2[quot_respect]: "(list_rel op \ OOO op \) [] []" by (metis nil_rsp list_rel.simps(1) pred_compI) lemma set_in_eq: "(\e. ((e \ A) \ (e \ B))) \ A = B" - apply (rule eq_reflection) - apply auto - done + by (rule eq_reflection) auto lemma map_rel_cong: "b \ ba \ map f b \ map f ba" unfolding list_eq.simps - apply(simp only: set_map set_in_eq) - done + by (simp only: set_map set_in_eq) lemma quotient_compose_list_pre: "(list_rel op \ OOO op \) r s = @@ -106,7 +124,7 @@ (abs_fset \ (map abs_fset)) ((map rep_fset) \ rep_fset)" unfolding Quotient_def comp_def apply (rule)+ - apply (simp add: abs_o_rep[OF Quotient_fset] id_simps Quotient_abs_rep[OF Quotient_fset]) + apply (simp add: abs_o_rep[OF Quotient_fset] Quotient_abs_rep[OF Quotient_fset] map_id) apply (rule) apply (rule) apply (rule) @@ -123,7 +141,7 @@ lemma fconcat_empty: shows "fconcat {||} = {||}" - apply(lifting concat1) + apply(lifting concat.simps(1)) apply(cleaning) apply(simp add: comp_def bot_fset_def) done @@ -144,10 +162,10 @@ lemma fconcat_insert: shows "fconcat (finsert x S) = x |\| fconcat S" - apply(lifting concat2) - apply(cleaning) + apply (lifting concat.simps(2)) + apply (cleaning) apply (simp add: finsert_def fconcat_def comp_def) - apply cleaning + apply (cleaning) done (* TBD *)