# HG changeset patch # User Christian Urban # Date 1339460632 -3600 # Node ID b3d97424b13096272233ca96df584b743b239088 # Parent 425b4c406d8028e0f3091f9284e27f3b7141757c added finfun-type to Nominal diff -r 425b4c406d80 -r b3d97424b130 Nominal/Ex/CPS/CPS1_Plotkin.thy --- a/Nominal/Ex/CPS/CPS1_Plotkin.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Ex/CPS/CPS1_Plotkin.thy Tue Jun 12 01:23:52 2012 +0100 @@ -6,10 +6,10 @@ nominal_primrec CPS :: "lt \ lt" ("_*" [250] 250) where - "atom k \ x \ (x~)* = (Lam k ((k~) $ (x~)))" -| "atom k \ (x, M) \ (Lam x M)* = Lam k (k~ $ Lam x (M*))" + "atom k \ x \ (x~)* = (Lam k ((k~) $$ (x~)))" +| "atom k \ (x, M) \ (Lam x M)* = Lam k (k~ $$ Lam x (M*))" | "atom k \ (M, N) \ atom m \ (N, k) \ atom n \ (k, m) \ - (M $ N)* = Lam k (M* $ Lam m (N* $ Lam n (m~ $ n~ $ k~)))" + (M $$ N)* = Lam k (M* $$ Lam m (N* $$ Lam n (m~ $$ n~ $$ k~)))" unfolding eqvt_def CPS_graph_def apply (rule, perm_simp, rule, rule) apply (simp_all add: fresh_Pair_elim) @@ -25,7 +25,7 @@ apply (simp add: fresh_Pair_elim fresh_at_base)[2] apply (simp add: Abs1_eq_iff lt.fresh fresh_at_base) --"-" -apply(rule_tac s="[[atom ka]]lst. ka~ $ Lam x (CPS_sumC M)" in trans) +apply(rule_tac s="[[atom ka]]lst. ka~ $$ Lam x (CPS_sumC M)" in trans) apply (case_tac "k = ka") apply simp thm Abs1_eq_iff @@ -78,7 +78,7 @@ where "(Var x)+ = Var x" | "(Lam x M)+ = Lam x (M*)" -| "(M $ N)+ = M $ N" +| "(M $$ N)+ = M $$ N" unfolding convert_graph_def eqvt_def apply (rule, perm_simp, rule, rule) apply (erule lt.exhaust) @@ -105,13 +105,13 @@ nominal_primrec Kapply :: "lt \ lt \ lt" (infixl ";" 100) where - "Kapply (Lam x M) K = K $ (Lam x M)+" -| "Kapply (Var x) K = K $ Var x" -| "isValue M \ isValue N \ Kapply (M $ N) K = M+ $ N+ $ K" + "Kapply (Lam x M) K = K $$ (Lam x M)+" +| "Kapply (Var x) K = K $$ Var x" +| "isValue M \ isValue N \ Kapply (M $$ N) K = M+ $$ N+ $$ K" | "isValue M \ \isValue N \ atom n \ M \ atom n \ K \ - Kapply (M $ N) K = N; (Lam n (M+ $ Var n $ K))" + Kapply (M $$ N) K = N; (Lam n (M+ $$ Var n $$ K))" | "\isValue M \ atom m \ N \ atom m \ K \ atom n \ m \ atom n \ K \ - Kapply (M $ N) K = M; (Lam m (N* $ (Lam n (Var m $ Var n $ K))))" + Kapply (M $$ N) K = M; (Lam m (N* $$ (Lam n (Var m $$ Var n $$ K))))" unfolding Kapply_graph_def eqvt_def apply (rule, perm_simp, rule, rule) apply (simp_all) @@ -128,10 +128,10 @@ apply (simp add: fresh_Pair_elim fresh_at_base) apply (auto simp add: Abs1_eq_iff eqvts)[1] apply (rename_tac M N u K) -apply (subgoal_tac "Lam n (M+ $ n~ $ K) = Lam u (M+ $ u~ $ K)") +apply (subgoal_tac "Lam n (M+ $$ n~ $$ K) = Lam u (M+ $$ u~ $$ K)") apply (simp only:) apply (auto simp add: Abs1_eq_iff swap_fresh_fresh fresh_at_base)[1] -apply (subgoal_tac "Lam m (Na* $ Lam n (m~ $ n~ $ Ka)) = Lam ma (Na* $ Lam na (ma~ $ na~ $ Ka))") +apply (subgoal_tac "Lam m (Na* $$ Lam n (m~ $$ n~ $$ Ka)) = Lam ma (Na* $$ Lam na (ma~ $$ na~ $$ Ka))") apply (simp only:) apply (simp add: Abs1_eq_iff swap_fresh_fresh fresh_at_base) apply(simp_all add: flip_def[symmetric]) @@ -146,7 +146,7 @@ section{* lemma related to Kapply *} -lemma [simp]: "isValue V \ V; K = K $ (V+)" +lemma [simp]: "isValue V \ V; K = K $$ (V+)" by (nominal_induct V rule: lt.strong_induct) auto section{* lemma related to CPS conversion *} @@ -154,14 +154,14 @@ lemma value_CPS: assumes "isValue V" and "atom a \ V" - shows "V* = Lam a (a~ $ V+)" + shows "V* = Lam a (a~ $$ V+)" using assms proof (nominal_induct V avoiding: a rule: lt.strong_induct, simp_all add: lt.fresh) fix name :: name and lt aa - assume a: "atom name \ aa" "\b. \isValue lt; atom b \ lt\ \ lt* = Lam b (b~ $ lt+)" + assume a: "atom name \ aa" "\b. \isValue lt; atom b \ lt\ \ lt* = Lam b (b~ $$ lt+)" "atom aa \ lt \ aa = name" obtain ab :: name where b: "atom ab \ (name, lt, a)" using obtain_fresh by blast - show "Lam name lt* = Lam aa (aa~ $ Lam name (lt*))" using a b + show "Lam name lt* = Lam aa (aa~ $$ Lam name (lt*))" using a b by (simp add: Abs1_eq_iff fresh_at_base lt.fresh) qed @@ -190,7 +190,7 @@ obtain a :: name where a: "atom a \ (lt1[x ::= V], lt1, lt2[x ::= V], lt2, V, x)" using obtain_fresh by blast obtain b :: name where b: "atom b \ (lt2[x ::= V], lt2, a, V, x)" using obtain_fresh by blast obtain c :: name where c: "atom c \ (a, b, V, x)" using obtain_fresh by blast - show "((lt1 $ lt2)[x ::= V])* = (lt1 $ lt2)*[x ::= V+]" using * a b c + show "((lt1 $$ lt2)[x ::= V])* = (lt1 $$ lt2)*[x ::= V+]" using * a b c by (simp add: fresh_at_base) qed @@ -199,52 +199,52 @@ lemma CPS_eval_Kapply: assumes a: "isValue K" - shows "(M* $ K) \\<^isub>\\<^sup>* (M ; K)" + shows "(M* $$ K) \\<^isub>\\<^sup>* (M ; K)" using a proof (nominal_induct M avoiding: K rule: lt.strong_induct, simp_all) case (Var name K) assume *: "isValue K" obtain a :: name where a: "atom a \ (name, K)" using obtain_fresh by blast - show "(name~)* $ K \\<^isub>\\<^sup>* K $ name~" using * a + show "(name~)* $$ K \\<^isub>\\<^sup>* K $$ name~" using * a by simp (rule evbeta', simp_all add: fresh_at_base) next fix name :: name and lt K - assume *: "atom name \ K" "\b. isValue b \ lt* $ b \\<^isub>\\<^sup>* lt ; b" "isValue K" + assume *: "atom name \ K" "\b. isValue b \ lt* $$ b \\<^isub>\\<^sup>* lt ; b" "isValue K" obtain a :: name where a: "atom a \ (name, K, lt)" using obtain_fresh by blast then have b: "atom name \ a" using fresh_PairD(1) fresh_at_base atom_eq_iff by metis - show "Lam name lt* $ K \\<^isub>\\<^sup>* K $ Lam name (lt*)" using * a b + show "Lam name lt* $$ K \\<^isub>\\<^sup>* K $$ Lam name (lt*)" using * a b by simp (rule evbeta', simp_all) next fix lt1 lt2 K - assume *: "\b. isValue b \ lt1* $ b \\<^isub>\\<^sup>* lt1 ; b" "\b. isValue b \ lt2* $ b \\<^isub>\\<^sup>* lt2 ; b" "isValue K" + assume *: "\b. isValue b \ lt1* $$ b \\<^isub>\\<^sup>* lt1 ; b" "\b. isValue b \ lt2* $$ b \\<^isub>\\<^sup>* lt2 ; b" "isValue K" obtain a :: name where a: "atom a \ (lt1, lt2, K)" using obtain_fresh by blast obtain b :: name where b: "atom b \ (lt1, lt2, K, a)" using obtain_fresh by blast obtain c :: name where c: "atom c \ (lt1, lt2, K, a, b)" using obtain_fresh by blast have d: "atom a \ lt1" "atom a \ lt2" "atom a \ K" "atom b \ lt1" "atom b \ lt2" "atom b \ K" "atom b \ a" "atom c \ lt1" "atom c \ lt2" "atom c \ K" "atom c \ a" "atom c \ b" using fresh_Pair a b c by simp_all - have "(lt1 $ lt2)* $ K \\<^isub>\\<^sup>* lt1* $ Lam b (lt2* $ Lam c (b~ $ c~ $ K))" using * d + have "(lt1 $$ lt2)* $$ K \\<^isub>\\<^sup>* lt1* $$ Lam b (lt2* $$ Lam c (b~ $$ c~ $$ K))" using * d by (simp add: fresh_at_base) (rule evbeta', simp_all add: fresh_at_base) - also have "... \\<^isub>\\<^sup>* lt1 $ lt2 ; K" proof (cases "isValue lt1") + also have "... \\<^isub>\\<^sup>* lt1 $$ lt2 ; K" proof (cases "isValue lt1") assume e: "isValue lt1" - have "lt1* $ Lam b (lt2* $ Lam c (b~ $ c~ $ K)) \\<^isub>\\<^sup>* Lam b (lt2* $ Lam c (b~ $ c~ $ K)) $ lt1+" + have "lt1* $$ Lam b (lt2* $$ Lam c (b~ $$ c~ $$ K)) \\<^isub>\\<^sup>* Lam b (lt2* $$ Lam c (b~ $$ c~ $$ K)) $$ lt1+" using * d e by simp - also have "... \\<^isub>\\<^sup>* lt2* $ Lam c (lt1+ $ c~ $ K)" + also have "... \\<^isub>\\<^sup>* lt2* $$ Lam c (lt1+ $$ c~ $$ K)" by (rule evbeta')(simp_all add: * d e) - also have "... \\<^isub>\\<^sup>* lt1 $ lt2 ; K" proof (cases "isValue lt2") + also have "... \\<^isub>\\<^sup>* lt1 $$ lt2 ; K" proof (cases "isValue lt2") assume f: "isValue lt2" - have "lt2* $ Lam c (lt1+ $ c~ $ K) \\<^isub>\\<^sup>* Lam c (lt1+ $ c~ $ K) $ lt2+" using * d e f by simp - also have "... \\<^isub>\\<^sup>* lt1+ $ lt2+ $ K" + have "lt2* $$ Lam c (lt1+ $$ c~ $$ K) \\<^isub>\\<^sup>* Lam c (lt1+ $$ c~ $$ K) $$ lt2+" using * d e f by simp + also have "... \\<^isub>\\<^sup>* lt1+ $$ lt2+ $$ K" by (rule evbeta', simp_all add: d e f) finally show ?thesis using * d e f by simp next assume f: "\ isValue lt2" - have "lt2* $ Lam c (lt1+ $ c~ $ K) \\<^isub>\\<^sup>* lt2 ; Lam c (lt1+ $ c~ $ K)" using * d e f by simp - also have "... \\<^isub>\\<^sup>* lt2 ; Lam a (lt1+ $ a~ $ K)" using Kapply.simps(4) d e evs1 f by metis + have "lt2* $$ Lam c (lt1+ $$ c~ $$ K) \\<^isub>\\<^sup>* lt2 ; Lam c (lt1+ $$ c~ $$ K)" using * d e f by simp + also have "... \\<^isub>\\<^sup>* lt2 ; Lam a (lt1+ $$ a~ $$ K)" using Kapply.simps(4) d e evs1 f by metis finally show ?thesis using * d e f by simp qed finally show ?thesis . qed (metis Kapply.simps(5) isValue.simps(2) * d) - finally show "(lt1 $ lt2)* $ K \\<^isub>\\<^sup>* lt1 $ lt2 ; K" . + finally show "(lt1 $$ lt2)* $$ K \\<^isub>\\<^sup>* lt1 $$ lt2 ; K" . qed lemma Kapply_eval: @@ -255,24 +255,24 @@ case (evbeta x V M) fix K assume a: "isValue K" "isValue V" "atom x \ V" - have "Lam x (M*) $ V+ $ K \\<^isub>\\<^sup>* (((M*)[x ::= V+]) $ K)" + have "Lam x (M*) $$ V+ $$ K \\<^isub>\\<^sup>* (((M*)[x ::= V+]) $$ K)" by (rule evs2,rule ev2,rule Lt.evbeta) (simp_all add: fresh_def a[simplified fresh_def] evs1) - also have "... = ((M[x ::= V])* $ K)" by (simp add: CPS_subst_fv a) + also have "... = ((M[x ::= V])* $$ K)" by (simp add: CPS_subst_fv a) also have "... \\<^isub>\\<^sup>* ((M[x ::= V]) ; K)" by (rule CPS_eval_Kapply, simp_all add: a) - finally show "(Lam x M $ V ; K) \\<^isub>\\<^sup>* ((M[x ::= V]) ; K)" using a by simp + finally show "(Lam x M $$ V ; K) \\<^isub>\\<^sup>* ((M[x ::= V]) ; K)" using a by simp next case (ev1 V M N) fix V M N K assume a: "isValue V" "M \\<^isub>\ N" "\K. isValue K \ M ; K \\<^isub>\\<^sup>* N ; K" "isValue K" obtain a :: name where b: "atom a \ (V, K, M, N)" using obtain_fresh by blast - show "V $ M ; K \\<^isub>\\<^sup>* V $ N ; K" proof (cases "isValue N") + show "V $$ M ; K \\<^isub>\\<^sup>* V $$ N ; K" proof (cases "isValue N") assume "\ isValue N" - then show "V $ M ; K \\<^isub>\\<^sup>* V $ N ; K" using a b by simp + then show "V $$ M ; K \\<^isub>\\<^sup>* V $$ N ; K" using a b by simp next assume n: "isValue N" - have c: "M; Lam a (V+ $ a~ $ K) \\<^isub>\\<^sup>* Lam a (V+ $ a~ $ K) $ N+" using a b by (simp add: n) - also have d: "... \\<^isub>\\<^sup>* V+ $ N+ $ K" by (rule evbeta') (simp_all add: a b n) - finally show "V $ M ; K \\<^isub>\\<^sup>* V $ N ; K" using a b by (simp add: n) + have c: "M; Lam a (V+ $$ a~ $$ K) \\<^isub>\\<^sup>* Lam a (V+ $$ a~ $$ K) $$ N+" using a b by (simp add: n) + also have d: "... \\<^isub>\\<^sup>* V+ $$ N+ $$ K" by (rule evbeta') (simp_all add: a b n) + finally show "V $$ M ; K \\<^isub>\\<^sup>* V $$ N ; K" using a b by (simp add: n) qed next case (ev2 M M' N) @@ -281,21 +281,21 @@ obtain b :: name where b: "atom b \ (a, K, M, N, M', N+)" using obtain_fresh by blast have d: "atom a \ K" "atom a \ M" "atom a \ N" "atom a \ M'" "atom b \ a" "atom b \ K" "atom b \ M" "atom b \ N" "atom b \ M'" using a b fresh_Pair by simp_all - have "M $ N ; K \\<^isub>\\<^sup>* M' ; Lam a (N* $ Lam b (a~ $ b~ $ K))" using * d by simp - also have "... \\<^isub>\\<^sup>* M' $ N ; K" proof (cases "isValue M'") + have "M $$ N ; K \\<^isub>\\<^sup>* M' ; Lam a (N* $$ Lam b (a~ $$ b~ $$ K))" using * d by simp + also have "... \\<^isub>\\<^sup>* M' $$ N ; K" proof (cases "isValue M'") assume "\ isValue M'" then show ?thesis using * d by (simp_all add: evs1) next assume e: "isValue M'" - then have "M' ; Lam a (N* $ Lam b (a~ $ b~ $ K)) = Lam a (N* $ Lam b (a~ $ b~ $ K)) $ M'+" by simp - also have "... \\<^isub>\\<^sup>* (N* $ Lam b (a~ $ b~ $ K))[a ::= M'+]" + then have "M' ; Lam a (N* $$ Lam b (a~ $$ b~ $$ K)) = Lam a (N* $$ Lam b (a~ $$ b~ $$ K)) $$ M'+" by simp + also have "... \\<^isub>\\<^sup>* (N* $$ Lam b (a~ $$ b~ $$ K))[a ::= M'+]" by (rule evbeta') (simp_all add: fresh_at_base e d) - also have "... = N* $ Lam b (M'+ $ b~ $ K)" using * d by (simp add: fresh_at_base) - also have "... \\<^isub>\\<^sup>* M' $ N ; K" proof (cases "isValue N") + also have "... = N* $$ Lam b (M'+ $$ b~ $$ K)" using * d by (simp add: fresh_at_base) + also have "... \\<^isub>\\<^sup>* M' $$ N ; K" proof (cases "isValue N") assume f: "isValue N" - have "N* $ Lam b (M'+ $ b~ $ K) \\<^isub>\\<^sup>* Lam b (M'+ $ b~ $ K) $ N+" + have "N* $$ Lam b (M'+ $$ b~ $$ K) \\<^isub>\\<^sup>* Lam b (M'+ $$ b~ $$ K) $$ N+" by (rule eval_trans, rule CPS_eval_Kapply) (simp_all add: d e f * evs1) - also have "... \\<^isub>\\<^sup>* M' $ N ; K" by (rule evbeta') (simp_all add: d e f evs1) + also have "... \\<^isub>\\<^sup>* M' $$ N ; K" by (rule evbeta') (simp_all add: d e f evs1) finally show ?thesis . next assume "\ isValue N" @@ -315,17 +315,17 @@ lemma assumes "isValue V" "M \\<^isub>\\<^sup>* V" - shows "M* $ (Lam x (x~)) \\<^isub>\\<^sup>* V+" + shows "M* $$ (Lam x (x~)) \\<^isub>\\<^sup>* V+" proof- obtain y::name where *: "atom y \ V" using obtain_fresh by blast have e: "Lam x (x~) = Lam y (y~)" by (simp add: Abs1_eq_iff lt.fresh fresh_at_base) - have "M* $ Lam x (x~) \\<^isub>\\<^sup>* M ; Lam x (x~)" + have "M* $$ Lam x (x~) \\<^isub>\\<^sup>* M ; Lam x (x~)" by(rule CPS_eval_Kapply,simp_all add: assms) also have "... \\<^isub>\\<^sup>* (V ; Lam x (x~))" by (rule Kapply_eval_rtrancl, simp_all add: assms) also have "... = V ; Lam y (y~)" using e by (simp only:) also have "... \\<^isub>\\<^sup>* (V+)" by (simp add: assms, rule evbeta') (simp_all add: assms *) - finally show "M* $ (Lam x (x~)) \\<^isub>\\<^sup>* (V+)" . + finally show "M* $$ (Lam x (x~)) \\<^isub>\\<^sup>* (V+)" . qed end diff -r 425b4c406d80 -r b3d97424b130 Nominal/Ex/CPS/CPS2_DanvyNielsen.thy --- a/Nominal/Ex/CPS/CPS2_DanvyNielsen.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Ex/CPS/CPS2_DanvyNielsen.thy Tue Jun 12 01:23:52 2012 +0100 @@ -13,8 +13,8 @@ fill :: "cpsctxt \ lt \ lt" ("_<_>" [200, 200] 100) where fill_hole : "Hole = M" -| fill_fun : "(CFun C N) = (C) $ N" -| fill_arg : "(CArg N C) = N $ (C)" +| fill_fun : "(CFun C N) = (C) $$ N" +| fill_arg : "(CArg N C) = N $$ (C)" | fill_abs : "atom x \ M \ (CAbs x C) = Lam x (C)" unfolding eqvt_def fill_graph_def apply perm_simp @@ -64,14 +64,14 @@ | "CPS (Var x) = CFun Hole (x~)" | "atom b \ M \ CPSv (Lam y M) = Lam y (Lam b ((CPS M)))" | "atom b \ M \ CPS (Lam y M) = CFun Hole (Lam y (Lam b ((CPS M))))" -| "CPSv (M $ N) = Lam x (Var x)" -| "isValue M \ isValue N \ CPS (M $ N) = CArg (CPSv M $ CPSv N) Hole" -| "isValue M \ ~isValue N \ atom a \ M \ CPS (M $ N) = - ccomp (CPS N) (CAbs a (CArg (CPSv M $ Var a) Hole))" -| "~isValue M \ isValue N \ atom a \ N \ CPS (M $ N) = - ccomp (CPS M) (CAbs a (CArg (Var a $ (CPSv N)) Hole))" -| "~isValue M \ ~isValue N \ atom a \ (N, b) \ CPS (M $ N) = - ccomp (CPS M) (CAbs a (ccomp (CPS N) (CAbs b (CArg (Var a $ Var b) Hole))))" +| "CPSv (M $$ N) = Lam x (Var x)" +| "isValue M \ isValue N \ CPS (M $$ N) = CArg (CPSv M $$ CPSv N) Hole" +| "isValue M \ ~isValue N \ atom a \ M \ CPS (M $$ N) = + ccomp (CPS N) (CAbs a (CArg (CPSv M $$ Var a) Hole))" +| "~isValue M \ isValue N \ atom a \ N \ CPS (M $$ N) = + ccomp (CPS M) (CAbs a (CArg (Var a $$ (CPSv N)) Hole))" +| "~isValue M \ ~isValue N \ atom a \ (N, b) \ CPS (M $$ N) = + ccomp (CPS M) (CAbs a (ccomp (CPS N) (CAbs b (CArg (Var a $$ Var b) Hole))))" apply auto defer apply (case_tac x) diff -r 425b4c406d80 -r b3d97424b130 Nominal/Ex/CPS/CPS3_DanvyFilinski.thy --- a/Nominal/Ex/CPS/CPS3_DanvyFilinski.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Ex/CPS/CPS3_DanvyFilinski.thy Tue Jun 12 01:23:52 2012 +0100 @@ -7,12 +7,12 @@ CPS2 :: "lt \ lt \ lt" ("_^_" [100,100] 100) where "eqvt k \ (x~)*k = k (x~)" -| "eqvt k \ (M$N)*k = M*(%m. (N*(%n.((m $ n) $ (Lam c (k (c~)))))))" +| "eqvt k \ (M$$N)*k = M*(%m. (N*(%n.((m $$ n) $$ (Lam c (k (c~)))))))" | "eqvt k \ atom c \ (x, M) \ (Lam x M)*k = k (Lam x (Lam c (M^(c~))))" | "\eqvt k \ (CPS1 t k) = t" -| "(x~)^l = l $ (x~)" -| "(M$N)^l = M*(%m. (N*(%n.((m $ n) $ l))))" -| "atom c \ (x, M) \ (Lam x M)^l = l $ (Lam x (Lam c (M^(c~))))" +| "(x~)^l = l $$ (x~)" +| "(M$$N)^l = M*(%m. (N*(%n.((m $$ n) $$ l))))" +| "atom c \ (x, M) \ (Lam x M)^l = l $$ (Lam x (Lam c (M^(c~))))" apply (simp only: eqvt_def CPS1_CPS2_graph_def) apply (rule, perm_simp, rule) apply auto diff -r 425b4c406d80 -r b3d97424b130 Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy --- a/Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy Tue Jun 12 01:23:52 2012 +0100 @@ -9,12 +9,12 @@ CPS2 :: "lt \ lt \ lt" ("_^_" [100,100] 100) where "eqvt k \ (x~)*k = k (x~)" -| "eqvt k \ (M$N)*k = M*(%m. (N*(%n.((m $ n) $ (Lam c (k (c~)))))))" +| "eqvt k \ (M $$ N)*k = M*(%m. (N*(%n.((m $$ n) $$ (Lam c (k (c~)))))))" | "eqvt k \ atom c \ (x, M) \ (Lam x M)*k = k (Lam x (Lam c (M^(c~))))" | "\eqvt k \ (CPS1 t k) = t" -| "(x~)^l = l $ (x~)" -| "(M$N)^l = M*(%m. (N*(%n.((m $ n) $ l))))" -| "atom c \ (x, M) \ (Lam x M)^l = l $ (Lam x (Lam c (M^(c~))))" +| "(x~)^l = l $$ (x~)" +| "(M $$ N)^l = M*(%m. (N*(%n.((m $$ n) $$ l))))" +| "atom c \ (x, M) \ (Lam x M)^l = l $$ (Lam x (Lam c (M^(c~))))" apply (simp only: eqvt_def CPS1_CPS2_graph_def) apply (rule, perm_simp, rule) apply (auto simp only:) diff -r 425b4c406d80 -r b3d97424b130 Nominal/Ex/CPS/Lt.thy --- a/Nominal/Ex/CPS/Lt.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Ex/CPS/Lt.thy Tue Jun 12 01:23:52 2012 +0100 @@ -7,7 +7,7 @@ nominal_datatype lt = Var name ("_~" [150] 149) - | App lt lt (infixl "$" 100) + | App lt lt (infixl "$$" 100) | Lam x::"name" t::"lt" binds x in t nominal_primrec @@ -49,7 +49,7 @@ where "isValue (Var x) = True" | "isValue (Lam y N) = True" -| "isValue (A $ B) = False" +| "isValue (A $$ B) = False" unfolding eqvt_def isValue_graph_def by (perm_simp, auto) (erule lt.exhaust, auto) @@ -60,9 +60,9 @@ inductive eval :: "[lt, lt] \ bool" (" _ \\<^isub>\ _" [80,80] 80) where - evbeta: "\atom x\V; isValue V\ \ ((Lam x M) $ V) \\<^isub>\ (M[x ::= V])" -| ev1: "\isValue V; M \\<^isub>\ M' \ \ (V $ M) \\<^isub>\ (V $ M')" -| ev2: "M \\<^isub>\ M' \ (M $ N) \\<^isub>\ (M' $ N)" + evbeta: "\atom x\V; isValue V\ \ ((Lam x M) $$ V) \\<^isub>\ (M[x ::= V])" +| ev1: "\isValue V; M \\<^isub>\ M' \ \ (V $$ M) \\<^isub>\ (V $$ M')" +| ev2: "M \\<^isub>\ M' \ (M $$ N) \\<^isub>\ (M' $$ N)" equivariance eval @@ -111,7 +111,7 @@ lemma evbeta': fixes x :: name assumes "isValue V" and "atom x\V" and "N = (M[x ::= V])" - shows "((Lam x M) $ V) \\<^isub>\\<^sup>* N" + shows "((Lam x M) $$ V) \\<^isub>\\<^sup>* N" using assms by simp (rule evs2, rule evbeta, simp_all add: evs1) end diff -r 425b4c406d80 -r b3d97424b130 Nominal/Nominal2_Base.thy --- a/Nominal/Nominal2_Base.thy Mon Jun 11 14:02:57 2012 +0100 +++ b/Nominal/Nominal2_Base.thy Tue Jun 12 01:23:52 2012 +0100 @@ -8,6 +8,7 @@ imports Main "~~/src/HOL/Library/Infinite_Set" "~~/src/HOL/Quotient_Examples/FSet" + "~~/src/HOL/Library/FinFun_Syntax" keywords "atom_decl" "equivariance" :: thy_decl uses ("nominal_basics.ML") @@ -654,6 +655,30 @@ by (lifting set_eqvt) +subsection {* Permutations for @{typ "'a \f 'b"} (FinFuns) *} + +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 + +instance +apply(default) +apply(simp_all add: permute_finfun_def finfun_apply_inverse Rep_finfun_permute Abs_finfun_inverse) +done + +end + + subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *} instantiation char :: pt @@ -1190,6 +1215,25 @@ 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) + + section {* Supp, Freshness and Supports *} @@ -2187,6 +2231,37 @@ done +subsection {* Type @{typ "'a \f 'b"} is finitely supported *} + +lemma fresh_finfun_const: + shows "a \ (K$ 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)" + unfolding fresh_conv_MOST + unfolding permute_finfun_update + by (elim MOST_rev_mp) (simp) + +lemma supp_finfun_const: + "supp (K$ b) = supp(b)" + by (simp add: supp_def) + +lemma supp_finfun_update: + "supp (f(a $:= b)) \ supp(f, a, b)" +using fresh_finfun_update +by (auto simp add: fresh_def supp_Pair) + +instance finfun :: (fs, fs) fs + apply(default) + apply(induct_tac x rule: finfun_weak_induct) + apply(simp add: supp_finfun_const finite_supp) + apply(rule finite_subset) + apply(rule supp_finfun_update) + apply(simp add: supp_Pair finite_supp) + done + + section {* Freshness and Fresh-Star *} lemma fresh_Unit_elim: