| author | wenzelm | 
| Sun, 22 Jan 2006 18:46:00 +0100 | |
| changeset 18743 | 7ff2934480c9 | 
| parent 14981 | e73f8140af78 | 
| child 20713 | 823967ef47f1 | 
| permissions | -rw-r--r-- | 
| 13208 | 1 | (* Title: HOL/Prolog/Type.ML | 
| 2 | ID: $Id$ | |
| 3 | Author: David von Oheimb (based on a lecture on Lambda Prolog by Nadathur) | |
| 4 | *) | |
| 5 | ||
| 9015 | 6 | val prog_Type = prog_Func @ [good_typeof,common_typeof]; | 
| 12486 | 7 | fun pgoal s = (case Goal s of _ => by (prolog_tac prog_Type)); | 
| 9015 | 8 | val p = ptac prog_Type 1; | 
| 9 | ||
| 10 | pgoal "typeof (abs(%n. abs(%m. abs(%p. p and (n eq m))))) ?T"; | |
| 11 | ||
| 12 | pgoal "typeof (fix (%x. x)) ?T"; | |
| 13 | ||
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
9015diff
changeset | 14 | pgoal "typeof (fix (%fact. abs(%n. (app fact (n - 0))))) ?T"; | 
| 9015 | 15 | |
| 16 | pgoal "typeof (fix (%fact. abs(%n. cond (n eq 0) (S 0) \ | |
| 17 | \(n * (app fact (n - (S 0))))))) ?T"; | |
| 18 | ||
| 19 | pgoal "typeof (abs(%v. 0)) ?T"; (*correct only solution (?A1 -> nat) *) | |
| 20 | Goal "typeof (abs(%v. 0)) ?T"; | |
| 21 | by (prolog_tac [bad1_typeof,common_typeof]); (* 1st result ok*) | |
| 22 | back(); (* 2nd result (?A1 -> ?A1) wrong *) | |
| 23 | ||
| 24 | (*pgoal "typeof (abs(%v. abs(%v. app v v))) ?T"; correctly fails*) | |
| 25 | Goal "typeof (abs(%v. abs(%v. app v v))) ?T"; | |
| 26 | by (prolog_tac [bad2_typeof,common_typeof]); | |
| 27 | (* wrong result ((?A3 -> ?B3) -> ?A3 -> ?B3)*) |