src/LK/LK.thy
author clasohm
Thu Sep 16 12:20:38 1993 +0200 (1993-09-16)
changeset 0 a5a9c433f639
child 283 76caebd18756
permissions -rw-r--r--
Initial revision
clasohm@0
     1
(*  Title: 	LK/lk.thy
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1993  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Classical First-Order Sequent Calculus
clasohm@0
     7
*)
clasohm@0
     8
clasohm@0
     9
LK = Pure +
clasohm@0
    10
classes term < logic
clasohm@0
    11
default term
clasohm@0
    12
types o 0
clasohm@0
    13
      sequence,seqobj,seqcont,sequ,sobj 0
clasohm@0
    14
arities o :: logic
clasohm@0
    15
consts
clasohm@0
    16
 True,False	:: "o"
clasohm@0
    17
 "="		:: "['a,'a] => o"	(infixl 50)
clasohm@0
    18
 "Not"		:: "o => o"		("~ _" [40] 40)
clasohm@0
    19
 "&"		:: "[o,o] => o"		(infixr 35)
clasohm@0
    20
 "|"		:: "[o,o] => o"		(infixr 30)
clasohm@0
    21
 "-->","<->"	:: "[o,o] => o"		(infixr 25)
clasohm@0
    22
 The		:: "('a => o) => 'a"	(binder "THE " 10)
clasohm@0
    23
 All		:: "('a => o) => o"	(binder "ALL " 10)
clasohm@0
    24
 Ex		:: "('a => o) => o"	(binder "EX " 10)
clasohm@0
    25
clasohm@0
    26
 (*Representation of sequents*)
clasohm@0
    27
 Trueprop	:: "[sobj=>sobj,sobj=>sobj] => prop"
clasohm@0
    28
 Seqof		:: "o => sobj=>sobj"
clasohm@0
    29
 "@Trueprop"	:: "[sequence,sequence] => prop" ("((_)/ |- (_))" [6,6] 5)
clasohm@0
    30
 "@MtSeq"	:: "sequence"				("" [] 1000)
clasohm@0
    31
 "@NmtSeq"	:: "[seqobj,seqcont] => sequence"	("__" [] 1000)
clasohm@0
    32
 "@MtSeqCont"	:: "seqcont"				("" [] 1000)
clasohm@0
    33
 "@SeqCont"	:: "[seqobj,seqcont] => seqcont"	(",/ __" [] 1000)
clasohm@0
    34
 ""		:: "o => seqobj"			("_" [] 1000)
clasohm@0
    35
 "@SeqId"	:: "id => seqobj"			("$_" [] 1000)
clasohm@0
    36
 "@SeqVar"	:: "var => seqobj"			("$_")
clasohm@0
    37
clasohm@0
    38
rules
clasohm@0
    39
  (*Structural rules*)
clasohm@0
    40
clasohm@0
    41
  basic	"$H, P, $G |- $E, P, $F"
clasohm@0
    42
clasohm@0
    43
  thinR	"$H |- $E, $F ==> $H |- $E, P, $F"
clasohm@0
    44
  thinL	"$H, $G |- $E ==> $H, P, $G |- $E"
clasohm@0
    45
clasohm@0
    46
  cut	"[| $H |- $E, P;  $H, P |- $E |] ==> $H |- $E"
clasohm@0
    47
clasohm@0
    48
  (*Propositional rules*)
clasohm@0
    49
clasohm@0
    50
  conjR	"[| $H|- $E, P, $F;  $H|- $E, Q, $F |] ==> $H|- $E, P&Q, $F"
clasohm@0
    51
  conjL	"$H, P, Q, $G |- $E ==> $H, P & Q, $G |- $E"
clasohm@0
    52
clasohm@0
    53
  disjR	"$H |- $E, P, Q, $F ==> $H |- $E, P|Q, $F"
clasohm@0
    54
  disjL	"[| $H, P, $G |- $E;  $H, Q, $G |- $E |] ==> $H, P|Q, $G |- $E"
clasohm@0
    55
clasohm@0
    56
  impR	"$H, P |- $E, Q, $F ==> $H |- $E, P-->Q, $F"
clasohm@0
    57
  impL	"[| $H,$G |- $E,P;  $H, Q, $G |- $E |] ==> $H, P-->Q, $G |- $E"
clasohm@0
    58
clasohm@0
    59
  notR	"$H, P |- $E, $F ==> $H |- $E, ~P, $F"
clasohm@0
    60
  notL	"$H, $G |- $E, P ==> $H, ~P, $G |- $E"
clasohm@0
    61
