# HG changeset patch # User Christian Urban # Date 1339505776 -3600 # Node ID 264253617b5eda6a2861ccb715208e596d9391ed # Parent b3d97424b13096272233ca96df584b743b239088 improved the finfun parts diff -r b3d97424b130 -r 264253617b5e Nominal/Nominal2_Base.thy --- a/Nominal/Nominal2_Base.thy Tue Jun 12 01:23:52 2012 +0100 +++ b/Nominal/Nominal2_Base.thy Tue Jun 12 13:56:16 2012 +0100 @@ -8,7 +8,7 @@ imports Main "~~/src/HOL/Library/Infinite_Set" "~~/src/HOL/Quotient_Examples/FSet" - "~~/src/HOL/Library/FinFun_Syntax" + "~~/src/HOL/Library/FinFun" keywords "atom_decl" "equivariance" :: thy_decl uses ("nominal_basics.ML") @@ -655,25 +655,28 @@ by (lifting set_eqvt) -subsection {* Permutations for @{typ "'a \f 'b"} (FinFuns) *} +subsection {* Permutations for @{typ "('a, 'b) finfun"} *} instantiation finfun :: (pt, pt) pt begin -definition "p \ f = Abs_finfun (p \ (finfun_apply f))" - -lemma Rep_finfun_permute: - shows "p \ finfun_apply f \ finfun" -apply(simp add: permute_fun_comp) -apply(rule finfun_right_compose) -apply(rule finfun_left_compose) -apply(rule finfun_apply) -apply(simp) -done +lift_definition + permute_finfun :: "perm \ ('a, 'b) finfun \ ('a, 'b) finfun" +is + "permute :: perm \ ('a \ 'b) \ ('a \ 'b)" + apply(simp add: permute_fun_comp) + apply(rule finfun_right_compose) + apply(rule finfun_left_compose) + apply(assumption) + apply(simp) + done instance apply(default) -apply(simp_all add: permute_finfun_def finfun_apply_inverse Rep_finfun_permute Abs_finfun_inverse) +apply(transfer) +apply(simp) +apply(transfer) +apply(simp) done end @@ -1125,6 +1128,11 @@ unfolding finite_def by simp +lemma fun_upd_eqvt[eqvt]: + shows "p \ (f(x := y)) = (p \ f)((p \ x) := (p \ y))" +unfolding fun_upd_def +by (simp) + subsubsection {* Equivariance for product operations *} @@ -1215,24 +1223,15 @@ shows "p \ (map_fset f S) = map_fset (p \ f) (p \ S)" by (lifting map_eqvt) -subsubsection {* Equivariance for @{typ "'a \f 'b"} *} - -lemma permute_finfun_update[simp, eqvt]: - "(p \ (finfun_update f a b)) = finfun_update (p \ f) (p \ a) (p \ b)" -unfolding finfun_update_def -unfolding permute_finfun_def -apply(simp add: Abs_finfun_inverse fun_upd_finfun finfun_apply finfun_apply_inverse Rep_finfun_permute) -apply(simp add: fun_upd_def) -apply(perm_simp exclude: finfun_apply) -apply(rule refl) -done - -lemma permute_finfun_const[simp, eqvt]: - shows "(p \ (K$ b)) = (K$ (p \ b))" -unfolding finfun_const_def -unfolding permute_finfun_def -by (simp add: permute_finfun_def const_finfun finfun_apply_inverse Rep_finfun_permute Abs_finfun_inverse) - +subsubsection {* Equivariance for @{typ "('a, 'b) finfun"} *} + +lemma permute_finfun_update[eqvt]: + shows "(p \ (finfun_update f a b)) = finfun_update (p \ f) (p \ a) (p \ b)" +by (transfer) (simp) + +lemma permute_finfun_const[eqvt]: + shows "(p \ (finfun_const b)) = (finfun_const (p \ b))" +by (transfer) (simp) section {* Supp, Freshness and Supports *} @@ -2231,24 +2230,24 @@ done -subsection {* Type @{typ "'a \f 'b"} is finitely supported *} +subsection {* Type @{typ "('a, 'b) finfun"} is finitely supported *} lemma fresh_finfun_const: - shows "a \ (K$ b) \ a \ b" + shows "a \ (finfun_const b) \ a \ b" by (simp add: fresh_def supp_def) lemma fresh_finfun_update: - shows "\a \ f; a \ b; a \ x\ \ a \ f(b $:= x)" + shows "\a \ f; a \ x; a \ y\ \ a \ finfun_update f x y" unfolding fresh_conv_MOST unfolding permute_finfun_update by (elim MOST_rev_mp) (simp) lemma supp_finfun_const: - "supp (K$ b) = supp(b)" + shows "supp (finfun_const b) = supp(b)" by (simp add: supp_def) lemma supp_finfun_update: - "supp (f(a $:= b)) \ supp(f, a, b)" + shows "supp (finfun_update f x y) \ supp(f, x, y)" using fresh_finfun_update by (auto simp add: fresh_def supp_Pair)