author | haftmann |
Tue, 06 Nov 2007 13:12:56 +0100 | |
changeset 25313 | 98a145c9a22f |
parent 24178 | 4ff1dc2aa18d |
child 26956 | 1309a6a0a29f |
permissions | -rw-r--r-- |
17481 | 1 |
(* Title: Sequents/Sequents.thy |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
17481 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
4 |
Copyright 1993 University of Cambridge |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
5 |
*) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
6 |
|
17481 | 7 |
header {* Parsing and pretty-printing of sequences *} |
8 |
||
9 |
theory Sequents |
|
10 |
imports Pure |
|
11 |
uses ("prover.ML") |
|
12 |
begin |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
13 |
|
24178
4ff1dc2aa18d
turned Unify flags into configuration options (global only);
wenzelm
parents:
18176
diff
changeset
|
14 |
declare [[unify_trace_bound = 20, unify_search_bound = 40]] |
4ff1dc2aa18d
turned Unify flags into configuration options (global only);
wenzelm
parents:
18176
diff
changeset
|
15 |
|
7098
86583034aacf
installation of simplifier and classical reasoner, better rules etc
paulson
parents:
6819
diff
changeset
|
16 |
global |
86583034aacf
installation of simplifier and classical reasoner, better rules etc
paulson
parents:
6819
diff
changeset
|
17 |
|
17481 | 18 |
typedecl o |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
19 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
20 |
(* Sequences *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
21 |
|
17481 | 22 |
typedecl |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
23 |
seq' |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
24 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
25 |
consts |
17481 | 26 |
SeqO' :: "[o,seq']=>seq'" |
27 |
Seq1' :: "o=>seq'" |
|
28 |
||
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
29 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
30 |
(* concrete syntax *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
31 |
|
14765 | 32 |
nonterminals |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
33 |
seq seqobj seqcont |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
34 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
35 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
36 |
syntax |
17481 | 37 |
SeqEmp :: seq ("") |
38 |
SeqApp :: "[seqobj,seqcont] => seq" ("__") |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
39 |
|
17481 | 40 |
SeqContEmp :: seqcont ("") |
41 |
SeqContApp :: "[seqobj,seqcont] => seqcont" (",/ __") |
|
42 |
||
43 |
SeqO :: "o => seqobj" ("_") |
|
44 |
SeqId :: "'a => seqobj" ("$_") |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
45 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
46 |
types |
17481 | 47 |
single_seqe = "[seq,seqobj] => prop" |
48 |
single_seqi = "[seq'=>seq',seq'=>seq'] => prop" |
|
49 |
two_seqi = "[seq'=>seq', seq'=>seq'] => prop" |
|
50 |
two_seqe = "[seq, seq] => prop" |
|
51 |
three_seqi = "[seq'=>seq', seq'=>seq', seq'=>seq'] => prop" |
|
52 |
three_seqe = "[seq, seq, seq] => prop" |
|
53 |
four_seqi = "[seq'=>seq', seq'=>seq', seq'=>seq', seq'=>seq'] => prop" |
|
54 |
four_seqe = "[seq, seq, seq, seq] => prop" |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
55 |
|
17481 | 56 |
sequence_name = "seq'=>seq'" |
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
57 |
|
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
58 |
|
14765 | 59 |
syntax |
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
60 |
(*Constant to allow definitions of SEQUENCES of formulas*) |
17481 | 61 |
"@Side" :: "seq=>(seq'=>seq')" ("<<(_)>>") |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
62 |
|
17481 | 63 |
ML {* |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
64 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
65 |
(* parse translation for sequences *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
66 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
67 |
fun abs_seq' t = Abs("s", Type("seq'",[]), t); |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
68 |
|
6819 | 69 |
fun seqobj_tr(Const("SeqO",_) $ f) = Const("SeqO'",dummyT) $ f | |
70 |
seqobj_tr(_ $ i) = i; |
|
17481 | 71 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
72 |
fun seqcont_tr(Const("SeqContEmp",_)) = Bound 0 | |
17481 | 73 |
seqcont_tr(Const("SeqContApp",_) $ so $ sc) = |
6819 | 74 |
(seqobj_tr so) $ (seqcont_tr sc); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
75 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
76 |
fun seq_tr(Const("SeqEmp",_)) = abs_seq'(Bound 0) | |
17481 | 77 |
seq_tr(Const("SeqApp",_) $ so $ sc) = |
6819 | 78 |
abs_seq'(seqobj_tr(so) $ seqcont_tr(sc)); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
79 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
80 |
|
6819 | 81 |
fun singlobj_tr(Const("SeqO",_) $ f) = |
82 |
abs_seq' ((Const("SeqO'",dummyT) $ f) $ Bound 0); |
|
17481 | 83 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
84 |
|
17481 | 85 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
86 |
(* print translation for sequences *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
87 |
|
17481 | 88 |
fun seqcont_tr' (Bound 0) = |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
89 |
Const("SeqContEmp",dummyT) | |
6819 | 90 |
seqcont_tr' (Const("SeqO'",_) $ f $ s) = |
17481 | 91 |
Const("SeqContApp",dummyT) $ |
92 |
(Const("SeqO",dummyT) $ f) $ |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
93 |
(seqcont_tr' s) | |
17481 | 94 |
(* seqcont_tr' ((a as Abs(_,_,_)) $ s)= |
18176 | 95 |
seqcont_tr'(Term.betapply(a,s)) | *) |
17481 | 96 |
seqcont_tr' (i $ s) = |
97 |
Const("SeqContApp",dummyT) $ |
|
98 |
(Const("SeqId",dummyT) $ i) $ |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
99 |
(seqcont_tr' s); |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
100 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
101 |
fun seq_tr' s = |
17481 | 102 |
let fun seq_itr' (Bound 0) = |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
103 |
Const("SeqEmp",dummyT) | |
6819 | 104 |
seq_itr' (Const("SeqO'",_) $ f $ s) = |
17481 | 105 |
Const("SeqApp",dummyT) $ |
6819 | 106 |
(Const("SeqO",dummyT) $ f) $ (seqcont_tr' s) | |
107 |
(* seq_itr' ((a as Abs(_,_,_)) $ s) = |
|
18176 | 108 |
seq_itr'(Term.betapply(a,s)) | *) |
6819 | 109 |
seq_itr' (i $ s) = |
17481 | 110 |
Const("SeqApp",dummyT) $ |
111 |
(Const("SeqId",dummyT) $ i) $ |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
112 |
(seqcont_tr' s) |
17481 | 113 |
in case s of |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
114 |
Abs(_,_,t) => seq_itr' t | |
6819 | 115 |
_ => s $ (Bound 0) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
116 |
end; |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
117 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
118 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
119 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
120 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
121 |
fun single_tr c [s1,s2] = |
6819 | 122 |
Const(c,dummyT) $ seq_tr s1 $ singlobj_tr s2; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
123 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
124 |
fun two_seq_tr c [s1,s2] = |
6819 | 125 |
Const(c,dummyT) $ seq_tr s1 $ seq_tr s2; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
126 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
127 |
fun three_seq_tr c [s1,s2,s3] = |
6819 | 128 |
Const(c,dummyT) $ seq_tr s1 $ seq_tr s2 $ seq_tr s3; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
129 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
130 |
fun four_seq_tr c [s1,s2,s3,s4] = |
6819 | 131 |
Const(c,dummyT) $ seq_tr s1 $ seq_tr s2 $ seq_tr s3 $ seq_tr s4; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
132 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
133 |
|
6819 | 134 |
fun singlobj_tr'(Const("SeqO'",_) $ fm) = fm | |
135 |
singlobj_tr'(id) = Const("@SeqId",dummyT) $ id; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
136 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
137 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
138 |
fun single_tr' c [s1, s2] = |
17481 | 139 |
(Const (c, dummyT) $ seq_tr' s1 $ seq_tr' s2 ); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
140 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
141 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
142 |
fun two_seq_tr' c [s1, s2] = |
17481 | 143 |
Const (c, dummyT) $ seq_tr' s1 $ seq_tr' s2; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
144 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
145 |
fun three_seq_tr' c [s1, s2, s3] = |
17481 | 146 |
Const (c, dummyT) $ seq_tr' s1 $ seq_tr' s2 $ seq_tr' s3; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
147 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
148 |
fun four_seq_tr' c [s1, s2, s3, s4] = |
17481 | 149 |
Const (c, dummyT) $ seq_tr' s1 $ seq_tr' s2 $ seq_tr' s3 $ seq_tr' s4; |
150 |
||
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
151 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
152 |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
153 |
(** for the <<...>> notation **) |
17481 | 154 |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
155 |
fun side_tr [s1] = seq_tr s1; |
17481 | 156 |
*} |
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
157 |
|
17481 | 158 |
parse_translation {* [("@Side", side_tr)] *} |
159 |
||
160 |
use "prover.ML" |
|
161 |
||
162 |
end |
|
163 |