# HG changeset patch # User wenzelm # Date 1724924594 -7200 # Node ID 66a8113ac23e568a7fa06ce1505c3dc6f69b8b83 # Parent f27f66e9adcac05df35fda727a7fc0bc02ef84b7 more specific "args" syntax, to support more markup for syntax consts; diff -r f27f66e9adca -r 66a8113ac23e src/ZF/List.thy --- a/src/ZF/List.thy Thu Aug 29 11:39:50 2024 +0200 +++ b/src/ZF/List.thy Thu Aug 29 11:43:14 2024 +0200 @@ -15,9 +15,13 @@ notation Nil (\[]\) +nonterminal list_args syntax - "_List" :: "is \ i" (\[(_)]\) -syntax_consts "_List" \ Cons + "" :: "i \ list_args" (\_\) + "_List_args" :: "[i, list_args] \ list_args" (\_,/ _\) + "_List" :: "list_args \ i" (\[(_)]\) +syntax_consts + "_List_args" "_List" \ Cons translations "[x, xs]" == "CONST Cons(x, [xs])" "[x]" == "CONST Cons(x, [])" diff -r f27f66e9adca -r 66a8113ac23e src/ZF/ZF_Base.thy --- a/src/ZF/ZF_Base.thy Thu Aug 29 11:39:50 2024 +0200 +++ b/src/ZF/ZF_Base.thy Thu Aug 29 11:43:14 2024 +0200 @@ -129,13 +129,13 @@ definition succ :: "i \ i" where "succ(i) \ cons(i, i)" -nonterminal "is" +nonterminal "finset_args" syntax - "" :: "i \ is" (\_\) - "_Enum" :: "[i, is] \ is" (\_,/ _\) - "_Finset" :: "is \ i" (\{(_)}\) + "" :: "i \ finset_args" (\_\) + "_Finset_args" :: "[i, finset_args] \ finset_args" (\_,/ _\) + "_Finset" :: "finset_args \ i" (\{(_)}\) syntax_consts - "_Finset" == cons + "_Finset_args" "_Finset" == cons translations "{x, xs}" == "CONST cons(x, {xs})" "{x}" == "CONST cons(x, 0)" @@ -192,19 +192,26 @@ definition split :: "[[i, i] \ 'a, i] \ 'a::{}" \ \for pattern-matching\ where "split(c) \ \p. c(fst(p), snd(p))" +nonterminal "tuple_args" +syntax + "" :: "i \ tuple_args" (\_\) + "_Tuple_args" :: "[i, tuple_args] \ tuple_args" (\_,/ _\) + "_Tuple" :: "[i, tuple_args] \ i" (\\(_,/ _)\\) +syntax_consts + "_Tuple_args" "_Tuple" == Pair +translations + "\x, y, z\" == "\x, \y, z\\" + "\x, y\" == "CONST Pair(x, y)" + (* Patterns -- extends pre-defined type "pttrn" used in abstractions *) nonterminal patterns syntax "_pattern" :: "patterns \ pttrn" (\\_\\) "" :: "pttrn \ patterns" (\_\) "_patterns" :: "[pttrn, patterns] \ patterns" (\_,/_\) - "_Tuple" :: "[i, is] \ i" (\\(_,/ _)\\) syntax_consts - "_pattern" "_patterns" == split and - "_Tuple" == Pair + "_pattern" "_patterns" == split translations - "\x, y, z\" == "\x, \y, z\\" - "\x, y\" == "CONST Pair(x, y)" "\\x,y,zs\.b" == "CONST split(\x \y,zs\.b)" "\\x,y\.b" == "CONST split(\x y. b)" @@ -300,7 +307,7 @@ "_PROD" :: "[pttrn, i, i] \ i" (\(3PROD _:_./ _)\ 10) "_SUM" :: "[pttrn, i, i] \ i" (\(3SUM _:_./ _)\ 10) "_lam" :: "[pttrn, i, i] \ i" (\(3lam _:_./ _)\ 10) - "_Tuple" :: "[i, is] \ i" (\<(_,/ _)>\) + "_Tuple" :: "[i, tuple_args] \ i" (\<(_,/ _)>\) "_pattern" :: "patterns \ pttrn" (\<_>\)