src/Pure/compress.ML
changeset 17412 e26cb20ef0cc
parent 17221 6cd180204582
child 20548 8ef25fe585a8
equal deleted inserted replaced
17411:664434175578 17412:e26cb20ef0cc
    40 
    40 
    41 fun typ thy =
    41 fun typ thy =
    42   let
    42   let
    43     val typs = #1 (CompressData.get thy);
    43     val typs = #1 (CompressData.get thy);
    44     fun compress T =
    44     fun compress T =
    45       (case Typtab.curried_lookup (! typs) T of
    45       (case Typtab.lookup (! typs) T of
    46         SOME T' => T'
    46         SOME T' => T'
    47       | NONE =>
    47       | NONE =>
    48           let val T' = (case T of Type (a, Ts) => Type (a, map compress Ts) | _ => T)
    48           let val T' = (case T of Type (a, Ts) => Type (a, map compress Ts) | _ => T)
    49           in change typs (Typtab.curried_update (T', T')); T' end);
    49           in change typs (Typtab.update (T', T')); T' end);
    50   in compress end;
    50   in compress end;
    51 
    51 
    52 
    52 
    53 (* compress atomic terms *)
    53 (* compress atomic terms *)
    54 
    54 
    56   let
    56   let
    57     val terms = #2 (CompressData.get thy);
    57     val terms = #2 (CompressData.get thy);
    58     fun compress (t $ u) = compress t $ compress u
    58     fun compress (t $ u) = compress t $ compress u
    59       | compress (Abs (a, T, t)) = Abs (a, T, compress t)
    59       | compress (Abs (a, T, t)) = Abs (a, T, compress t)
    60       | compress t =
    60       | compress t =
    61           (case Termtab.curried_lookup (! terms) t of
    61           (case Termtab.lookup (! terms) t of
    62             SOME t' => t'
    62             SOME t' => t'
    63           | NONE => (change terms (Termtab.curried_update (t, t)); t));
    63           | NONE => (change terms (Termtab.update (t, t)); t));
    64   in compress o map_term_types (typ thy) end;
    64   in compress o map_term_types (typ thy) end;
    65 
    65 
    66 end;
    66 end;