src/HOL/Prolog/Type.ML
author webertj
Mon Mar 07 19:30:53 2005 +0100 (2005-03-07)
changeset 15584 3478bb4f93ff
parent 14981 e73f8140af78
child 20713 823967ef47f1
permissions -rw-r--r--
refute_params: default value itself=1 added (for type classes)
oheimb@13208
     1
(*  Title:    HOL/Prolog/Type.ML
oheimb@13208
     2
    ID:       $Id$
oheimb@13208
     3
    Author:   David von Oheimb (based on a lecture on Lambda Prolog by Nadathur)
oheimb@13208
     4
*)
oheimb@13208
     5
oheimb@9015
     6
val prog_Type = prog_Func @ [good_typeof,common_typeof];
wenzelm@12486
     7
fun pgoal s = (case Goal s of _ => by (prolog_tac prog_Type));
oheimb@9015
     8
val p = ptac prog_Type 1;
oheimb@9015
     9
oheimb@9015
    10
pgoal "typeof (abs(%n. abs(%m. abs(%p. p and (n eq m))))) ?T";
oheimb@9015
    11
oheimb@9015
    12
pgoal "typeof (fix (%x. x)) ?T";
oheimb@9015
    13
wenzelm@11701
    14
pgoal "typeof (fix (%fact. abs(%n. (app fact (n - 0))))) ?T";
oheimb@9015
    15
oheimb@9015
    16
pgoal "typeof (fix (%fact. abs(%n. cond (n eq 0) (S 0) \
oheimb@9015
    17
				\(n * (app fact (n - (S 0))))))) ?T";
oheimb@9015
    18
oheimb@9015
    19
pgoal "typeof (abs(%v. 0)) ?T"; (*correct only solution (?A1 -> nat) *)
oheimb@9015
    20
Goal "typeof (abs(%v. 0)) ?T";
oheimb@9015
    21
by (prolog_tac [bad1_typeof,common_typeof]); (* 1st result ok*)
oheimb@9015
    22
back(); (* 2nd result (?A1 -> ?A1) wrong *)
oheimb@9015
    23
oheimb@9015
    24
(*pgoal "typeof (abs(%v. abs(%v. app v v))) ?T"; correctly fails*)
oheimb@9015
    25
Goal "typeof (abs(%v. abs(%v. app v v))) ?T";
oheimb@9015
    26
by (prolog_tac [bad2_typeof,common_typeof]); 
oheimb@9015
    27
	(* wrong result ((?A3 -> ?B3) -> ?A3 -> ?B3)*)