doc-src/IsarAdvanced/Codegen/Thy/examples/lexicographic.ML
author berghofe
Wed, 07 Feb 2007 17:30:53 +0100
changeset 22264 6a65e9b2ae05
parent 22188 a63889770d57
child 22386 4ebe883b02ff
permissions -rw-r--r--
Theorems for converting between wf and wfP are now declared as hints.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     1
structure ROOT = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     2
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     3
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     4
structure Orderings = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     5
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     6
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
     7
type 'a ord =
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
     8
  {Orderings__less_eq : 'a -> 'a -> bool,
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
     9
    Orderings__less : 'a -> 'a -> bool};
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    10
fun less_eq (A_:'a ord) = #Orderings__less_eq A_;
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    11
fun less (A_:'a ord) = #Orderings__less A_;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    12
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    13
end; (*struct Orderings*)
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    14
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    15
structure Code_Generator = 
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    16
struct
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    17
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    18
type 'a eq = {Code_Generator__op_eq : 'a -> 'a -> bool};
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    19
fun op_eq (A_:'a eq) = #Code_Generator__op_eq A_;
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    20
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    21
end; (*struct Code_Generator*)
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    22
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    23
structure Codegen = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    24
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    25
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    26
fun less_eq_prod (A1_, A2_) B_ (x1, y1) (x2, y2) =
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    27
  Orderings.less A2_ x1 x2 orelse
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    28
    Code_Generator.op_eq A1_ x1 x2 andalso Orderings.less_eq B_ y1 y2;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    29
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    30
end; (*struct Codegen*)
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    31
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    32
end; (*struct ROOT*)