src/HOL/Groups_List.thy
changeset 80932 261cd8722677
parent 80760 be8c0e039a5e
child 80934 8e72f55295fd
equal deleted inserted replaced
80931:f6e595e4f608 80932:261cd8722677
    96 
    96 
    97 end
    97 end
    98 
    98 
    99 text \<open>Some syntactic sugar for summing a function over a list:\<close>
    99 text \<open>Some syntactic sugar for summing a function over a list:\<close>
   100 syntax (ASCII)
   100 syntax (ASCII)
   101   "_sum_list" :: "pttrn => 'a list => 'b => 'b"    ("(3SUM _<-_. _)" [0, 51, 10] 10)
   101   "_sum_list" :: "pttrn => 'a list => 'b => 'b"    (\<open>(3SUM _<-_. _)\<close> [0, 51, 10] 10)
   102 syntax
   102 syntax
   103   "_sum_list" :: "pttrn => 'a list => 'b => 'b"    ("(3\<Sum>_\<leftarrow>_. _)" [0, 51, 10] 10)
   103   "_sum_list" :: "pttrn => 'a list => 'b => 'b"    (\<open>(3\<Sum>_\<leftarrow>_. _)\<close> [0, 51, 10] 10)
   104 syntax_consts
   104 syntax_consts
   105   "_sum_list" == sum_list
   105   "_sum_list" == sum_list
   106 translations \<comment> \<open>Beware of argument permutation!\<close>
   106 translations \<comment> \<open>Beware of argument permutation!\<close>
   107   "\<Sum>x\<leftarrow>xs. b" == "CONST sum_list (CONST map (\<lambda>x. b) xs)"
   107   "\<Sum>x\<leftarrow>xs. b" == "CONST sum_list (CONST map (\<lambda>x. b) xs)"
   108 
   108 
   595 end
   595 end
   596 
   596 
   597 text \<open>Some syntactic sugar:\<close>
   597 text \<open>Some syntactic sugar:\<close>
   598 
   598 
   599 syntax (ASCII)
   599 syntax (ASCII)
   600   "_prod_list" :: "pttrn => 'a list => 'b => 'b"    ("(3PROD _<-_. _)" [0, 51, 10] 10)
   600   "_prod_list" :: "pttrn => 'a list => 'b => 'b"    (\<open>(3PROD _<-_. _)\<close> [0, 51, 10] 10)
   601 syntax
   601 syntax
   602   "_prod_list" :: "pttrn => 'a list => 'b => 'b"    ("(3\<Prod>_\<leftarrow>_. _)" [0, 51, 10] 10)
   602   "_prod_list" :: "pttrn => 'a list => 'b => 'b"    (\<open>(3\<Prod>_\<leftarrow>_. _)\<close> [0, 51, 10] 10)
   603 syntax_consts
   603 syntax_consts
   604   "_prod_list" \<rightleftharpoons> prod_list
   604   "_prod_list" \<rightleftharpoons> prod_list
   605 translations \<comment> \<open>Beware of argument permutation!\<close>
   605 translations \<comment> \<open>Beware of argument permutation!\<close>
   606   "\<Prod>x\<leftarrow>xs. b" \<rightleftharpoons> "CONST prod_list (CONST map (\<lambda>x. b) xs)"
   606   "\<Prod>x\<leftarrow>xs. b" \<rightleftharpoons> "CONST prod_list (CONST map (\<lambda>x. b) xs)"
   607 
   607