src/LCF/LCF.thy
changeset 17248 81bf91654e73
parent 3837 d7f033c74b38
child 17249 e89fbfd778c1
equal deleted inserted replaced
17247:6927a62c77dc 17248:81bf91654e73
     1 (*  Title:      LCF/lcf.thy
     1 (*  Title:      LCF/lcf.thy
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Tobias Nipkow
     3     Author:     Tobias Nipkow
     4     Copyright   1992  University of Cambridge
     4     Copyright   1992  University of Cambridge
     5 
       
     6 Natural Deduction Rules for LCF
       
     7 *)
     5 *)
     8 
     6 
     9 LCF = FOL +
     7 header {* LCF on top of First-Order Logic *}
    10 
     8 
    11 classes cpo < term
     9 theory LCF
       
    10 imports FOL
       
    11 uses ("pair.ML") ("fix.ML")
       
    12 begin
    12 
    13 
    13 default cpo
    14 text {* This theory is based on Lawrence Paulson's book Logic and Computation. *}
    14 
    15 
    15 types
    16 subsection {* Natural Deduction Rules for LCF *}
    16  tr
    17 
    17  void
    18 classes cpo < "term"
    18  ('a,'b) "*"            (infixl 6)
    19 defaultsort cpo
    19  ('a,'b) "+"            (infixl 5)
    20 
       
    21 typedecl tr
       
    22 typedecl void
       
    23 typedecl ('a,'b) "*"    (infixl 6)
       
    24 typedecl ('a,'b) "+"    (infixl 5)
    20 
    25 
    21 arities
    26 arities
    22  fun, "*", "+" :: (cpo,cpo)cpo
    27   fun :: (cpo, cpo) cpo
    23  tr,void       :: cpo
    28   "*" :: (cpo, cpo) cpo
       
    29   "+" :: (cpo, cpo) cpo
       
    30   tr :: cpo
       
    31   void :: cpo
    24 
    32 
    25 consts
    33 consts
    26  UU     :: "'a"
    34  UU     :: "'a"
    27  TT,FF  :: "tr"
    35  TT     :: "tr"
       
    36  FF     :: "tr"
    28  FIX    :: "('a => 'a) => 'a"
    37  FIX    :: "('a => 'a) => 'a"
    29  FST    :: "'a*'b => 'a"
    38  FST    :: "'a*'b => 'a"
    30  SND    :: "'a*'b => 'b"
    39  SND    :: "'a*'b => 'b"
    31  INL    :: "'a => 'a+'b"
    40  INL    :: "'a => 'a+'b"
    32  INR    :: "'b => 'a+'b"
    41  INR    :: "'b => 'a+'b"
    34  adm    :: "('a => o) => o"
    43  adm    :: "('a => o) => o"
    35  VOID   :: "void"               ("'(')")
    44  VOID   :: "void"               ("'(')")
    36  PAIR   :: "['a,'b] => 'a*'b"   ("(1<_,/_>)" [0,0] 100)
    45  PAIR   :: "['a,'b] => 'a*'b"   ("(1<_,/_>)" [0,0] 100)
    37  COND   :: "[tr,'a,'a] => 'a"   ("(_ =>/ (_ |/ _))" [60,60,60] 60)
    46  COND   :: "[tr,'a,'a] => 'a"   ("(_ =>/ (_ |/ _))" [60,60,60] 60)
    38  "<<"   :: "['a,'a] => o"       (infixl 50)
    47  "<<"   :: "['a,'a] => o"       (infixl 50)
    39 rules
    48 
       
    49 axioms
    40   (** DOMAIN THEORY **)
    50   (** DOMAIN THEORY **)
    41 
    51 
    42   eq_def        "x=y == x << y & y << x"
    52   eq_def:        "x=y == x << y & y << x"
    43 
    53 
    44   less_trans    "[| x << y; y << z |] ==> x << z"
    54   less_trans:    "[| x << y; y << z |] ==> x << z"
    45 
    55 
    46   less_ext      "(ALL x. f(x) << g(x)) ==> f << g"
    56   less_ext:      "(ALL x. f(x) << g(x)) ==> f << g"
    47 
    57 
    48   mono          "[| f << g; x << y |] ==> f(x) << g(y)"
    58   mono:          "[| f << g; x << y |] ==> f(x) << g(y)"
    49 
    59 
    50   minimal       "UU << x"
    60   minimal:       "UU << x"
    51 
    61 
    52   FIX_eq        "f(FIX(f)) = FIX(f)"
    62   FIX_eq:        "f(FIX(f)) = FIX(f)"
    53 
    63 
    54   (** TR **)
    64   (** TR **)
    55 
    65 
    56   tr_cases      "p=UU | p=TT | p=FF"
    66   tr_cases:      "p=UU | p=TT | p=FF"
    57 
    67 
    58   not_TT_less_FF "~ TT << FF"
    68   not_TT_less_FF: "~ TT << FF"
    59   not_FF_less_TT "~ FF << TT"
    69   not_FF_less_TT: "~ FF << TT"
    60   not_TT_less_UU "~ TT << UU"
    70   not_TT_less_UU: "~ TT << UU"
    61   not_FF_less_UU "~ FF << UU"
    71   not_FF_less_UU: "~ FF << UU"
    62 
    72 
    63   COND_UU       "UU => x | y  =  UU"
    73   COND_UU:       "UU => x | y  =  UU"
    64   COND_TT       "TT => x | y  =  x"
    74   COND_TT:       "TT => x | y  =  x"
    65   COND_FF       "FF => x | y  =  y"
    75   COND_FF:       "FF => x | y  =  y"
    66 
    76 
    67   (** PAIRS **)
    77   (** PAIRS **)
    68 
    78 
    69   surj_pairing  "<FST(z),SND(z)> = z"
    79   surj_pairing:  "<FST(z),SND(z)> = z"
    70 
    80 
    71   FST   "FST(<x,y>) = x"
    81   FST:   "FST(<x,y>) = x"
    72   SND   "SND(<x,y>) = y"
    82   SND:   "SND(<x,y>) = y"
    73 
    83 
    74   (*** STRICT SUM ***)
    84   (*** STRICT SUM ***)
    75 
    85 
    76   INL_DEF "~x=UU ==> ~INL(x)=UU"
    86   INL_DEF: "~x=UU ==> ~INL(x)=UU"
    77   INR_DEF "~x=UU ==> ~INR(x)=UU"
    87   INR_DEF: "~x=UU ==> ~INR(x)=UU"
    78 
    88 
    79   INL_STRICT "INL(UU) = UU"
    89   INL_STRICT: "INL(UU) = UU"
    80   INR_STRICT "INR(UU) = UU"
    90   INR_STRICT: "INR(UU) = UU"
    81 
    91 
    82   WHEN_UU  "WHEN(f,g,UU) = UU"
    92   WHEN_UU:  "WHEN(f,g,UU) = UU"
    83   WHEN_INL "~x=UU ==> WHEN(f,g,INL(x)) = f(x)"
    93   WHEN_INL: "~x=UU ==> WHEN(f,g,INL(x)) = f(x)"
    84   WHEN_INR "~x=UU ==> WHEN(f,g,INR(x)) = g(x)"
    94   WHEN_INR: "~x=UU ==> WHEN(f,g,INR(x)) = g(x)"
    85 
    95 
    86   SUM_EXHAUSTION
    96   SUM_EXHAUSTION:
    87     "z = UU | (EX x. ~x=UU & z = INL(x)) | (EX y. ~y=UU & z = INR(y))"
    97     "z = UU | (EX x. ~x=UU & z = INL(x)) | (EX y. ~y=UU & z = INR(y))"
    88 
    98 
    89   (** VOID **)
    99   (** VOID **)
    90 
   100 
    91   void_cases    "(x::void) = UU"
   101   void_cases:    "(x::void) = UU"
    92 
   102 
    93   (** INDUCTION **)
   103   (** INDUCTION **)
    94 
   104 
    95   induct        "[| adm(P); P(UU); ALL x. P(x) --> P(f(x)) |] ==> P(FIX(f))"
   105   induct:        "[| adm(P); P(UU); ALL x. P(x) --> P(f(x)) |] ==> P(FIX(f))"
    96 
   106 
    97   (** Admissibility / Chain Completeness **)
   107   (** Admissibility / Chain Completeness **)
    98   (* All rules can be found on pages 199--200 of Larry's LCF book.
   108   (* All rules can be found on pages 199--200 of Larry's LCF book.
    99      Note that "easiness" of types is not taken into account
   109      Note that "easiness" of types is not taken into account
   100      because it cannot be expressed schematically; flatness could be. *)
   110      because it cannot be expressed schematically; flatness could be. *)
   101 
   111 
   102   adm_less      "adm(%x. t(x) << u(x))"
   112   adm_less:      "adm(%x. t(x) << u(x))"
   103   adm_not_less  "adm(%x.~ t(x) << u)"
   113   adm_not_less:  "adm(%x.~ t(x) << u)"
   104   adm_not_free  "adm(%x. A)"
   114   adm_not_free:  "adm(%x. A)"
   105   adm_subst     "adm(P) ==> adm(%x. P(t(x)))"
   115   adm_subst:     "adm(P) ==> adm(%x. P(t(x)))"
   106   adm_conj      "[| adm(P); adm(Q) |] ==> adm(%x. P(x)&Q(x))"
   116   adm_conj:      "[| adm(P); adm(Q) |] ==> adm(%x. P(x)&Q(x))"
   107   adm_disj      "[| adm(P); adm(Q) |] ==> adm(%x. P(x)|Q(x))"
   117   adm_disj:      "[| adm(P); adm(Q) |] ==> adm(%x. P(x)|Q(x))"
   108   adm_imp       "[| adm(%x.~P(x)); adm(Q) |] ==> adm(%x. P(x)-->Q(x))"
   118   adm_imp:       "[| adm(%x.~P(x)); adm(Q) |] ==> adm(%x. P(x)-->Q(x))"
   109   adm_all       "(!!y. adm(P(y))) ==> adm(%x. ALL y. P(y,x))"
   119   adm_all:       "(!!y. adm(P(y))) ==> adm(%x. ALL y. P(y,x))"
       
   120 
       
   121 ML {* use_legacy_bindings (the_context ()) *}
       
   122 
       
   123 use "LCF_lemmas.ML"
       
   124 
       
   125 
       
   126 subsection {* Ordered pairs and products *}
       
   127 
       
   128 use "pair.ML"
       
   129 
       
   130 
       
   131 subsection {* Fixedpoint theory *}
       
   132 
       
   133 use "fix.ML"
       
   134 
   110 end
   135 end