# HG changeset patch # User Christian Urban # Date 1400499926 -3600 # Node ID 5ebd327ffb96d118e923d20540020d236216b971 # Parent 08c3ef07cef78e3ae595b4d2ec698f7751330543 changed nominal_primrec into the more appropriate nominal_function diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/AuxNoFCB.thy --- a/Nominal/Ex/AuxNoFCB.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/AuxNoFCB.thy Mon May 19 12:45:26 2014 +0100 @@ -7,7 +7,7 @@ | App "lam" "lam" | Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) -nominal_primrec lookup where +nominal_function lookup where "lookup (n :: name) m [] \ (n = m)" | "lookup n m ((hn, hm) # t) \ (n, m) = (hn, hm) \ (n \ hn \ m \ hm \ lookup n m t)" @@ -17,7 +17,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec lam2_rec where +nominal_function lam2_rec where "lam2_rec faa fll xs (Var n) (Var m) = lookup n m xs" | "lam2_rec faa fll xs (Var n) (App l r) = False" | "lam2_rec faa fll xs (Var n) (Lam [x]. t) = False" @@ -97,7 +97,7 @@ apply (subst lam2_rec.simps(10)) apply (simp_all add: fresh_star_def) done -nominal_primrec aux :: "lam \ lam \ (name \ name) list \ bool" +nominal_function aux :: "lam \ lam \ (name \ name) list \ bool" where [simp del]: "aux l r xs = lam2_rec (%t1 t2 t3 t4. (aux t1 t3 xs) \ (aux t2 t4 xs)) @@ -204,7 +204,7 @@ apply lexicographic_order done -nominal_primrec swapequal :: "lam \ lam \ (name \ name) list \ bool" where +nominal_function swapequal :: "lam \ lam \ (name \ name) list \ bool" where "swapequal l r [] \ l = r" | "atom x \ (l, r, hl, hr, t) \ swapequal l r ((hl, hr) # t) \ swapequal ((hl \ x) \ l) ((hr \ x) \ r) t" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Beta.thy --- a/Nominal/Ex/Beta.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Beta.thy Mon May 19 12:45:26 2014 +0100 @@ -14,7 +14,7 @@ section {* capture-avoiding substitution *} -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CPS/CPS1_Plotkin.thy --- a/Nominal/Ex/CPS/CPS1_Plotkin.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CPS/CPS1_Plotkin.thy Mon May 19 12:45:26 2014 +0100 @@ -3,7 +3,7 @@ imports Lt begin -nominal_primrec +nominal_function CPS :: "lt \ lt" ("_*" [250] 250) where "atom k \ x \ (x~)* = (Lam k ((k~) $$ (x~)))" @@ -74,7 +74,7 @@ lemma [simp]: "x \ M* = x \ M" unfolding fresh_def by simp -nominal_primrec +nominal_function convert:: "lt => lt" ("_+" [250] 250) where "(Var x)+ = Var x" @@ -104,7 +104,7 @@ shows "isValue (p \ (M::lt)) = isValue M" by (nominal_induct M rule: lt.strong_induct) auto -nominal_primrec +nominal_function Kapply :: "lt \ lt \ lt" (infixl ";" 100) where "Kapply (Lam x M) K = K $$ (Lam x M)+" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CPS/CPS2_DanvyNielsen.thy --- a/Nominal/Ex/CPS/CPS2_DanvyNielsen.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CPS/CPS2_DanvyNielsen.thy Mon May 19 12:45:26 2014 +0100 @@ -9,7 +9,7 @@ | CArg lt cpsctxt | CAbs x::name c::cpsctxt binds x in c -nominal_primrec +nominal_function fill :: "cpsctxt \ lt \ lt" ("_<_>" [200, 200] 100) where fill_hole : "Hole = M" @@ -34,7 +34,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec +nominal_function ccomp :: "cpsctxt => cpsctxt => cpsctxt" where "ccomp Hole C = C" @@ -59,7 +59,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec +nominal_function CPSv :: "lt => lt" and CPS :: "lt => cpsctxt" where "CPSv (Var x) = x~" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CPS/CPS3_DanvyFilinski.thy --- a/Nominal/Ex/CPS/CPS3_DanvyFilinski.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CPS/CPS3_DanvyFilinski.thy Mon May 19 12:45:26 2014 +0100 @@ -1,7 +1,7 @@ header {* CPS transformation of Danvy and Filinski *} theory CPS3_DanvyFilinski imports Lt begin -nominal_primrec +nominal_function CPS1 :: "lt \ (lt \ lt) \ lt" ("_*_" [100,100] 100) and CPS2 :: "lt \ lt \ lt" ("_^_" [100,100] 100) diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy --- a/Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy Mon May 19 12:45:26 2014 +0100 @@ -3,7 +3,7 @@ imports Lt begin -nominal_primrec +nominal_function CPS1 :: "lt \ (lt \ lt) \ lt" ("_*_" [100,100] 100) and CPS2 :: "lt \ lt \ lt" ("_^_" [100,100] 100) diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CPS/Lt.thy --- a/Nominal/Ex/CPS/Lt.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CPS/Lt.thy Mon May 19 12:45:26 2014 +0100 @@ -10,7 +10,7 @@ | App lt lt (infixl "$$" 100) | Lam x::"name" t::"lt" binds x in t -nominal_primrec +nominal_function subst :: "lt \ name \ lt \ lt" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" @@ -44,7 +44,7 @@ by (nominal_induct M avoiding: x V rule: lt.strong_induct) (auto simp add: lt.supp supp_at_base, blast, blast) -nominal_primrec +nominal_function isValue:: "lt => bool" where "isValue (Var x) = True" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/CR.thy --- a/Nominal/Ex/CR.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/CR.thy Mon May 19 12:45:26 2014 +0100 @@ -10,7 +10,7 @@ | App "lam" "lam" | Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Classical.thy --- a/Nominal/Ex/Classical.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Classical.thy Mon May 19 12:45:26 2014 +0100 @@ -47,7 +47,7 @@ thm trm.supp thm trm.supp[simplified] -nominal_primrec +nominal_function crename :: "trm \ coname \ coname \ trm" ("_[_\c>_]" [100,100,100] 100) where "(Ax x a)[d\c>e] = (if a=d then Ax x e else Ax x a)" @@ -252,7 +252,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec +nominal_function nrename :: "trm \ name \ name \ trm" ("_[_\n>_]" [100,100,100] 100) where "(Ax x a)[u\n>v] = (if x=u then Ax v a else Ax x a)" @@ -449,7 +449,7 @@ thm crename.eqvt nrename.eqvt -nominal_primrec +nominal_function substn :: "trm \ name \ coname \ trm \ trm" ("_{_:=<_>._}" [100,100,100,100] 100) where "(Ax x a){y:=.P} = (if x=y then Cut .P (y).Ax y a else Ax x a)" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Exec/Lambda_Exec.thy --- a/Nominal/Ex/Exec/Lambda_Exec.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Exec/Lambda_Exec.thy Mon May 19 12:45:26 2014 +0100 @@ -7,7 +7,7 @@ | App "lam" "lam" | Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" @@ -122,7 +122,7 @@ shows "(p \ lookup xs n x) = lookup (p \ xs) (p \ n) (p \ x)" by (induct xs arbitrary: n) (simp_all add: permute_pure) -nominal_primrec (invariant "\(_, xs) y. atom ` set xs \* y") +nominal_function (invariant "\(_, xs) y. atom ` set xs \* y") lam_ln_aux :: "lam \ name list \ ln" where "lam_ln_aux (Var x) xs = lookup xs 0 x" @@ -164,7 +164,7 @@ apply simp_all done -nominal_primrec +nominal_function ln_lam_aux :: "ln \ name list \ lam" where "ln_lam_aux (LNBnd n) ns = (nth_or_def (map Var ns) n (Lam [x]. Var x))" @@ -321,7 +321,7 @@ "atom y \ subst_ln_nat t x n \ y = x \ atom y \ t" unfolding fresh_def supp_subst_ln_nat by auto -nominal_primrec +nominal_function lam_ln_ex :: "lam \ ln" where "lam_ln_ex (Var x) = LNVar x" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/FiniteType.thy --- a/Nominal/Ex/FiniteType.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/FiniteType.thy Mon May 19 12:45:26 2014 +0100 @@ -16,4 +16,4 @@ -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LamTest.thy --- a/Nominal/Ex/LamTest.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LamTest.thy Mon May 19 12:45:26 2014 +0100 @@ -1507,7 +1507,7 @@ (* outer syntax *) val _ = - Outer_Syntax.local_theory_to_proof "nominal_primrec" "define recursive functions for nominal types" + Outer_Syntax.local_theory_to_proof "nominal_function" "define recursive functions for nominal types" Keyword.thy_goal (function_parser default_config >> (fn ((config, fixes), statements) => function_cmd fixes statements config)) @@ -1545,7 +1545,7 @@ shows "(a \ c) \ x = (b \ c) \ y" using assms by (simp add: swap_fresh_fresh) -nominal_primrec +nominal_function depth :: "lam \ nat" where "depth (Var x) = 1" @@ -1566,7 +1566,7 @@ shows "p \ (removeAll x xs) = removeAll (p \ x) (p \ xs)" by (induct xs) (auto) -nominal_primrec +nominal_function frees_lst :: "lam \ atom list" where "frees_lst (Var x) = [atom x]" @@ -1585,7 +1585,7 @@ apply(clarify) oops -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [100,100,100] 100) where "(Var x)[y ::= s] = (if x=y then s else (Var x))" @@ -1608,7 +1608,7 @@ -nominal_primrec +nominal_function depth :: "lam \ nat" where "depth (Var x) = 1" @@ -1665,7 +1665,7 @@ shows "p \ (removeAll x xs) = removeAll (p \ x) (p \ xs)" by (induct xs) (auto) -nominal_primrec +nominal_function frees_lst :: "lam \ atom list" where "frees_lst (Var x) = [atom x]" @@ -1687,7 +1687,7 @@ apply(rule_tac p="p" in supp_perm_eq) oops -nominal_primrec +nominal_function frees :: "lam \ name set" where "frees (Var x) = {x}" @@ -1771,7 +1771,7 @@ apply(simp add: set_eqvt) sorry -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [100,100,100] 100) where "(Var x)[y ::= s] = (if x=y then s else (Var x))" @@ -1822,7 +1822,7 @@ -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [100,100,100] 100) where "(Var x)[y ::= s] = (if x=y then s else (Var x))" @@ -1874,7 +1874,7 @@ done (* this should not work *) -nominal_primrec +nominal_function bnds :: "lam \ name set" where "bnds (Var x) = {}" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Lambda.thy --- a/Nominal/Ex/Lambda.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Lambda.thy Mon May 19 12:45:26 2014 +0100 @@ -72,7 +72,7 @@ section {* Simple examples from Norrish 2004 *} -nominal_primrec +nominal_function is_app :: "lam \ bool" where "is_app (Var x) = False" @@ -93,7 +93,7 @@ thm eqvts -nominal_primrec +nominal_function rator :: "lam \ lam option" where "rator (Var x) = None" @@ -108,7 +108,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec +nominal_function rand :: "lam \ lam option" where "rand (Var x) = None" @@ -123,7 +123,7 @@ termination (eqvt) by lexicographic_order -nominal_primrec +nominal_function is_eta_nf :: "lam \ bool" where "is_eta_nf (Var x) = True" @@ -154,7 +154,7 @@ apply(simp_all) done -nominal_primrec +nominal_function var_pos :: "name \ lam \ (path list) set" where "var_pos y (Var x) = (if y = x then {[]} else {})" @@ -200,7 +200,7 @@ text {* strange substitution operation *} -nominal_primrec +nominal_function subst' :: "lam \ name \ lam \ lam" ("_ [_ ::== _]" [90, 90, 90] 90) where "(Var x)[y ::== s] = (if x = y then s else (Var x))" @@ -234,7 +234,7 @@ text {* first returns an atom list *} -nominal_primrec +nominal_function frees_lst :: "lam \ atom list" where "frees_lst (Var x) = [atom x]" @@ -260,7 +260,7 @@ text {* second returns an atom set - therefore needs an invariant *} -nominal_primrec (invariant "\x (y::atom set). finite y") +nominal_function (invariant "\x (y::atom set). finite y") frees_set :: "lam \ atom set" where "frees_set (Var x) = {atom x}" @@ -288,7 +288,7 @@ section {* height function *} -nominal_primrec +nominal_function height :: "lam \ int" where "height (Var x) = 1" @@ -311,7 +311,7 @@ section {* capture-avoiding substitution *} -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" @@ -501,7 +501,7 @@ text {* Function that translates lambda-terms into locally nameless terms *} -nominal_primrec (invariant "\(_, xs) y. atom ` set xs \* y") +nominal_function (invariant "\(_, xs) y. atom ` set xs \* y") trans :: "lam \ name list \ ln" where "trans (Var x) xs = lookup xs 0 x" @@ -536,7 +536,7 @@ text {* count the occurences of lambdas in a term *} -nominal_primrec +nominal_function cntlams :: "lam \ nat" where "cntlams (Var x) = 0" @@ -563,7 +563,7 @@ text {* count the bound-variable occurences in a lambda-term *} -nominal_primrec +nominal_function cntbvs :: "lam \ name list \ nat" where "cntbvs (Var x) xs = (if x \ set xs then 1 else 0)" @@ -621,7 +621,7 @@ "(p \ vindex l v n) = vindex (p \ l) (p \ v) (p \ n)" by (induct l arbitrary: n) (simp_all add: permute_pure) -nominal_primrec +nominal_function transdb :: "lam \ name list \ db option" where "transdb (Var x) l = vindex l x 0" @@ -679,7 +679,7 @@ by (induct t x s rule: subst.induct) (auto simp add: lam.supp fresh_at_base) (* function that evaluates a lambda term *) -nominal_primrec +nominal_function eval :: "lam \ lam" and apply_subst :: "lam \ lam \ lam" where @@ -734,7 +734,7 @@ text {* TODO: eqvt_at for the other side *} -nominal_primrec q where +nominal_function q where "atom c \ (x, M) \ q (Lam [x]. M) (N :: lam) = Lam [x]. (Lam [c]. (App M (q (Var c) N)))" | "q (Var x) N = Var x" | "q (App l r) N = App l r" @@ -757,7 +757,7 @@ text {* Working Examples *} -nominal_primrec +nominal_function map_term :: "(lam \ lam) \ lam \ lam" where "eqvt f \ map_term f (Var x) = f (Var x)" @@ -821,7 +821,7 @@ *) (* -nominal_primrec +nominal_function trans2 :: "lam \ atom list \ db option" where "trans2 (Var x) xs = (index xs 0 (atom x) \= (\n::nat. Some (DBVar n)))" @@ -831,7 +831,7 @@ oops *) -nominal_primrec +nominal_function CPS :: "lam \ (lam \ lam) \ lam" where "CPS (Var x) k = Var x" @@ -839,7 +839,7 @@ oops consts b :: name -nominal_primrec +nominal_function Z :: "lam \ (lam \ lam) \ lam" where "Z (App M N) k = Z M (%m. (Z N (%n.(App m n))))" @@ -871,7 +871,7 @@ -nominal_primrec (invariant "\(_, _, xs) y. atom ` fst ` set xs \* y \ atom ` snd ` set xs \* y") +nominal_function (invariant "\(_, _, xs) y. atom ` fst ` set xs \* y \ atom ` snd ` set xs \* y") aux :: "lam \ lam \ (name \ name) list \ bool" where "aux (Var x) (Var y) xs = ((x, y) \ set xs)" @@ -919,7 +919,7 @@ \ [[atom x]]lst. (t, s) = [[atom y]]lst. (ta, sa)" by (cases "atom x = atom y") (auto simp add: Abs1_eq_iff assms fresh_Pair) -nominal_primrec +nominal_function aux2 :: "lam \ lam \ bool" where "aux2 (Var x) (Var y) = (x = y)" @@ -961,7 +961,7 @@ consts P :: "lam \ bool" (* -nominal_primrec +nominal_function A :: "lam => lam" where "A (App M N) = (if (True \ P M) then (A M) else (A N))" @@ -969,7 +969,7 @@ | "A (App M N) = (if True then M else A N)" oops -nominal_primrec +nominal_function C :: "lam => lam" where "C (App M N) = (case (True \ P M) of True \ (A M) | False \ (A N))" @@ -977,7 +977,7 @@ | "C (App M N) = (if True then M else C N)" oops -nominal_primrec +nominal_function A :: "lam => lam" where "A (Lam [x].M) = (Lam [x].M)" @@ -985,7 +985,7 @@ | "A (App M N) = (if True then M else A N)" oops -nominal_primrec +nominal_function B :: "lam => lam" where "B (Lam [x].M) = (Lam [x].M)" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Lambda_F_T.thy --- a/Nominal/Ex/Lambda_F_T.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Lambda_F_T.thy Mon May 19 12:45:26 2014 +0100 @@ -47,7 +47,7 @@ and fcb3: "\t l r. atom ` set (x # l) \* r \ atom ` set (x # l) \* f3 x t r l" begin -nominal_primrec (invariant "\(x, l) y. atom ` set l \* y") +nominal_function (invariant "\(x, l) y. atom ` set l \* y") f where "f (Var x) l = f1 x l" @@ -157,7 +157,7 @@ \ P" sorry -nominal_primrec +nominal_function g where "(~finite (supp (g1, g2, g3))) \ g g1 g2 g3 t = t" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Lambda_F_T_FCB2.thy --- a/Nominal/Ex/Lambda_F_T_FCB2.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Lambda_F_T_FCB2.thy Mon May 19 12:45:26 2014 +0100 @@ -133,7 +133,7 @@ and fcb3: "\t l r. atom ` set (x # l) \* r \ atom ` set (x # l) \* f3 x t r l" begin -nominal_primrec (invariant "\(x, l) y. atom ` set l \* y") +nominal_function (invariant "\(x, l) y. atom ` set l \* y") f where "f (Var x) l = f1 x l" @@ -244,7 +244,7 @@ \ P" sorry -nominal_primrec +nominal_function g where "(~finite (supp (g1, g2, g3))) \ g g1 g2 g3 t = t" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Let.thy --- a/Nominal/Ex/Let.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Let.thy Mon May 19 12:45:26 2014 +0100 @@ -107,7 +107,7 @@ apply simp_all done -nominal_primrec +nominal_function height_trm :: "trm \ nat" where "height_trm (Var x) = 1" @@ -160,7 +160,7 @@ apply (simp_all add: trm_assn.bn_defs) done -nominal_primrec +nominal_function subst :: "name \ trm \ trm \ trm" where "subst s t (Var x) = (if (s = x) then t else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetFun.thy --- a/Nominal/Ex/LetFun.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetFun.thy Mon May 19 12:45:26 2014 +0100 @@ -40,4 +40,4 @@ thm exp_pat.supp -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetInv.thy --- a/Nominal/Ex/LetInv.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetInv.thy Mon May 19 12:45:26 2014 +0100 @@ -223,7 +223,7 @@ apply (simp add: Abs_eq_iff alphas supp_atom fresh_star_def neq) done -nominal_primrec +nominal_function subst :: "name \ trm \ trm \ trm" where "subst s t (Var x) = (if (s = x) then t else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetRec.thy --- a/Nominal/Ex/LetRec.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetRec.thy Mon May 19 12:45:26 2014 +0100 @@ -28,7 +28,7 @@ thm let_rec.size_eqvt -nominal_primrec +nominal_function height_trm :: "trm \ nat" and height_bp :: "bp \ nat" where diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetRecFunNo.thy --- a/Nominal/Ex/LetRecFunNo.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetRecFunNo.thy Mon May 19 12:45:26 2014 +0100 @@ -17,7 +17,7 @@ "bn ANil = []" | "bn (ACons x t as) = (atom x) # (bn as)" -nominal_primrec substrec where +nominal_function substrec where "substrec fa fl fd y z (Var x) = (if (y = x) then z else (Var x))" | "substrec fa fl fd y z (App l r) = fa l r" | "(set (bn as) \* (Let as t, y, z) \ (\bs s. set (bn bs) \* (Let bs s, y, z) \ Let as t = Let bs s \ fl as t = fl bs s)) \ @@ -55,7 +55,7 @@ done termination (eqvt) by lexicographic_order -nominal_primrec substarec :: "(name \ trm \ assn \ assn) \ assn \ assn" where +nominal_function substarec :: "(name \ trm \ assn \ assn) \ assn \ assn" where "substarec fac ANil = ANil" | "substarec fac (ACons x t as) = fac x t as" unfolding eqvt_def substarec_graph_def diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetSimple1.thy --- a/Nominal/Ex/LetSimple1.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetSimple1.thy Mon May 19 12:45:26 2014 +0100 @@ -25,7 +25,7 @@ thm trm.strong_exhaust thm trm.perm_bn_simps -nominal_primrec +nominal_function height_trm :: "trm \ nat" where "height_trm (Var x) = 1" @@ -51,7 +51,7 @@ by lexicographic_order -nominal_primrec (invariant "\x (y::atom set). finite y") +nominal_function (invariant "\x (y::atom set). finite y") frees_set :: "trm \ atom set" where "frees_set (Var x) = {atom x}" @@ -79,7 +79,7 @@ by lexicographic_order -nominal_primrec +nominal_function subst :: "trm \ name \ trm \ trm" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" @@ -108,4 +108,4 @@ by lexicographic_order -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/LetSimple2.thy --- a/Nominal/Ex/LetSimple2.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/LetSimple2.thy Mon May 19 12:45:26 2014 +0100 @@ -111,7 +111,7 @@ done -nominal_primrec +nominal_function height_trm :: "trm \ nat" where "height_trm (Var x) = 1" @@ -143,7 +143,7 @@ termination by lexicographic_order *) -nominal_primrec +nominal_function subst_trm :: "trm \ name \ trm \ trm" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" @@ -197,7 +197,7 @@ -nominal_primrec +nominal_function <<<<<<< variant A (invariant "\x y. case x of Inl x1 \ True | Inr x2 \ alpha_bn_preserve (height_assn2::assn \ nat) x2") >>>>>>> variant B @@ -334,7 +334,7 @@ text {* works, but only because no recursion in as *} -nominal_primrec (invariant "\x (y::atom set). finite y") +nominal_function (invariant "\x (y::atom set). finite y") frees_set :: "trm \ atom set" where "frees_set (Var x) = {atom x}" @@ -381,7 +381,7 @@ done -nominal_primrec (default "sum_case (\x. Inl undefined) (\x. Inr undefined)") +nominal_function (default "sum_case (\x. Inl undefined) (\x. Inr undefined)") subst_trm2 :: "trm \ name \ trm \ trm" ("_ [_ ::trm2= _]" [90, 90, 90] 90) and subst_assn2 :: "assn \ name \ trm \ assn" ("_ [_ ::assn2= _]" [90, 90, 90] 90) where @@ -488,4 +488,4 @@ done -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Let_ExhaustIssue.thy --- a/Nominal/Ex/Let_ExhaustIssue.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Let_ExhaustIssue.thy Mon May 19 12:45:26 2014 +0100 @@ -64,7 +64,7 @@ shows "f as x c = f bs y c" sorry -nominal_primrec +nominal_function height_trm :: "trm \ nat" and height_assn :: "assn \ nat" where diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Local_Contexts.thy --- a/Nominal/Ex/Local_Contexts.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Local_Contexts.thy Mon May 19 12:45:26 2014 +0100 @@ -29,7 +29,7 @@ lemma atom_image_set_eq_supp: "atom ` set xs = supp xs" by (metis image_set set_map_atom_eq_supp) -nominal_primrec (in name_subst) +nominal_function (in name_subst) subst :: "lam \ name list \ lam \ lam" ("_[_::=_]" [120,120,120] 120) where "(Var x)[xs::=t] = name_subst x xs t" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/NBE.thy --- a/Nominal/Ex/NBE.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/NBE.thy Mon May 19 12:45:26 2014 +0100 @@ -88,7 +88,7 @@ using assms by (auto simp add: fresh_star_def) -nominal_primrec (invariant "\x y. case x of Inl (x1, y1) \ +nominal_function (invariant "\x y. case x of Inl (x1, y1) \ supp y \ (supp y1 - set (bn x1)) \ (fv_bn x1) | Inr (x2, y2) \ supp y \ supp x2 \ supp y2") evals :: "env \ lam \ sem" and evals_aux :: "sem \ sem \ sem" @@ -346,7 +346,7 @@ done -nominal_primrec +nominal_function reify :: "sem \ lam" and reifyn :: "neu \ lam" where @@ -543,4 +543,4 @@ where "normalize t = reify (eval t)" -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/PaperTest.thy --- a/Nominal/Ex/PaperTest.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/PaperTest.thy Mon May 19 12:45:26 2014 +0100 @@ -300,4 +300,4 @@ apply(relation "measure (\(_, t). size t)") apply(simp_all) -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/Pi.thy --- a/Nominal/Ex/Pi.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/Pi.thy Mon May 19 12:45:26 2014 +0100 @@ -27,7 +27,7 @@ by(auto) qed -nominal_primrec +nominal_function subst_name_list :: "name \ (name \ name) list \ name" where "subst_name_list a [] = a" @@ -143,7 +143,7 @@ shows "(p \ (Sum_Type.projl (Sum_Type.projr f))) = Sum_Type.projl (Sum_Type.projr (p \ f))" using a by auto -nominal_primrec (default "case_sum (\x. Inl undefined) (case_sum (\x. Inr (Inl undefined)) (\x. Inr (Inr undefined)))") +nominal_function (default "case_sum (\x. Inl undefined) (case_sum (\x. Inr (Inl undefined)) (\x. Inr (Inr undefined)))") subsGuard_mix :: "guardedTerm_mix \ name \ name \ guardedTerm_mix" ("_[_::=\\_]" [100, 100, 100] 100) and subsList_mix :: "sumList_mix \ name \ name \ sumList_mix" ("_[_::=\\_]" [100, 100, 100] 100) and subs_mix :: "piMix \ name \ name \ piMix" ("_[_::=\_]" [100, 100, 100] 100) @@ -568,4 +568,4 @@ nominal_inductive fresh_list_mix done -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/SFT/Consts.thy --- a/Nominal/Ex/SFT/Consts.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/SFT/Consts.thy Mon May 19 12:45:26 2014 +0100 @@ -71,7 +71,7 @@ "p \ VAR = VAR" "p \ APP = APP" "p \ Abs = Abs" by (rule_tac [!] perm_supp_eq) (simp_all add: fresh_star_def fresh_def) -nominal_primrec +nominal_function Numeral :: "lam \ lam" ("\_\" 1000) where "\Var x\ = VAR \ (Var x)" @@ -128,7 +128,7 @@ lemma app_lst_rev_eq_iff: "app_lst n (rev M) = app_lst n (rev N) \ M = N" by (drule app_lst_eq_iff) simp -nominal_primrec +nominal_function Ltgt :: "lam list \ lam" ("\_\" 1000) where [simp del]: "atom x \ l \ \l\ = \x. (app_lst x (rev l))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/SFT/LambdaTerms.thy --- a/Nominal/Ex/SFT/LambdaTerms.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/SFT/LambdaTerms.thy Mon May 19 12:45:26 2014 +0100 @@ -16,7 +16,7 @@ App (infixl "\" 98) and Lam ("\ _. _" [97, 97] 99) -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/SubstNoFcb.thy --- a/Nominal/Ex/SubstNoFcb.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/SubstNoFcb.thy Mon May 19 12:45:26 2014 +0100 @@ -7,7 +7,7 @@ | App "lam" "lam" | Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) -nominal_primrec lam_rec :: +nominal_function lam_rec :: "(name \ 'a :: pt) \ (lam \ lam \ 'a) \ (name \ lam \ 'a) \ 'a \ 'b :: fs \ lam \ 'a" where "lam_rec fv fa fl fd P (Var n) = fv n" @@ -49,7 +49,7 @@ using Abs1_eq_iff lam.eq_iff apply metis done -nominal_primrec substr where +nominal_function substr where [simp del]: "substr l y s = lam_rec (%x. if x = y then s else (Var x)) (%t1 t2. App (substr t1 y s) (substr t2 y s)) diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/TypeSchemes1.thy --- a/Nominal/Ex/TypeSchemes1.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/TypeSchemes1.thy Mon May 19 12:45:26 2014 +0100 @@ -75,7 +75,7 @@ shows "(p \ lookup Ts T) = lookup (p \ Ts) (p \ T)" by (induct Ts T rule: lookup.induct) (simp_all) -nominal_primrec +nominal_function subst :: "Subst \ ty \ ty" ("_<_>" [100,60] 120) where "\ = lookup \ X" @@ -114,7 +114,7 @@ unfolding eqvt_def by (simp add: permute_fun_def subst.eqvt) -nominal_primrec +nominal_function substs :: "(name \ ty) list \ tys \ tys" ("_<_>" [100,60] 120) where "fset (map_fset atom Xs) \* \ \ \ = All [Xs].(\)" @@ -272,7 +272,7 @@ apply(simp add: fresh_def supp_perm) done -nominal_primrec +nominal_function generalises :: "ty \ tys \ bool" ("_ \\ _") where "atom ` (fset Xs) \* T \ @@ -399,7 +399,7 @@ apply(simp add: compose_ty[symmetric] subst_id2 compose_Dom) done -nominal_primrec +nominal_function ftv :: "ty \ name fset" where "ftv (Var X) = {|X|}" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Ex/TypeSchemes2.thy --- a/Nominal/Ex/TypeSchemes2.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Ex/TypeSchemes2.thy Mon May 19 12:45:26 2014 +0100 @@ -61,7 +61,7 @@ using a by clarsimp -nominal_primrec (default "case_sum (\x. Inl undefined) (\x. Inr undefined)") +nominal_function (default "case_sum (\x. Inl undefined) (\x. Inr undefined)") subst :: "(name \ ty) list \ ty \ ty" and substs :: "(name \ ty) list \ tys \ tys" where diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/Nominal2.thy --- a/Nominal/Nominal2.thy Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/Nominal2.thy Mon May 19 12:45:26 2014 +0100 @@ -3,7 +3,7 @@ Nominal2_Base Nominal2_Abs Nominal2_FCB keywords "nominal_datatype" :: thy_decl and - "nominal_primrec" "nominal_inductive" :: thy_goal and + "nominal_function" "nominal_inductive" :: thy_goal and "avoids" "binds" begin diff -r 08c3ef07cef7 -r 5ebd327ffb96 Nominal/nominal_function.ML --- a/Nominal/nominal_function.ML Mon May 19 11:19:48 2014 +0100 +++ b/Nominal/nominal_function.ML Mon May 19 12:45:26 2014 +0100 @@ -275,7 +275,7 @@ (* nominal *) val _ = - Outer_Syntax.local_theory_to_proof' @{command_spec "nominal_primrec"} + Outer_Syntax.local_theory_to_proof' @{command_spec "nominal_function"} "define general recursive nominal functions" (nominal_function_parser nominal_default_config >> (fn ((config, fixes), statements) => nominal_function_cmd fixes statements config)) diff -r 08c3ef07cef7 -r 5ebd327ffb96 README --- a/README Mon May 19 11:19:48 2014 +0100 +++ b/README Mon May 19 12:45:26 2014 +0100 @@ -6,6 +6,12 @@ isabelle build -d . -g Tests +The version of Nominal2 in the AFP can be tested with + +isabelle build -d . Nominal2 +isabelle build -d . Launchbury + + Subdirectories: =============== diff -r 08c3ef07cef7 -r 5ebd327ffb96 Tutorial/Lambda.thy --- a/Tutorial/Lambda.thy Mon May 19 11:19:48 2014 +0100 +++ b/Tutorial/Lambda.thy Mon May 19 12:45:26 2014 +0100 @@ -32,7 +32,7 @@ subsection {* Height Function *} -nominal_primrec +nominal_function height :: "lam \ int" where "height (Var x) = 1" @@ -53,7 +53,7 @@ subsection {* Capture-Avoiding Substitution *} -nominal_primrec +nominal_function subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90,90,90] 90) where "(Var x)[y ::= s] = (if x = y then s else (Var x))" diff -r 08c3ef07cef7 -r 5ebd327ffb96 Tutorial/Minimal.thy --- a/Tutorial/Minimal.thy Mon May 19 11:19:48 2014 +0100 +++ b/Tutorial/Minimal.thy Mon May 19 12:45:26 2014 +0100 @@ -15,4 +15,4 @@ shows "Lam [x]. (Var x) = Lam [y]. (Var y)" by (simp add: lam.eq_iff Abs1_eq_iff lam.fresh fresh_at_base) -end \ No newline at end of file +end diff -r 08c3ef07cef7 -r 5ebd327ffb96 Tutorial/Tutorial6.thy --- a/Tutorial/Tutorial6.thy Mon May 19 11:19:48 2014 +0100 +++ b/Tutorial/Tutorial6.thy Mon May 19 12:45:26 2014 +0100 @@ -46,4 +46,4 @@ by (auto simp add: ty_tys.eq_iff ty_tys.supp supp_at_base fresh_star_def) -end \ No newline at end of file +end