| author | paulson |
| Thu, 05 Oct 2006 10:46:26 +0200 | |
| changeset 20864 | bb75b876b260 |
| parent 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 |
||
|
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
14981
diff
changeset
|
14 |
pgoal "typeof (fix (%fact. abs(%n. (app fact (n - Z))))) ?T"; |
| 9015 | 15 |
|
|
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
14981
diff
changeset
|
16 |
pgoal "typeof (fix (%fact. abs(%n. cond (n eq Z) (S Z) \ |
|
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
14981
diff
changeset
|
17 |
\(n * (app fact (n - (S Z))))))) ?T"; |
| 9015 | 18 |
|
|
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
14981
diff
changeset
|
19 |
pgoal "typeof (abs(%v. Z)) ?T"; (*correct only solution (?A1 -> nat) *) |
|
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
14981
diff
changeset
|
20 |
Goal "typeof (abs(%v. Z)) ?T"; |
| 9015 | 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)*) |