doc-src/IsarAdvanced/Codegen/Thy/examples/lexicographic.ML
author haftmann
Tue, 05 Jun 2007 15:16:08 +0200
changeset 23247 b99dce43d252
parent 23107 0c3c55b7c98f
child 23250 9886802cbbd6
permissions -rw-r--r--
merged Code_Generator.thy into HOL.thy
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
22386
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
     7
type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
     8
fun less_eq (A_:'a ord) = #less_eq A_;
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
     9
fun less (A_:'a ord) = #less A_;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    10
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    11
end; (*struct Orderings*)
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    12
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    13
structure Code_Generator = 
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    14
struct
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    15
23107
0c3c55b7c98f *** empty log message ***
haftmann
parents: 22479
diff changeset
    16
type 'a eq = {eq : 'a -> 'a -> bool};
0c3c55b7c98f *** empty log message ***
haftmann
parents: 22479
diff changeset
    17
fun eq (A_:'a eq) = #eq A_;
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    18
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    19
end; (*struct Code_Generator*)
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    20
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    21
structure Codegen = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    22
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    23
23107
0c3c55b7c98f *** empty log message ***
haftmann
parents: 22479
diff changeset
    24
fun less_eq_product (A1_, A2_) B_ (x1, y1) (x2, y2) =
22188
a63889770d57 adjusted manual to improved treatment of overloaded constants
haftmann
parents: 22015
diff changeset
    25
  Orderings.less A2_ x1 x2 orelse
23107
0c3c55b7c98f *** empty log message ***
haftmann
parents: 22479
diff changeset
    26
    Code_Generator.eq A1_ x1 x2 andalso Orderings.less_eq B_ y1 y2;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    27
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    28
end; (*struct Codegen*)
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    29
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    30
end; (*struct ROOT*)