src/HOL/Fun.thy
author oheimb
Wed, 12 Aug 1998 16:23:25 +0200
changeset 5305 513925de8962
parent 4830 bd73675adbed
child 5608 a82a038a3e7a
permissions -rw-r--r--
cleanup for Fun.thy:
merged Update.{thy|ML} into Fun.{thy|ML}
moved o_def from HOL.thy to Fun.thy
added Id_def to Fun.thy
moved image_compose from Set.ML to Fun.ML
moved o_apply and o_assoc from simpdata.ML to Fun.ML
moved fun_upd_same and fun_upd_other (from Map.ML) to Fun.ML
added fun_upd_twist to Fun.ML
clasohm@1475
     1
(*  Title:      HOL/Fun.thy
clasohm@923
     2
    ID:         $Id$
clasohm@1475
     3
    Author:     Tobias Nipkow, Cambridge University Computer Laboratory
clasohm@923
     4
    Copyright   1994  University of Cambridge
clasohm@923
     5
nipkow@2912
     6
Notions about functions.
clasohm@923
     7
*)
clasohm@923
     8
paulson@4648
     9
Fun = Vimage +
nipkow@2912
    10
paulson@4059
    11
instance set :: (term) order
paulson@4059
    12
                       (subset_refl,subset_trans,subset_antisym,psubset_eq)
nipkow@2912
    13
consts
nipkow@2912
    14
oheimb@5305
    15
  Id          ::  'a => 'a
oheimb@5305
    16
  o           :: ['b => 'c, 'a => 'b, 'a] => 'c   (infixl 55)
nipkow@4830
    17
  inj, surj   :: ('a => 'b) => bool                   (*inj/surjective*)
nipkow@4830
    18
  inj_on      :: ['a => 'b, 'a set] => bool
nipkow@4830
    19
  inv         :: ('a => 'b) => ('b => 'a)
oheimb@5305
    20
  fun_upd  :: "('a => 'b) => 'a => 'b => ('a => 'b)"
oheimb@5305
    21
oheimb@5305
    22
nonterminals
oheimb@5305
    23
  updbinds  updbind
oheimb@5305
    24
oheimb@5305
    25
syntax
oheimb@5305
    26
oheimb@5305
    27
  (* Let expressions *)
oheimb@5305
    28
oheimb@5305
    29
  "_updbind"       :: ['a, 'a] => updbind             ("(2_ :=/ _)")
oheimb@5305
    30
  ""               :: updbind => updbinds             ("_")
oheimb@5305
    31
  "_updbinds"      :: [updbind, updbinds] => updbinds ("_,/ _")
oheimb@5305
    32
  "_Update"        :: ['a, updbinds] => 'a            ("_/'((_)')" [900,0] 900)
oheimb@5305
    33
oheimb@5305
    34
translations
oheimb@5305
    35
  "_Update f (_updbinds b bs)"  == "_Update (_Update f b) bs"
oheimb@5305
    36
  "f(x:=y)"                     == "fun_upd f x y"
nipkow@2912
    37
nipkow@2912
    38
defs
nipkow@2912
    39
oheimb@5305
    40
  Id_def	"Id             == %x. x"
oheimb@5305
    41
  o_def   	"f o g          == %x. f(g(x))"
oheimb@5305
    42
  inj_def	"inj f          == ! x y. f(x)=f(y) --> x=y"
oheimb@5305
    43
  inj_on_def	"inj_on f A     == ! x:A. ! y:A. f(x)=f(y) --> x=y"
oheimb@5305
    44
  surj_def	"surj f         == ! y. ? x. y=f(x)"
oheimb@5305
    45
  inv_def	"inv(f::'a=>'b) == % y. @x. f(x)=y"
oheimb@5305
    46
  fun_upd_def	"f(a:=b)        == % x. if x=a then b else f x"
nipkow@2912
    47
nipkow@2912
    48
end