summary |
shortlog |
changelog |
graph |
tags |
branches |
files |
changeset |
file |
revisions |
annotate |
diff |
raw

src/Pure/morphism.ML

author | wenzelm |

Sat May 15 23:23:45 2010 +0200 (2010-05-15) | |

changeset 36951 | 985c197f2fe9 |

parent 29605 | f2924219125e |

child 37216 | 3165bc303f66 |

permissions | -rw-r--r-- |

renamed structure ValueParse to Parse_Value;

eliminated old-style structure alias V;

eliminated old-style structure alias V;

1 (* Title: Pure/morphism.ML

2 Author: Makarius

4 Abstract morphisms on formal entities.

5 *)

7 infix 1 $>

9 signature BASIC_MORPHISM =

10 sig

11 type morphism

12 type declaration = morphism -> Context.generic -> Context.generic

13 val $> : morphism * morphism -> morphism

14 end

16 signature MORPHISM =

17 sig

18 include BASIC_MORPHISM

19 val binding: morphism -> binding -> binding

20 val typ: morphism -> typ -> typ

21 val term: morphism -> term -> term

22 val fact: morphism -> thm list -> thm list

23 val thm: morphism -> thm -> thm

24 val cterm: morphism -> cterm -> cterm

25 val morphism:

26 {binding: binding -> binding,

27 typ: typ -> typ,

28 term: term -> term,

29 fact: thm list -> thm list} -> morphism

30 val binding_morphism: (binding -> binding) -> morphism

31 val typ_morphism: (typ -> typ) -> morphism

32 val term_morphism: (term -> term) -> morphism

33 val fact_morphism: (thm list -> thm list) -> morphism

34 val thm_morphism: (thm -> thm) -> morphism

35 val identity: morphism

36 val compose: morphism -> morphism -> morphism

37 val transform: morphism -> (morphism -> 'a) -> morphism -> 'a

38 val form: (morphism -> 'a) -> 'a

39 end;

41 structure Morphism: MORPHISM =

42 struct

44 datatype morphism = Morphism of

45 {binding: binding -> binding,

46 typ: typ -> typ,

47 term: term -> term,

48 fact: thm list -> thm list};

50 type declaration = morphism -> Context.generic -> Context.generic;

52 fun binding (Morphism {binding, ...}) = binding;

53 fun typ (Morphism {typ, ...}) = typ;

54 fun term (Morphism {term, ...}) = term;

55 fun fact (Morphism {fact, ...}) = fact;

56 val thm = singleton o fact;

57 val cterm = Drule.cterm_rule o thm;

59 val morphism = Morphism;

61 fun binding_morphism binding = morphism {binding = binding, typ = I, term = I, fact = I};

62 fun typ_morphism typ = morphism {binding = I, typ = typ, term = I, fact = I};

63 fun term_morphism term = morphism {binding = I, typ = I, term = term, fact = I};

64 fun fact_morphism fact = morphism {binding = I, typ = I, term = I, fact = fact};

65 fun thm_morphism thm = morphism {binding = I, typ = I, term = I, fact = map thm};

67 val identity = morphism {binding = I, typ = I, term = I, fact = I};

69 fun compose

70 (Morphism {binding = binding1, typ = typ1, term = term1, fact = fact1})

71 (Morphism {binding = binding2, typ = typ2, term = term2, fact = fact2}) =

72 morphism {binding = binding1 o binding2, typ = typ1 o typ2,

73 term = term1 o term2, fact = fact1 o fact2};

75 fun phi1 $> phi2 = compose phi2 phi1;

77 fun transform phi f = fn psi => f (phi $> psi);

78 fun form f = f identity;

80 end;

82 structure BasicMorphism: BASIC_MORPHISM = Morphism;

83 open BasicMorphism;