4 print_depth 0; |
4 print_depth 0; |
5 |
5 |
6 |
6 |
7 (*** Type inference, from CTT/ex/typechk.ML ***) |
7 (*** Type inference, from CTT/ex/typechk.ML ***) |
8 |
8 |
9 goal CTT_Rule.thy "lam n. rec(n, 0, %x y.x) : ?A"; |
9 goal CTT.thy "lam n. rec(n, 0, %x y.x) : ?A"; |
10 by (resolve_tac [ProdI] 1); |
10 by (resolve_tac [ProdI] 1); |
11 by (eresolve_tac [NE] 2); |
11 by (eresolve_tac [NE] 2); |
12 by (resolve_tac [NI0] 2); |
12 by (resolve_tac [NI0] 2); |
13 by (assume_tac 2); |
13 by (assume_tac 2); |
14 by (resolve_tac [NF] 1); |
14 by (resolve_tac [NF] 1); |
15 |
15 |
16 |
16 |
17 |
17 |
18 (*** Logical reasoning, from CTT/ex/elim.ML ***) |
18 (*** Logical reasoning, from CTT/ex/elim.ML ***) |
19 |
19 |
20 val prems = goal CTT_Rule.thy |
20 val prems = goal CTT.thy |
21 "[| A type; \ |
21 "[| A type; \ |
22 \ !!x. x:A ==> B(x) type; \ |
22 \ !!x. x:A ==> B(x) type; \ |
23 \ !!x. x:A ==> C(x) type; \ |
23 \ !!x. x:A ==> C(x) type; \ |
24 \ p: SUM x:A. B(x) + C(x) \ |
24 \ p: SUM x:A. B(x) + C(x) \ |
25 \ |] ==> ?a : (SUM x:A. B(x)) + (SUM x:A. C(x))"; |
25 \ |] ==> ?a : (SUM x:A. B(x)) + (SUM x:A. C(x))"; |
33 by (pc_tac prems 1); |
33 by (pc_tac prems 1); |
34 |
34 |
35 |
35 |
36 (*** Currying, from CTT/ex/elim.ML ***) |
36 (*** Currying, from CTT/ex/elim.ML ***) |
37 |
37 |
38 val prems = goal CTT_Rule.thy |
38 val prems = goal CTT.thy |
39 "[| A type; !!x. x:A ==> B(x) type; \ |
39 "[| A type; !!x. x:A ==> B(x) type; \ |
40 \ !!z. z: (SUM x:A. B(x)) ==> C(z) type |] \ |
40 \ !!z. z: (SUM x:A. B(x)) ==> C(z) type |] \ |
41 \ ==> ?a : (PROD z : (SUM x:A . B(x)) . C(z)) \ |
41 \ ==> ?a : (PROD z : (SUM x:A . B(x)) . C(z)) \ |
42 \ --> (PROD x:A . PROD y:B(x) . C(<x,y>))"; |
42 \ --> (PROD x:A . PROD y:B(x) . C(<x,y>))"; |
43 by (intr_tac prems); |
43 by (intr_tac prems); |
45 by (intr_tac prems); |
45 by (intr_tac prems); |
46 |
46 |
47 |
47 |
48 (*** Axiom of Choice ***) |
48 (*** Axiom of Choice ***) |
49 |
49 |
50 val prems = goal CTT_Rule.thy |
50 val prems = goal CTT.thy |
51 "[| A type; !!x. x:A ==> B(x) type; \ |
51 "[| A type; !!x. x:A ==> B(x) type; \ |
52 \ !!x y.[| x:A; y:B(x) |] ==> C(x,y) type \ |
52 \ !!x y.[| x:A; y:B(x) |] ==> C(x,y) type \ |
53 \ |] ==> ?a : (PROD x:A. SUM y:B(x). C(x,y)) \ |
53 \ |] ==> ?a : (PROD x:A. SUM y:B(x). C(x,y)) \ |
54 \ --> (SUM f: (PROD x:A. B(x)). PROD x:A. C(x, f`x))"; |
54 \ --> (SUM f: (PROD x:A. B(x)). PROD x:A. C(x, f`x))"; |
55 by (intr_tac prems); |
55 by (intr_tac prems); |
63 by (typechk_tac prems); |
63 by (typechk_tac prems); |
64 |
64 |
65 |
65 |
66 |
66 |
67 |
67 |
68 > goal CTT_Rule.thy "lam n. rec(n, 0, %x y.x) : ?A"; |
68 > goal CTT.thy "lam n. rec(n, 0, %x y.x) : ?A"; |
69 Level 0 |
69 Level 0 |
70 lam n. rec(n,0,%x y. x) : ?A |
70 lam n. rec(n,0,%x y. x) : ?A |
71 1. lam n. rec(n,0,%x y. x) : ?A |
71 1. lam n. rec(n,0,%x y. x) : ?A |
72 > by (resolve_tac [ProdI] 1); |
72 > by (resolve_tac [ProdI] 1); |
73 Level 1 |
73 Level 1 |
95 No subgoals! |
95 No subgoals! |
96 |
96 |
97 |
97 |
98 |
98 |
99 |
99 |
100 > val prems = goal CTT_Rule.thy |
100 > val prems = goal CTT.thy |
101 # "[| A type; \ |
101 # "[| A type; \ |
102 # \ !!x. x:A ==> B(x) type; \ |
102 # \ !!x. x:A ==> B(x) type; \ |
103 # \ !!x. x:A ==> C(x) type; \ |
103 # \ !!x. x:A ==> C(x) type; \ |
104 # \ p: SUM x:A. B(x) + C(x) \ |
104 # \ p: SUM x:A. B(x) + C(x) \ |
105 # \ |] ==> ?a : (SUM x:A. B(x)) + (SUM x:A. C(x))"; |
105 # \ |] ==> ?a : (SUM x:A. B(x)) + (SUM x:A. C(x))"; |
172 No subgoals! |
172 No subgoals! |
173 |
173 |
174 |
174 |
175 |
175 |
176 |
176 |
177 > val prems = goal CTT_Rule.thy |
177 > val prems = goal CTT.thy |
178 # "[| A type; !!x. x:A ==> B(x) type; \ |
178 # "[| A type; !!x. x:A ==> B(x) type; \ |
179 # \ !!z. z: (SUM x:A. B(x)) ==> C(z) type |] \ |
179 # \ !!z. z: (SUM x:A. B(x)) ==> C(z) type |] \ |
180 # \ ==> ?a : (PROD z : (SUM x:A . B(x)) . C(z)) \ |
180 # \ ==> ?a : (PROD z : (SUM x:A . B(x)) . C(z)) \ |
181 # \ --> (PROD x:A . PROD y:B(x) . C(<x,y>))"; |
181 # \ --> (PROD x:A . PROD y:B(x) . C(<x,y>))"; |
182 Level 0 |
182 Level 0 |
202 No subgoals! |
202 No subgoals! |
203 |
203 |
204 |
204 |
205 |
205 |
206 |
206 |
207 > val prems = goal CTT_Rule.thy |
207 > val prems = goal CTT.thy |
208 # "[| A type; !!x. x:A ==> B(x) type; \ |
208 # "[| A type; !!x. x:A ==> B(x) type; \ |
209 # \ !!x y.[| x:A; y:B(x) |] ==> C(x,y) type \ |
209 # \ !!x y.[| x:A; y:B(x) |] ==> C(x,y) type \ |
210 # \ |] ==> ?a : (PROD x:A. SUM y:B(x). C(x,y)) \ |
210 # \ |] ==> ?a : (PROD x:A. SUM y:B(x). C(x,y)) \ |
211 # \ --> (SUM f: (PROD x:A. B(x)). PROD x:A. C(x, f`x))"; |
211 # \ --> (SUM f: (PROD x:A. B(x)). PROD x:A. C(x, f`x))"; |
212 Level 0 |
212 Level 0 |