src/HOL/Library/conditional_parametricity.ML
changeset 81541 5335b1ca6233
parent 80636 4041e7c8059d
equal deleted inserted replaced
81540:58073f3d748a 81541:5335b1ca6233
   244     val ctxt = fold (Variable.declare_typ o snd) (Term.add_frees t []) ctxt;
   244     val ctxt = fold (Variable.declare_typ o snd) (Term.add_frees t []) ctxt;
   245     val t = singleton (Variable.polymorphic ctxt) t;
   245     val t = singleton (Variable.polymorphic ctxt) t;
   246     val i = maxidx_of_term t + 1;
   246     val i = maxidx_of_term t + 1;
   247     fun tvar_to_tfree ((name, _), sort) = (name, sort);
   247     fun tvar_to_tfree ((name, _), sort) = (name, sort);
   248     val tvars = Term.add_tvars t [];
   248     val tvars = Term.add_tvars t [];
   249     val new_frees = map TFree (Term.variant_frees t (map tvar_to_tfree tvars));
   249     val new_frees = map TFree (Term.variant_bounds t (map tvar_to_tfree tvars));
   250     val u = subst_atomic_types ((map TVar tvars) ~~ new_frees) t;
   250     val u = subst_atomic_types ((map TVar tvars) ~~ new_frees) t;
   251     val T = fastype_of t;
   251     val T = fastype_of t;
   252     val U = fastype_of u;
   252     val U = fastype_of u;
   253     val R = [T,U] ---> \<^typ>\<open>bool\<close>
   253     val R = [T,U] ---> \<^typ>\<open>bool\<close>
   254     val r = Var (("R", 2 * i), R);
   254     val r = Var (("R", 2 * i), R);