src/HOL/Library/OptionalSugar.thy
author wenzelm
Wed, 08 Nov 2006 23:11:13 +0100
changeset 21256 47195501ecf7
parent 21210 c17fd2df4e9e
child 21404 eb85850d3eb7
permissions -rw-r--r--
moved theories Parity, GCD, Binomial to Library;
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
nipkow
parents:
diff changeset
    11
(* append *)
nipkow
parents:
diff changeset
    12
syntax (latex output)
nipkow
parents:
diff changeset
    13
  "appendL" :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" (infixl "\<^raw:\isacharat>" 65)
nipkow
parents:
diff changeset
    14
translations
nipkow
parents:
diff changeset
    15
  "appendL xs ys" <= "xs @ ys" 
nipkow
parents:
diff changeset
    16
  "appendL (appendL xs ys) zs" <= "appendL xs (appendL ys zs)"
nipkow
parents:
diff changeset
    17
nipkow
parents:
diff changeset
    18
nipkow
parents:
diff changeset
    19
(* aligning equations *)
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19674
diff changeset
    20
notation (tab output)
19674
22b635240905 const_syntax;
wenzelm
parents: 15476
diff changeset
    21
  "op ="  ("(_) \<^raw:}\putisatab\isa{\ >=\<^raw:}\putisatab\isa{> (_)" [50,49] 50)
22b635240905 const_syntax;
wenzelm
parents: 15476
diff changeset
    22
  "=="  ("(_) \<^raw:}\putisatab\isa{\ >\<equiv>\<^raw:}\putisatab\isa{> (_)")
15469
nipkow
parents:
diff changeset
    23
nipkow
parents:
diff changeset
    24
(* Let *)
nipkow
parents:
diff changeset
    25
translations 
nipkow
parents:
diff changeset
    26
  "_bind (p,DUMMY) e" <= "_bind p (fst e)"
nipkow
parents:
diff changeset
    27
  "_bind (DUMMY,p) e" <= "_bind p (snd e)"
nipkow
parents:
diff changeset
    28
nipkow
parents:
diff changeset
    29
  "_tuple_args x (_tuple_args y z)" ==
nipkow
parents:
diff changeset
    30
    "_tuple_args x (_tuple_arg (_tuple y z))"
nipkow
parents:
diff changeset
    31
nipkow
parents:
diff changeset
    32
  "_bind (Some p) e" <= "_bind p (the e)"
nipkow
parents:
diff changeset
    33
  "_bind (p#DUMMY) e" <= "_bind p (hd e)"
nipkow
parents:
diff changeset
    34
  "_bind (DUMMY#p) e" <= "_bind p (tl e)"
nipkow
parents:
diff changeset
    35
nipkow
parents:
diff changeset
    36
15476
b8cb20cc0c0b fixed bugs
nipkow
parents: 15469
diff changeset
    37
end
b8cb20cc0c0b fixed bugs
nipkow
parents: 15469
diff changeset
    38
(*>*)