equal
deleted
inserted
replaced
17 'a list -> 'b list -> 'c list -> 'd -> 'e list * 'd |
17 'a list -> 'b list -> 'c list -> 'd -> 'e list * 'd |
18 val seq_conds: (bool -> 'a -> 'b) -> int -> int -> 'a list -> 'b list |
18 val seq_conds: (bool -> 'a -> 'b) -> int -> int -> 'a list -> 'b list |
19 val transpose: 'a list list -> 'a list list |
19 val transpose: 'a list list -> 'a list list |
20 val pad_list: 'a -> int -> 'a list -> 'a list |
20 val pad_list: 'a -> int -> 'a list -> 'a list |
21 val splice: 'a list -> 'a list -> 'a list |
21 val splice: 'a list -> 'a list -> 'a list |
22 val permute_like: ('a * 'b -> bool) -> 'a list -> 'b list -> 'c list -> 'c list |
22 val permute_like_unique: ('a * 'b -> bool) -> 'a list -> 'b list -> 'c list -> 'c list |
|
23 val permute_like: ('a * 'a -> bool) -> 'a list -> 'a list -> 'b list -> 'b list |
23 |
24 |
24 val mk_names: int -> string -> string list |
25 val mk_names: int -> string -> string list |
25 val mk_fresh_names: Proof.context -> int -> string -> string list * Proof.context |
26 val mk_fresh_names: Proof.context -> int -> string -> string list * Proof.context |
26 val mk_TFrees': sort list -> Proof.context -> typ list * Proof.context |
27 val mk_TFrees': sort list -> Proof.context -> typ list * Proof.context |
27 val mk_TFrees: int -> Proof.context -> typ list * Proof.context |
28 val mk_TFrees: int -> Proof.context -> typ list * Proof.context |
127 |
128 |
128 fun pad_list x n xs = xs @ replicate (n - length xs) x; |
129 fun pad_list x n xs = xs @ replicate (n - length xs) x; |
129 |
130 |
130 fun splice xs ys = flat (map2 (fn x => fn y => [x, y]) xs ys); |
131 fun splice xs ys = flat (map2 (fn x => fn y => [x, y]) xs ys); |
131 |
132 |
132 fun permute_like eq xs xs' ys = map (nth ys o (fn y => find_index (fn x => eq (x, y)) xs)) xs'; |
133 fun permute_like_unique eq xs xs' ys = |
|
134 map (nth ys o (fn y => find_index (fn x => eq (x, y)) xs)) xs'; |
|
135 |
|
136 fun fresh eq x names = |
|
137 (case AList.lookup eq names x of |
|
138 NONE => ((x, 0), (x, 0) :: names) |
|
139 | SOME n => ((x, n + 1), AList.update eq (x, n + 1) names)); |
|
140 |
|
141 fun deambiguate eq xs = fst (fold_map (fresh eq) xs []); |
|
142 |
|
143 fun permute_like eq xs xs' = |
|
144 permute_like_unique (eq_pair eq (op =)) (deambiguate eq xs) (deambiguate eq xs'); |
133 |
145 |
134 fun mk_names n x = if n = 1 then [x] else map (fn i => x ^ string_of_int i) (1 upto n); |
146 fun mk_names n x = if n = 1 then [x] else map (fn i => x ^ string_of_int i) (1 upto n); |
135 fun mk_fresh_names ctxt = (fn xs => Variable.variant_fixes xs ctxt) oo mk_names; |
147 fun mk_fresh_names ctxt = (fn xs => Variable.variant_fixes xs ctxt) oo mk_names; |
136 |
148 |
137 val mk_TFrees' = apfst (map TFree) oo Variable.invent_types; |
149 val mk_TFrees' = apfst (map TFree) oo Variable.invent_types; |