src/Pure/term.ML
changeset 24850 0cfd722ab579
parent 24762 8d7da66b1a2c
child 24982 f2f0722675b1
equal deleted inserted replaced
24849:193a10e6bf90 24850:0cfd722ab579
   537 
   537 
   538 (* equivalence up to renaming of types variables *)
   538 (* equivalence up to renaming of types variables *)
   539 
   539 
   540 local
   540 local
   541 
   541 
   542 val invent_names = Name.invents Name.context "'a";
   542 val invent_names = Name.invents Name.context Name.aT;
   543 
   543 
   544 fun standard_types t =
   544 fun standard_types t =
   545   let
   545   let
   546     val tfrees = add_tfrees t [];
   546     val tfrees = add_tfrees t [];
   547     val tvars = add_tvars t [];
   547     val tvars = add_tvars t [];
   738 end;
   738 end;
   739 
   739 
   740 
   740 
   741 (** Connectives of higher order logic **)
   741 (** Connectives of higher order logic **)
   742 
   742 
   743 fun aT S = TFree ("'a", S);
   743 fun aT S = TFree (Name.aT, S);
   744 
   744 
   745 fun itselfT ty = Type ("itself", [ty]);
   745 fun itselfT ty = Type ("itself", [ty]);
   746 val a_itselfT = itselfT (TFree ("'a", []));
   746 val a_itselfT = itselfT (TFree (Name.aT, []));
   747 
   747 
   748 val propT : typ = Type("prop",[]);
   748 val propT : typ = Type("prop",[]);
   749 
   749 
   750 val implies = Const("==>", propT-->propT-->propT);
   750 val implies = Const("==>", propT-->propT-->propT);
   751 
   751 
   947   let val x =
   947   let val x =
   948     (case v of
   948     (case v of
   949       Const (x, _) => NameSpace.base x
   949       Const (x, _) => NameSpace.base x
   950     | Free (x, _) => x
   950     | Free (x, _) => x
   951     | Var ((x, _), _) => x
   951     | Var ((x, _), _) => x
   952     | _ => "uu")
   952     | _ => Name.uu)
   953   in Abs (x, fastype_of v, abstract_over (v, t)) end;
   953   in Abs (x, fastype_of v, abstract_over (v, t)) end;
   954 
   954 
   955 (*Form an abstraction over a free variable.*)
   955 (*Form an abstraction over a free variable.*)
   956 fun absfree (a,T,body) = Abs (a, T, abstract_over (Free (a, T), body));
   956 fun absfree (a,T,body) = Abs (a, T, abstract_over (Free (a, T), body));
   957 fun absdummy (T, body) = Abs (Name.internal "uu", T, body);
   957 fun absdummy (T, body) = Abs (Name.internal Name.uu, T, body);
   958 
   958 
   959 (*Abstraction over a list of free variables*)
   959 (*Abstraction over a list of free variables*)
   960 fun list_abs_free ([ ] ,     t) = t
   960 fun list_abs_free ([ ] ,     t) = t
   961   | list_abs_free ((a,T)::vars, t) =
   961   | list_abs_free ((a,T)::vars, t) =
   962       absfree(a, T, list_abs_free(vars,t));
   962       absfree(a, T, list_abs_free(vars,t));
  1253 fun no_dummy_patterns tm =
  1253 fun no_dummy_patterns tm =
  1254   if not (fold_aterms (fn t => fn b => b orelse is_dummy_pattern t) tm false) then tm
  1254   if not (fold_aterms (fn t => fn b => b orelse is_dummy_pattern t) tm false) then tm
  1255   else raise TERM ("Illegal occurrence of '_' dummy pattern", [tm]);
  1255   else raise TERM ("Illegal occurrence of '_' dummy pattern", [tm]);
  1256 
  1256 
  1257 fun free_dummy_patterns (Const ("dummy_pattern", T)) used =
  1257 fun free_dummy_patterns (Const ("dummy_pattern", T)) used =
  1258       let val [x] = Name.invents used "uu" 1
  1258       let val [x] = Name.invents used Name.uu 1
  1259       in (Free (Name.internal x, T), Name.declare x used) end
  1259       in (Free (Name.internal x, T), Name.declare x used) end
  1260   | free_dummy_patterns (Abs (x, T, b)) used =
  1260   | free_dummy_patterns (Abs (x, T, b)) used =
  1261       let val (b', used') = free_dummy_patterns b used
  1261       let val (b', used') = free_dummy_patterns b used
  1262       in (Abs (x, T, b'), used') end
  1262       in (Abs (x, T, b'), used') end
  1263   | free_dummy_patterns (t $ u) used =
  1263   | free_dummy_patterns (t $ u) used =