src/Sequents/Sequents.thy
author paulson
Wed Oct 09 13:32:33 1996 +0200 (1996-10-09)
changeset 2073 fb0655539d05
child 6819 433a980103b4
permissions -rw-r--r--
New unified treatment of sequent calculi by Sara Kalvala
combines the old LK and Modal with the new ILL (Int. Linear Logic)
paulson@2073
     1
(*  Title: 	LK/lk.thy
paulson@2073
     2
    ID:         $Id$
paulson@2073
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2073
     4
    Copyright   1993  University of Cambridge
paulson@2073
     5
paulson@2073
     6
Classical First-Order Sequent Calculus
paulson@2073
     7
*)
paulson@2073
     8
paulson@2073
     9
Sequents = Pure +
paulson@2073
    10
paulson@2073
    11
types
paulson@2073
    12
  o 
paulson@2073
    13
paulson@2073
    14
arities
paulson@2073
    15
  o :: logic
paulson@2073
    16
paulson@2073
    17
paulson@2073
    18
(* Sequences *)
paulson@2073
    19
paulson@2073
    20
types
paulson@2073
    21
 seq'
paulson@2073
    22
paulson@2073
    23
consts
paulson@2073
    24
 SeqO'         :: "[o,seq']=>seq'"
paulson@2073
    25
 Seq1'         :: "o=>seq'"
paulson@2073
    26
    
paulson@2073
    27
paulson@2073
    28
(* concrete syntax *)
paulson@2073
    29
paulson@2073
    30
types
paulson@2073
    31
  seq seqobj seqcont
paulson@2073
    32
paulson@2073
    33
paulson@2073
    34
syntax
paulson@2073
    35
 SeqEmp         :: "seq"                                ("")
paulson@2073
    36
 SeqApp         :: "[seqobj,seqcont] => seq"            ("__")
paulson@2073
    37
paulson@2073
    38
 SeqContEmp     :: "seqcont"                            ("")
paulson@2073
    39
 SeqContApp     :: "[seqobj,seqcont] => seqcont"        (",/ __")
paulson@2073
    40
  
paulson@2073
    41
 SeqO           :: "o => seqobj"                        ("_")
paulson@2073
    42
 SeqId          :: "id => seqobj"                       ("$_")
paulson@2073
    43
 SeqVar         :: "var => seqobj"                      ("$_")
paulson@2073
    44
paulson@2073
    45
types
paulson@2073
    46
    
paulson@2073
    47
 single_seqe = "[seq,seqobj] => prop"
paulson@2073
    48
 single_seqi = "[seq'=>seq',seq'=>seq'] => prop"
paulson@2073
    49
 two_seqi = "[seq'=>seq', seq'=>seq'] => prop"
paulson@2073
    50
 two_seqe = "[seq, seq] => prop"
paulson@2073
    51
 three_seqi = "[seq'=>seq', seq'=>seq', seq'=>seq'] => prop"
paulson@2073
    52
 three_seqe = "[seq, seq, seq] => prop"
paulson@2073
    53
 four_seqi = "[seq'=>seq', seq'=>seq', seq'=>seq', seq'=>seq'] => prop"
paulson@2073
    54
 four_seqe = "[seq, seq, seq, seq] => prop"
paulson@2073
    55
paulson@2073
    56
end
paulson@2073
    57
paulson@2073
    58
ML
paulson@2073
    59
paulson@2073
    60
(* parse translation for sequences *)
paulson@2073
    61
paulson@2073
    62
fun abs_seq' t = Abs("s", Type("seq'",[]), t);
paulson@2073
    63
paulson@2073
    64
fun seqobj_tr(Const("SeqO",_)$f) = Const("SeqO'",dummyT)$f |
paulson@2073
    65
    seqobj_tr(_$i) = i;
paulson@2073
    66
    
paulson@2073
    67
fun seqcont_tr(Const("SeqContEmp",_)) = Bound 0 |
paulson@2073
    68
    seqcont_tr(Const("SeqContApp",_)$so$sc) = 
paulson@2073
    69
      (seqobj_tr so)$(seqcont_tr sc);
paulson@2073
    70
paulson@2073
    71
fun seq_tr(Const("SeqEmp",_)) = abs_seq'(Bound 0) |
paulson@2073
    72
    seq_tr(Const("SeqApp",_)$so$sc) = 
paulson@2073
    73
      abs_seq'(seqobj_tr(so)$seqcont_tr(sc));
paulson@2073
    74
paulson@2073
    75
paulson@2073
    76
