12 |
12 |
13 typedecl "term" |
13 typedecl "term" |
14 typedecl "context" |
14 typedecl "context" |
15 typedecl typing |
15 typedecl typing |
16 |
16 |
|
17 axiomatization |
|
18 Abs :: "[term, term => term] => term" and |
|
19 Prod :: "[term, term => term] => term" and |
|
20 Trueprop :: "[context, typing] => prop" and |
|
21 MT_context :: "context" and |
|
22 Context :: "[typing, context] => context" and |
|
23 star :: "term" ("*") and |
|
24 box :: "term" ("[]") and |
|
25 app :: "[term, term] => term" (infixl "^" 20) and |
|
26 Has_type :: "[term, term] => typing" |
|
27 |
|
28 notation (xsymbols) |
|
29 box ("\<box>") |
|
30 |
17 nonterminal context' and typing' |
31 nonterminal context' and typing' |
18 |
32 |
19 consts |
|
20 Abs :: "[term, term => term] => term" |
|
21 Prod :: "[term, term => term] => term" |
|
22 Trueprop :: "[context, typing] => prop" |
|
23 MT_context :: "context" |
|
24 Context :: "[typing, context] => context" |
|
25 star :: "term" ("*") |
|
26 box :: "term" ("[]") |
|
27 app :: "[term, term] => term" (infixl "^" 20) |
|
28 Has_type :: "[term, term] => typing" |
|
29 |
|
30 syntax |
33 syntax |
31 "\<^const>Cube.Trueprop" :: "[context', typing'] => prop" ("(_/ |- _)") |
34 "_Trueprop" :: "[context', typing'] => prop" ("(_/ |- _)") |
32 "_Trueprop1" :: "typing' => prop" ("(_)") |
35 "_Trueprop1" :: "typing' => prop" ("(_)") |
33 "" :: "id => context'" ("_") |
36 "" :: "id => context'" ("_") |
34 "" :: "var => context'" ("_") |
37 "" :: "var => context'" ("_") |
35 "\<^const>Cube.MT_context" :: "context'" ("") |
38 "_MT_context" :: "context'" ("") |
36 "\<^const>Cube.Context" :: "[typing', context'] => context'" ("_ _") |
39 "_Context" :: "[typing', context'] => context'" ("_ _") |
37 "\<^const>Cube.Has_type" :: "[term, term] => typing'" ("(_:/ _)" [0, 0] 5) |
40 "_Has_type" :: "[term, term] => typing'" ("(_:/ _)" [0, 0] 5) |
38 "_Lam" :: "[idt, term, term] => term" ("(3Lam _:_./ _)" [0, 0, 0] 10) |
41 "_Lam" :: "[idt, term, term] => term" ("(3Lam _:_./ _)" [0, 0, 0] 10) |
39 "_Pi" :: "[idt, term, term] => term" ("(3Pi _:_./ _)" [0, 0] 10) |
42 "_Pi" :: "[idt, term, term] => term" ("(3Pi _:_./ _)" [0, 0] 10) |
40 "_arrow" :: "[term, term] => term" (infixr "->" 10) |
43 "_arrow" :: "[term, term] => term" (infixr "->" 10) |
41 |
44 |
42 translations |
45 translations |
|
46 "_Trueprop(G, t)" == "CONST Trueprop(G, t)" |
43 ("prop") "x:X" == ("prop") "|- x:X" |
47 ("prop") "x:X" == ("prop") "|- x:X" |
|
48 "_MT_context" == "CONST MT_context" |
|
49 "_Context" == "CONST Context" |
|
50 "_Has_type" == "CONST Has_type" |
44 "Lam x:A. B" == "CONST Abs(A, %x. B)" |
51 "Lam x:A. B" == "CONST Abs(A, %x. B)" |
45 "Pi x:A. B" => "CONST Prod(A, %x. B)" |
52 "Pi x:A. B" => "CONST Prod(A, %x. B)" |
46 "A -> B" => "CONST Prod(A, %_. B)" |
53 "A -> B" => "CONST Prod(A, %_. B)" |
47 |
54 |
48 syntax (xsymbols) |
55 syntax (xsymbols) |
49 "\<^const>Cube.Trueprop" :: "[context', typing'] => prop" ("(_/ \<turnstile> _)") |
56 "_Trueprop" :: "[context', typing'] => prop" ("(_/ \<turnstile> _)") |
50 "\<^const>Cube.box" :: "term" ("\<box>") |
|
51 "_Lam" :: "[idt, term, term] => term" ("(3\<Lambda> _:_./ _)" [0, 0, 0] 10) |
57 "_Lam" :: "[idt, term, term] => term" ("(3\<Lambda> _:_./ _)" [0, 0, 0] 10) |
52 "_Pi" :: "[idt, term, term] => term" ("(3\<Pi> _:_./ _)" [0, 0] 10) |
58 "_Pi" :: "[idt, term, term] => term" ("(3\<Pi> _:_./ _)" [0, 0] 10) |
53 "_arrow" :: "[term, term] => term" (infixr "\<rightarrow>" 10) |
59 "_arrow" :: "[term, term] => term" (infixr "\<rightarrow>" 10) |
54 |
60 |
55 print_translation {* |
61 print_translation {* |
56 [(@{const_syntax Prod}, |
62 [(@{const_syntax Prod}, |
57 Syntax_Trans.dependent_tr' (@{syntax_const "_Pi"}, @{syntax_const "_arrow"}))] |
63 Syntax_Trans.dependent_tr' (@{syntax_const "_Pi"}, @{syntax_const "_arrow"}))] |
58 *} |
64 *} |
59 |
65 |
60 axioms |
66 axiomatization where |
61 s_b: "*: []" |
67 s_b: "*: []" and |
62 |
68 |
63 strip_s: "[| A:*; a:A ==> G |- x:X |] ==> a:A G |- x:X" |
69 strip_s: "[| A:*; a:A ==> G |- x:X |] ==> a:A G |- x:X" and |
64 strip_b: "[| A:[]; a:A ==> G |- x:X |] ==> a:A G |- x:X" |
70 strip_b: "[| A:[]; a:A ==> G |- x:X |] ==> a:A G |- x:X" and |
65 |
71 |
66 app: "[| F:Prod(A, B); C:A |] ==> F^C: B(C)" |
72 app: "[| F:Prod(A, B); C:A |] ==> F^C: B(C)" and |
67 |
73 |
68 pi_ss: "[| A:*; !!x. x:A ==> B(x):* |] ==> Prod(A, B):*" |
74 pi_ss: "[| A:*; !!x. x:A ==> B(x):* |] ==> Prod(A, B):*" and |
69 |
75 |
70 lam_ss: "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):* |] |
76 lam_ss: "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):* |] |
71 ==> Abs(A, f) : Prod(A, B)" |
77 ==> Abs(A, f) : Prod(A, B)" and |
72 |
78 |
73 beta: "Abs(A, f)^a == f(a)" |
79 beta: "Abs(A, f)^a == f(a)" |
74 |
80 |
75 lemmas simple = s_b strip_s strip_b app lam_ss pi_ss |
81 lemmas simple = s_b strip_s strip_b app lam_ss pi_ss |
76 lemmas rules = simple |
82 lemmas rules = simple |
77 |
83 |
78 lemma imp_elim: |
84 lemma imp_elim: |
103 |
109 |
104 locale LP = |
110 locale LP = |
105 assumes pi_sb: "[| A:*; !!x. x:A ==> B(x):[] |] ==> Prod(A,B):[]" |
111 assumes pi_sb: "[| A:*; !!x. x:A ==> B(x):[] |] ==> Prod(A,B):[]" |
106 and lam_sb: "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):[] |] |
112 and lam_sb: "[| A:*; !!x. x:A ==> f(x):B(x); !!x. x:A ==> B(x):[] |] |
107 ==> Abs(A,f) : Prod(A,B)" |
113 ==> Abs(A,f) : Prod(A,B)" |
|
114 begin |
108 |
115 |
109 lemmas (in LP) rules = simple lam_sb pi_sb |
116 lemmas rules = simple lam_sb pi_sb |
|
117 |
|
118 end |
110 |
119 |
111 |
120 |
112 locale LP2 = LP + L2 |
121 locale LP2 = LP + L2 |
|
122 begin |
113 |
123 |
114 lemmas (in LP2) rules = simple lam_bs pi_bs lam_sb pi_sb |
124 lemmas rules = simple lam_bs pi_bs lam_sb pi_sb |
|
125 |
|
126 end |
115 |
127 |
116 |
128 |
117 locale Lomega2 = L2 + Lomega |
129 locale Lomega2 = L2 + Lomega |
|
130 begin |
118 |
131 |
119 lemmas (in Lomega2) rules = simple lam_bs pi_bs lam_bb pi_bb |
132 lemmas rules = simple lam_bs pi_bs lam_bb pi_bb |
|
133 |
|
134 end |
120 |
135 |
121 |
136 |
122 locale LPomega = LP + Lomega |
137 locale LPomega = LP + Lomega |
|
138 begin |
123 |
139 |
124 lemmas (in LPomega) rules = simple lam_bb pi_bb lam_sb pi_sb |
140 lemmas rules = simple lam_bb pi_bb lam_sb pi_sb |
|
141 |
|
142 end |
125 |
143 |
126 |
144 |
127 locale CC = L2 + LP + Lomega |
145 locale CC = L2 + LP + Lomega |
|
146 begin |
128 |
147 |
129 lemmas (in CC) rules = simple lam_bs pi_bs lam_bb pi_bb lam_sb pi_sb |
148 lemmas rules = simple lam_bs pi_bs lam_bb pi_bb lam_sb pi_sb |
130 |
149 |
131 end |
150 end |
|
151 |
|
152 end |