src/Tools/eqsubst.ML
changeset 52242 2d634bfa1bbf
parent 52240 066c2ff17f7c
child 52246 54c0d4128b30
equal deleted inserted replaced
52241:5f6e885382e9 52242:2d634bfa1bbf
   108 (* T is outer bound vars, n is number of locally bound vars *)
   108 (* T is outer bound vars, n is number of locally bound vars *)
   109 (* THINK: is order of Ts correct...? or reversed? *)
   109 (* THINK: is order of Ts correct...? or reversed? *)
   110 fun mk_fake_bound_name n = ":b_" ^ n;
   110 fun mk_fake_bound_name n = ":b_" ^ n;
   111 fun fakefree_badbounds Ts t =
   111 fun fakefree_badbounds Ts t =
   112   let val (FakeTs, Ts, newnames) =
   112   let val (FakeTs, Ts, newnames) =
   113     List.foldr (fn ((n, ty), (FakeTs, Ts, usednames)) =>
   113     fold_rev (fn (n, ty) => fn (FakeTs, Ts, usednames) =>
   114       let
   114       let
   115         val newname = singleton (Name.variant_list usednames) n
   115         val newname = singleton (Name.variant_list usednames) n
   116       in
   116       in
   117         ((mk_fake_bound_name newname, ty) :: FakeTs,
   117         ((mk_fake_bound_name newname, ty) :: FakeTs,
   118           (newname, ty) :: Ts,
   118           (newname, ty) :: Ts,
   119           newname :: usednames)
   119           newname :: usednames)
   120       end) ([], [], []) Ts
   120       end) Ts ([], [], [])
   121   in (FakeTs, Ts, Term.subst_bounds (map Free FakeTs, t)) end;
   121   in (FakeTs, Ts, Term.subst_bounds (map Free FakeTs, t)) end;
   122 
   122 
   123 (* before matching we need to fake the bound vars that are missing an
   123 (* before matching we need to fake the bound vars that are missing an
   124    abstraction. In this function we additionally construct the
   124    abstraction. In this function we additionally construct the
   125    abstraction environment, and an outer context term (with the focus
   125    abstraction environment, and an outer context term (with the focus