fun singlobj_tr(Const("SeqO",_)$f) =
paulson@2073
    77
    abs_seq' ((Const("SeqO'",dummyT)$f)$Bound 0);
paulson@2073
    78
    
paulson@2073
    79
paulson@2073
    80
    
paulson@2073
    81
(* print translation for sequences *)
paulson@2073
    82
paulson@2073
    83
fun seqcont_tr' (Bound 0) = 
paulson@2073
    84
      Const("SeqContEmp",dummyT) |
paulson@2073
    85
    seqcont_tr' (Const("SeqO'",_)$f$s) =
paulson@2073
    86
      Const("SeqContApp",dummyT)$
paulson@2073
    87
      (Const("SeqO",dummyT)$f)$
paulson@2073
    88
      (seqcont_tr' s) |
paulson@2073
    89
(*    seqcont_tr' ((a as Abs(_,_,_))$s)= 
paulson@2073
    90
      seqcont_tr'(betapply(a,s)) | *)
paulson@2073
    91
    seqcont_tr' (i$s) = 
paulson@2073
    92
      Const("SeqContApp",dummyT)$
paulson@2073
    93
      (Const("SeqId",dummyT)$i)$
paulson@2073
    94
      (seqcont_tr' s);
paulson@2073
    95
paulson@2073
    96
fun seq_tr' s =
paulson@2073
    97
    let fun seq_itr' (Bound 0) = 
paulson@2073
    98
              Const("SeqEmp",dummyT) |
paulson@2073
    99
            seq_itr' (Const("SeqO'",_)$f$s) =
paulson@2073
   100
              Const("SeqApp",dummyT)$
paulson@2073
   101
              (Const("SeqO",dummyT)$f)$(seqcont_tr' s) |
paulson@2073
   102
(*            seq_itr' ((a as Abs(_,_,_))$s) =
paulson@2073
   103
              seq_itr'(betapply(a,s)) |    *)
paulson@2073
   104
            seq_itr' (i$s) =
paulson@2073
   105
              Const("SeqApp",dummyT)$
paulson@2073
   106
              (Const("SeqId",dummyT)$i)$
paulson@2073
   107
              (seqcont_tr' s)
paulson@2073
   108
    in case s of 
paulson@2073
   109
         Abs(_,_,t) => seq_itr' t |
paulson@2073
   110
         _ => s$(Bound 0)
paulson@2073
   111
    end;
paulson@2073
   112
paulson@2073
   113
paulson@2073
   114
paulson@2073
   115
paulson@2073
   116
fun single_tr c [s1,s2] =
paulson@2073
   117
    Const(c,dummyT)$seq_tr s1$singlobj_tr s2;
paulson@2073
   118
paulson@2073
   119
fun two_seq_tr c [s1,s2] =
paulson@2073
   120
    Const(c,dummyT)$seq_tr s1$seq_tr s2;
paulson@2073
   121
paulson@2073
   122
fun three_seq_tr c [s1,s2,s3] =
paulson@2073
   123
    Const(c,dummyT)$seq_tr s1$seq_tr s2$seq_tr s3;
paulson@2073
   124
paulson@2073
   125
fun four_seq_tr c [s1,s2,s3,s4] =
paulson@2073
   126
    Const(c,dummyT)$seq_tr s1$seq_tr s2$seq_tr s3$seq_tr s4;
paulson@2073
   127
paulson@2073
   128
paulson@2073
   129
fun singlobj_tr'(Const("SeqO'",_)$fm) = fm |
paulson@2073
   130
    singlobj_tr'(id) = Const("@SeqId",dummyT)$id;
paulson@2073
   131
paulson@2073
   132
paulson@2073
   133
fun single_tr' c [s1, s2] =
paulson@2073
   134
(Const (c, dummyT)$seq_tr' s1$seq_tr' s2 ); 
paulson@2073
   135
paulson@2073
   136
paulson@2073
   137
fun two_seq_tr' c [s1, s2] =
paulson@2073
   138
  Const (c, dummyT)$seq_tr' s1$seq_tr' s2; 
paulson@2073
   139
paulson@2073
   140
fun three_seq_tr' c [s1, s2, s3] =
paulson@2073
   141
  Const (c, dummyT)$seq_tr' s1$seq_tr' s2$seq_tr' s3; 
paulson@2073
   142
paulson@2073
   143
fun four_seq_tr' c [s1, s2, s3, s4] =
paulson@2073
   144
  Const (c, dummyT)$seq_tr' s1$seq_tr' s2$seq_tr' s3$seq_tr' s4; 
paulson@2073
   145
paulson@2073
   146
paulson@2073
   147