319 |> add_locale name ([],vars) [assumes] |
319 |> add_locale name ([],vars) [assumes] |
320 |> ProofContext.theory_of |
320 |> ProofContext.theory_of |
321 |> interprete_parent name dist_thm_full_name parent_expr |
321 |> interprete_parent name dist_thm_full_name parent_expr |
322 end; |
322 end; |
323 |
323 |
324 fun encode_dot x = if x= #"." then #"_" else x; |
324 fun encode_dot x = |
|
325 if x= #"." then #"_" else x; |
325 |
326 |
326 fun encode_type (TFree (s, _)) = s |
327 fun encode_type (TFree (s, _)) = s |
327 | encode_type (TVar ((s,i),_)) = "?" ^ s ^ string_of_int i |
328 | encode_type (TVar ((s,i),_)) = "?" ^ s ^ string_of_int i |
328 | encode_type (Type (n,Ts)) = |
329 | encode_type (Type (n,Ts)) = |
329 let |
330 let |
330 val Ts' = fold1' (fn x => fn y => x ^ "_" ^ y) (map encode_type Ts) ""; |
331 val Ts' = fold1' (fn x => fn y => x ^ "_" ^ y) (map encode_type Ts) ""; |
331 val n' = String.map encode_dot n; |
332 val n' = if n = "*" then "Prod" else |
|
333 if n = "+" then "Sum" else |
|
334 String.map encode_dot n; |
332 in if Ts'="" then n' else Ts' ^ "_" ^ n' end; |
335 in if Ts'="" then n' else Ts' ^ "_" ^ n' end; |
333 |
336 |
334 fun project_name T = projectN ^"_"^encode_type T; |
337 fun project_name T = projectN ^"_"^encode_type T; |
335 fun inject_name T = injectN ^"_"^encode_type T; |
338 fun inject_name T = injectN ^"_"^encode_type T; |
336 |
339 |