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