clasohm@0
    62
  FalseL "$H, False, $G |- $E"
clasohm@0
    63
clasohm@0
    64
  True_def "True == False-->False"
clasohm@0
    65
  iff_def  "P<->Q == (P-->Q) & (Q-->P)"
clasohm@0
    66
clasohm@0
    67
  (*Quantifiers*)
clasohm@0
    68
clasohm@0
    69
  allR	"(!!x.$H |- $E, P(x), $F) ==> $H |- $E, ALL x.P(x), $F"
clasohm@0
    70
  allL	"$H, P(x), $G, ALL x.P(x) |- $E ==> $H, ALL x.P(x), $G |- $E"
clasohm@0
    71
clasohm@0
    72
  exR	"$H |- $E, P(x), $F, EX x.P(x) ==> $H |- $E, EX x.P(x), $F"
clasohm@0
    73
  exL	"(!!x.$H, P(x), $G |- $E) ==> $H, EX x.P(x), $G |- $E"
clasohm@0
    74
clasohm@0
    75
  (*Equality*)
clasohm@0
    76
clasohm@0
    77
  refl	"$H |- $E, a=a, $F"
clasohm@0
    78
  sym   "$H |- $E, a=b, $F ==> $H |- $E, b=a, $F"
clasohm@0
    79
  trans "[| $H|- $E, a=b, $F;  $H|- $E, b=c, $F |] ==> $H|- $E, a=c, $F"
clasohm@0
    80
clasohm@0
    81
clasohm@0
    82
  (*Descriptions*)
clasohm@0
    83
clasohm@0
    84
  The "[| $H |- $E, P(a), $F;  !!x.$H, P(x) |- $E, x=a, $F |] ==> \
clasohm@0
    85
\          $H |- $E, P(THE x.P(x)), $F"
clasohm@0
    86
end
clasohm@0
    87
clasohm@0
    88
ML
clasohm@0
    89
clasohm@0
    90
(*Abstract over "sobj" -- representation of a sequence of formulae *)
clasohm@0
    91
fun abs_sobj t = Abs("sobj", Type("sobj",[]), t);
clasohm@0
    92
clasohm@0
    93
(*Representation of empty sequence*)
clasohm@0
    94
val Sempty =  abs_sobj (Bound 0);
clasohm@0
    95
clasohm@0
    96
fun seq_obj_tr(Const("@SeqId",_)$id) = id |
clasohm@0
    97
    seq_obj_tr(Const("@SeqVar",_)$id) = id |
clasohm@0
    98
    seq_obj_tr(fm) = Const("Seqof",dummyT)$fm;
clasohm@0
    99
clasohm@0
   100
fun seq_tr(_$obj$seq) = seq_obj_tr(obj)$seq_tr(seq) |
clasohm@0
   101
    seq_tr(_) = Bound 0;
clasohm@0
   102
clasohm@0
   103
fun seq_tr1(Const("@MtSeq",_)) = Sempty |
clasohm@0
   104
    seq_tr1(seq) = abs_sobj(seq_tr seq);
clasohm@0
   105
clasohm@0
   106
fun true_tr[s1,s2] = Const("Trueprop",dummyT)$seq_tr1 s1$seq_tr1 s2;
clasohm@0
   107
clasohm@0
   108
fun seq_obj_tr'(Const("Seqof",_)$fm) = fm |
clasohm@0
   109
    seq_obj_tr'(id) = Const("@SeqId",dummyT)$id;
clasohm@0
   110
clasohm@0
   111
fun seq_tr'(obj$sq,C) =
clasohm@0
   112
      let val sq' = case sq of
clasohm@0
   113
            Bound 0 => Const("@MtSeqCont",dummyT) |
clasohm@0
   114
            _ => seq_tr'(sq,Const("@SeqCont",dummyT))
clasohm@0
   115
      in C $ seq_obj_tr' obj $ sq' end;
clasohm@0
   116
clasohm@0
   117
fun seq_tr1'(Bound 0) = Const("@MtSeq",dummyT) |
clasohm@0
   118
    seq_tr1' s = seq_tr'(s,Const("@NmtSeq",dummyT));
clasohm@0
   119
clasohm@0
   120
fun true_tr'[Abs(_,_,s1),Abs(_,_,s2)] =
clasohm@0
   121
      Const("@Trueprop",dummyT)$seq_tr1' s1$seq_tr1' s2;
clasohm@0
   122
clasohm@0
   123
val parse_translation = [("@Trueprop",true_tr)];
clasohm@0
   124
val print_translation = [("Trueprop",true_tr')];