| author | berghofe | 
| Fri, 31 Aug 2001 16:17:52 +0200 | |
| changeset 11523 | 9a658fe20107 | 
| parent 9251 | bd57acd44fc1 | 
| permissions | -rw-r--r-- | 
| 1459 | 1 | (* Title: CTT/ex/typechk | 
| 0 | 2 | ID: $Id$ | 
| 1459 | 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 0 | 4 | Copyright 1991 University of Cambridge | 
| 5 | ||
| 6 | Easy examples: type checking and type deduction | |
| 7 | *) | |
| 8 | ||
| 9 | writeln"Single-step proofs: verifying that a type is well-formed"; | |
| 10 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 11 | Goal "?A type"; | 
| 0 | 12 | by (resolve_tac form_rls 1); | 
| 13 | result(); | |
| 14 | writeln"getting a second solution"; | |
| 15 | back(); | |
| 16 | by (resolve_tac form_rls 1); | |
| 17 | by (resolve_tac form_rls 1); | |
| 18 | result(); | |
| 19 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 20 | Goal "PROD z:?A . N + ?B(z) type"; | 
| 0 | 21 | by (resolve_tac form_rls 1); | 
| 22 | by (resolve_tac form_rls 1); | |
| 23 | by (resolve_tac form_rls 1); | |
| 24 | by (resolve_tac form_rls 1); | |
| 25 | by (resolve_tac form_rls 1); | |
| 26 | uresult(); | |
| 27 | ||
| 28 | ||
| 29 | writeln"Multi-step proofs: Type inference"; | |
| 30 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 31 | Goal "PROD w:N. N + N type"; | 
| 0 | 32 | by form_tac; | 
| 33 | result(); | |
| 34 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 35 | Goal "<0, succ(0)> : ?A"; | 
| 0 | 36 | by (intr_tac[]); | 
| 37 | result(); | |
| 38 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 39 | Goal "PROD w:N . Eq(?A,w,w) type"; | 
| 0 | 40 | by (typechk_tac[]); | 
| 41 | result(); | |
| 42 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 43 | Goal "PROD x:N . PROD y:N . Eq(?A,x,y) type"; | 
| 0 | 44 | by (typechk_tac[]); | 
| 45 | result(); | |
| 46 | ||
| 47 | writeln"typechecking an application of fst"; | |
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 48 | Goal "(lam u. split(u, %v w. v)) ` <0, succ(0)> : ?A"; | 
| 0 | 49 | by (typechk_tac[]); | 
| 50 | result(); | |
| 51 | ||
| 52 | writeln"typechecking the predecessor function"; | |
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 53 | Goal "lam n. rec(n, 0, %x y. x) : ?A"; | 
| 0 | 54 | by (typechk_tac[]); | 
| 55 | result(); | |
| 56 | ||
| 57 | writeln"typechecking the addition function"; | |
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 58 | Goal "lam n. lam m. rec(n, m, %x y. succ(y)) : ?A"; | 
| 0 | 59 | by (typechk_tac[]); | 
| 60 | result(); | |
| 61 | ||
| 62 | (*Proofs involving arbitrary types. | |
| 63 | For concreteness, every type variable left over is forced to be N*) | |
| 64 | val N_tac = TRYALL (rtac NF); | |
| 65 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 66 | Goal "lam w. <w,w> : ?A"; | 
| 0 | 67 | by (typechk_tac[]); | 
| 68 | by N_tac; | |
| 69 | result(); | |
| 70 | ||
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 71 | Goal "lam x. lam y. x : ?A"; | 
| 0 | 72 | by (typechk_tac[]); | 
| 73 | by N_tac; | |
| 74 | result(); | |
| 75 | ||
| 76 | writeln"typechecking fst (as a function object) "; | |
| 9251 
bd57acd44fc1
more tidying.  also generalized some tactics to prove "Type A" and
 paulson parents: 
3837diff
changeset | 77 | Goal "lam i. split(i, %j k. j) : ?A"; | 
| 0 | 78 | by (typechk_tac[]); | 
| 79 | by N_tac; | |
| 80 | result(); | |
| 81 | ||
| 82 | writeln"Reached end of file."; |