src/HOL/Library/OptionalSugar.thy
author nipkow
Fri, 25 May 2007 18:08:34 +0200
changeset 23100 1c84d7294d5b
parent 22835 37d3a984d730
child 29494 a189c6274c7a
permissions -rw-r--r--
Added List_Comprehension
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15469
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Library/OptionalSugar.thy
nipkow
parents:
diff changeset
     2
    ID:         $Id$
nipkow
parents:
diff changeset
     3
    Author:     Gerwin Klain, Tobias Nipkow
nipkow
parents:
diff changeset
     4
    Copyright   2005 NICTA and TUM
nipkow
parents:
diff changeset
     5
*)
15476
b8cb20cc0c0b fixed bugs
nipkow
parents: 15469
diff changeset
     6
(*<*)
15469
nipkow
parents:
diff changeset
     7
theory OptionalSugar
nipkow
parents:
diff changeset
     8
imports LaTeXsugar
nipkow
parents:
diff changeset
     9
begin
nipkow
parents:
diff changeset
    10
22835
37d3a984d730 added "set" supression
nipkow
parents: 21404
diff changeset
    11
(* set *)
37d3a984d730 added "set" supression
nipkow
parents: 21404
diff changeset
    12
translations
37d3a984d730 added "set" supression
nipkow
parents: 21404
diff changeset
    13
  "xs" <= "set xs"
37d3a984d730 added "set" supression
nipkow
parents: 21404
diff changeset
    14
15469
nipkow
parents:
diff changeset
    15
(* append *)
nipkow
parents:
diff changeset
    16
syntax (latex output)
nipkow
parents:
diff changeset
    17
  "appendL" :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" (infixl "\<^raw:\isacharat>" 65)
nipkow
parents:
diff changeset
    18
translations
nipkow
parents:
diff changeset
    19
  "appendL xs ys" <= "xs @ ys" 
nipkow
parents:
diff changeset
    20
  "appendL (appendL xs ys) zs" <= "appendL xs (appendL ys zs)"
nipkow
parents:
diff changeset
    21
nipkow
parents:
diff changeset
    22
nipkow
parents:
diff changeset
    23
(* aligning equations *)
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19674
diff changeset
    24
notation (tab output)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21210
diff changeset
    25
  "op ="  ("(_) \<^raw:}\putisatab\isa{\ >=\<^raw:}\putisatab\isa{> (_)" [50,49] 50) and
19674
22b635240905 const_syntax;
wenzelm
parents: 15476
diff changeset
    26
  "=="  ("(_) \<^raw:}\putisatab\isa{\ >\<equiv>\<^raw:}\putisatab\isa{> (_)")
15469
nipkow
parents:
diff changeset
    27
nipkow
parents:
diff changeset
    28
(* Let *)
nipkow
parents:
diff changeset
    29
translations 
nipkow
parents:
diff changeset
    30
  "_bind (p,DUMMY) e" <= "_bind p (fst e)"
nipkow
parents:
diff changeset
    31
  "_bind (DUMMY,p) e" <= "_bind p (snd e)"
nipkow
parents:
diff changeset
    32
nipkow
parents:
diff changeset
    33
  "_tuple_args x (_tuple_args y z)" ==
nipkow
parents:
diff changeset
    34
    "_tuple_args x (_tuple_arg (_tuple y z))"
nipkow
parents:
diff changeset
    35
nipkow
parents:
diff changeset
    36
  "_bind (Some p) e" <= "_bind p (the e)"
nipkow
parents:
diff changeset
    37
  "_bind (p#DUMMY) e" <= "_bind p (hd e)"
nipkow
parents:
diff changeset
    38
  "_bind (DUMMY#p) e" <= "_bind p (tl e)"
nipkow
parents:
diff changeset
    39
nipkow
parents:
diff changeset
    40
15476
b8cb20cc0c0b fixed bugs
nipkow
parents: 15469
diff changeset
    41
end
b8cb20cc0c0b fixed bugs
nipkow
parents: 15469
diff changeset
    42
(*>*)