doc-src/IsarAdvanced/Codegen/Thy/examples/lexicographic.ML
author wenzelm
Thu, 19 Jul 2007 23:18:46 +0200
changeset 23862 b1861768d8f4
parent 23850 f1434532a562
child 24193 926dde4d96de
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23250
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     1
structure HOL = 
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     2
struct
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     3
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     4
type 'a eq = {eq : 'a -> 'a -> bool};
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     5
fun eq (A_:'a eq) = #eq A_;
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     6
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     7
end; (*struct HOL*)
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
     8
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
     9
structure Orderings = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    10
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    11
22386
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
    12
type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
    13
fun less_eq (A_:'a ord) = #less_eq A_;
4ebe883b02ff new code theorems
haftmann
parents: 22188
diff changeset
    14
fun less (A_:'a ord) = #less A_;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    15
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    16
end; (*struct Orderings*)
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    17
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    18
structure Codegen = 
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    19
struct
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    20
23107
0c3c55b7c98f *** empty log message ***
haftmann
parents: 22479
diff changeset
    21
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
    22
  Orderings.less A2_ x1 x2 orelse
23250
9886802cbbd6 updated documentation
haftmann
parents: 23107
diff changeset
    23
    HOL.eq A1_ x1 x2 andalso Orderings.less_eq B_ y1 y2;
21147
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    24
737a94f047e3 continued tutorial
haftmann
parents:
diff changeset
    25
end; (*struct Codegen*)