author | wenzelm |
Fri, 20 Sep 2024 19:51:08 +0200 | |
changeset 80914 | d97fdabd9e2b |
parent 74302 | 6bc96f31cafd |
permissions | -rw-r--r-- |
17481 | 1 |
(* Title: Sequents/Sequents.thy |
2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
3 |
Copyright 1993 University of Cambridge |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
4 |
*) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
5 |
|
60770 | 6 |
section \<open>Parsing and pretty-printing of sequences\<close> |
17481 | 7 |
|
8 |
theory Sequents |
|
9 |
imports Pure |
|
55228 | 10 |
keywords "print_pack" :: diag |
17481 | 11 |
begin |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
12 |
|
39557
fe5722fce758
renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents:
38499
diff
changeset
|
13 |
setup Pure_Thy.old_appl_syntax_setup |
26956
1309a6a0a29f
setup PureThy.old_appl_syntax_setup -- theory Pure provides regular application syntax by default;
wenzelm
parents:
24178
diff
changeset
|
14 |
|
24178
4ff1dc2aa18d
turned Unify flags into configuration options (global only);
wenzelm
parents:
18176
diff
changeset
|
15 |
declare [[unify_trace_bound = 20, unify_search_bound = 40]] |
4ff1dc2aa18d
turned Unify flags into configuration options (global only);
wenzelm
parents:
18176
diff
changeset
|
16 |
|
17481 | 17 |
typedecl o |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
18 |
|
55228 | 19 |
|
60770 | 20 |
subsection \<open>Sequences\<close> |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
21 |
|
61385 | 22 |
typedecl seq' |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
23 |
consts |
61386 | 24 |
SeqO' :: "[o,seq']\<Rightarrow>seq'" |
25 |
Seq1' :: "o\<Rightarrow>seq'" |
|
17481 | 26 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
27 |
|
60770 | 28 |
subsection \<open>Concrete syntax\<close> |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
29 |
|
41229
d797baa3d57c
replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents:
39557
diff
changeset
|
30 |
nonterminal seq and seqobj and seqcont |
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 |
syntax |
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
33 |
"_SeqEmp" :: seq (\<open>\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
34 |
"_SeqApp" :: "[seqobj,seqcont] \<Rightarrow> seq" (\<open>__\<close>) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
35 |
|
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
36 |
"_SeqContEmp" :: seqcont (\<open>\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
37 |
"_SeqContApp" :: "[seqobj,seqcont] \<Rightarrow> seqcont" (\<open>,/ __\<close>) |
17481 | 38 |
|
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
39 |
"_SeqO" :: "o \<Rightarrow> seqobj" (\<open>_\<close>) |
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
40 |
"_SeqId" :: "'a \<Rightarrow> seqobj" (\<open>$_\<close>) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
41 |
|
61386 | 42 |
type_synonym single_seqe = "[seq,seqobj] \<Rightarrow> prop" |
43 |
type_synonym single_seqi = "[seq'\<Rightarrow>seq',seq'\<Rightarrow>seq'] \<Rightarrow> prop" |
|
44 |
type_synonym two_seqi = "[seq'\<Rightarrow>seq', seq'\<Rightarrow>seq'] \<Rightarrow> prop" |
|
45 |
type_synonym two_seqe = "[seq, seq] \<Rightarrow> prop" |
|
46 |
type_synonym three_seqi = "[seq'\<Rightarrow>seq', seq'\<Rightarrow>seq', seq'\<Rightarrow>seq'] \<Rightarrow> prop" |
|
47 |
type_synonym three_seqe = "[seq, seq, seq] \<Rightarrow> prop" |
|
48 |
type_synonym four_seqi = "[seq'\<Rightarrow>seq', seq'\<Rightarrow>seq', seq'\<Rightarrow>seq', seq'\<Rightarrow>seq'] \<Rightarrow> prop" |
|
49 |
type_synonym four_seqe = "[seq, seq, seq, seq] \<Rightarrow> prop" |
|
50 |
type_synonym sequence_name = "seq'\<Rightarrow>seq'" |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
51 |
|
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
52 |
|
14765 | 53 |
syntax |
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
54 |
(*Constant to allow definitions of SEQUENCES of formulas*) |
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
74302
diff
changeset
|
55 |
"_Side" :: "seq\<Rightarrow>(seq'\<Rightarrow>seq')" (\<open><<(_)>>\<close>) |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
56 |
|
60770 | 57 |
ML \<open> |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
58 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
59 |
(* parse translation for sequences *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
60 |
|
74302 | 61 |
fun abs_seq' t = Abs ("s", \<^Type>\<open>seq'\<close>, t); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
62 |
|
74302 | 63 |
fun seqobj_tr (Const (\<^syntax_const>\<open>_SeqO\<close>, _) $ f) = Syntax.const \<^const_syntax>\<open>SeqO'\<close> $ f |
35113 | 64 |
| seqobj_tr (_ $ i) = i; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
65 |
|
69593 | 66 |
fun seqcont_tr (Const (\<^syntax_const>\<open>_SeqContEmp\<close>, _)) = Bound 0 |
67 |
| seqcont_tr (Const (\<^syntax_const>\<open>_SeqContApp\<close>, _) $ so $ sc) = |
|
35113 | 68 |
seqobj_tr so $ seqcont_tr sc; |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
69 |
|
69593 | 70 |
fun seq_tr (Const (\<^syntax_const>\<open>_SeqEmp\<close>, _)) = abs_seq' (Bound 0) |
71 |
| seq_tr (Const (\<^syntax_const>\<open>_SeqApp\<close>, _) $ so $ sc) = |
|
35113 | 72 |
abs_seq'(seqobj_tr so $ seqcont_tr sc); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
73 |
|
69593 | 74 |
fun singlobj_tr (Const (\<^syntax_const>\<open>_SeqO\<close>,_) $ f) = |
74302 | 75 |
abs_seq' ((Syntax.const \<^const_syntax>\<open>SeqO'\<close> $ f) $ Bound 0); |
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
76 |
|
17481 | 77 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
78 |
(* print translation for sequences *) |
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
79 |
|
74302 | 80 |
fun seqcont_tr' (Bound 0) = Syntax.const \<^syntax_const>\<open>_SeqContEmp\<close> |
69593 | 81 |
| seqcont_tr' (Const (\<^const_syntax>\<open>SeqO'\<close>, _) $ f $ s) = |
74302 | 82 |
Syntax.const \<^syntax_const>\<open>_SeqContApp\<close> $ |
83 |
(Syntax.const \<^syntax_const>\<open>_SeqO\<close> $ f) $ seqcont_tr' s |
|
35113 | 84 |
| seqcont_tr' (i $ s) = |
74302 | 85 |
Syntax.const \<^syntax_const>\<open>_SeqContApp\<close> $ |
86 |
(Syntax.const \<^syntax_const>\<open>_SeqId\<close> $ i) $ seqcont_tr' s; |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
87 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
88 |
fun seq_tr' s = |
35113 | 89 |
let |
74302 | 90 |
fun seq_itr' (Bound 0) = Syntax.const \<^syntax_const>\<open>_SeqEmp\<close> |
69593 | 91 |
| seq_itr' (Const (\<^const_syntax>\<open>SeqO'\<close>, _) $ f $ s) = |
74302 | 92 |
Syntax.const \<^syntax_const>\<open>_SeqApp\<close> $ |
93 |
(Syntax.const \<^syntax_const>\<open>_SeqO\<close> $ f) $ seqcont_tr' s |
|
35113 | 94 |
| seq_itr' (i $ s) = |
74302 | 95 |
Syntax.const \<^syntax_const>\<open>_SeqApp\<close> $ |
96 |
(Syntax.const \<^syntax_const>\<open>_SeqId\<close> $ i) $ seqcont_tr' s |
|
35113 | 97 |
in |
98 |
case s of |
|
99 |
Abs (_, _, t) => seq_itr' t |
|
100 |
| _ => s $ Bound 0 |
|
101 |
end; |
|
2073
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 |
|
35113 | 104 |
fun single_tr c [s1, s2] = |
74302 | 105 |
Syntax.const c $ seq_tr s1 $ singlobj_tr s2; |
35113 | 106 |
|
107 |
fun two_seq_tr c [s1, s2] = |
|
74302 | 108 |
Syntax.const c $ seq_tr s1 $ seq_tr s2; |
35113 | 109 |
|
110 |
fun three_seq_tr c [s1, s2, s3] = |
|
74302 | 111 |
Syntax.const c $ seq_tr s1 $ seq_tr s2 $ seq_tr s3; |
35113 | 112 |
|
113 |
fun four_seq_tr c [s1, s2, s3, s4] = |
|
74302 | 114 |
Syntax.const c $ 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
|
115 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
116 |
|
69593 | 117 |
fun singlobj_tr' (Const (\<^const_syntax>\<open>SeqO'\<close>,_) $ fm) = fm |
74302 | 118 |
| singlobj_tr' id = Syntax.const \<^syntax_const>\<open>_SeqId\<close> $ id; |
2073
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] = |
74302 | 122 |
Syntax.const c $ seq_tr' s1 $ seq_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] = |
74302 | 125 |
Syntax.const c $ 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] = |
74302 | 128 |
Syntax.const c $ 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] = |
74302 | 131 |
Syntax.const c $ seq_tr' s1 $ seq_tr' s2 $ seq_tr' s3 $ seq_tr' s4; |
17481 | 132 |
|
2073
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
133 |
|
fb0655539d05
New unified treatment of sequent calculi by Sara Kalvala
paulson
parents:
diff
changeset
|
134 |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
135 |
(** for the <<...>> notation **) |
17481 | 136 |
|
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
137 |
fun side_tr [s1] = seq_tr s1; |
60770 | 138 |
\<close> |
7166
a4a870ec2e67
Sara Kalvala: moving the <<...>> notation from LK to Sequents
paulson
parents:
7121
diff
changeset
|
139 |
|
69593 | 140 |
parse_translation \<open>[(\<^syntax_const>\<open>_Side\<close>, K side_tr)]\<close> |
17481 | 141 |
|
55228 | 142 |
|
60770 | 143 |
subsection \<open>Proof tools\<close> |
55228 | 144 |
|
69605 | 145 |
ML_file \<open>prover.ML\<close> |
17481 | 146 |
|
147 |
end |