annotate src/expl_util.sig @ 188:8e9f97508f0d

Datatype representation optimization
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:49:21 -0400
parents d609820c5834
children ab86aa858e6c
rev   line source
adamc@38 1 (* Copyright (c) 2008, Adam Chlipala
adamc@38 2 * All rights reserved.
adamc@38 3 *
adamc@38 4 * Redistribution and use in source and binary forms, with or without
adamc@38 5 * modification, are permitted provided that the following conditions are met:
adamc@38 6 *
adamc@38 7 * - Redistributions of source code must retain the above copyright notice,
adamc@38 8 * this list of conditions and the following disclaimer.
adamc@38 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@38 10 * this list of conditions and the following disclaimer in the documentation
adamc@38 11 * and/or other materials provided with the distribution.
adamc@38 12 * - The names of contributors may not be used to endorse or promote products
adamc@38 13 * derived from this software without specific prior written permission.
adamc@38 14 *
adamc@38 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@38 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@38 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@38 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@38 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@38 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@38 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@38 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@38 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@38 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@38 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@38 26 *)
adamc@38 27
adamc@38 28 signature EXPL_UTIL = sig
adamc@38 29
adamc@188 30 val classifyDatatype : (string * int * Expl.con option) list -> Expl.datatype_kind
adamc@188 31
adamc@38 32 structure Kind : sig
adamc@38 33 val mapfold : (Expl.kind', 'state, 'abort) Search.mapfolder
adamc@38 34 -> (Expl.kind, 'state, 'abort) Search.mapfolder
adamc@38 35 val exists : (Expl.kind' -> bool) -> Expl.kind -> bool
adamc@38 36 end
adamc@38 37
adamc@38 38 structure Con : sig
adamc@38 39 datatype binder =
adamc@38 40 Rel of string * Expl.kind
adamc@38 41 | Named of string * Expl.kind
adamc@38 42
adamc@38 43 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 44 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 45 bind : 'context * binder -> 'context}
adamc@38 46 -> ('context, Expl.con, 'state, 'abort) Search.mapfolderB
adamc@38 47 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 48 con : (Expl.con', 'state, 'abort) Search.mapfolder}
adamc@38 49 -> (Expl.con, 'state, 'abort) Search.mapfolder
adamc@38 50
adamc@38 51 val mapB : {kind : Expl.kind' -> Expl.kind',
adamc@38 52 con : 'context -> Expl.con' -> Expl.con',
adamc@38 53 bind : 'context * binder -> 'context}
adamc@38 54 -> 'context -> (Expl.con -> Expl.con)
adamc@38 55 val map : {kind : Expl.kind' -> Expl.kind',
adamc@38 56 con : Expl.con' -> Expl.con'}
adamc@38 57 -> Expl.con -> Expl.con
adamc@38 58 val exists : {kind : Expl.kind' -> bool,
adamc@38 59 con : Expl.con' -> bool} -> Expl.con -> bool
adamc@38 60 end
adamc@38 61
adamc@38 62 structure Exp : sig
adamc@38 63 datatype binder =
adamc@38 64 RelC of string * Expl.kind
adamc@38 65 | NamedC of string * Expl.kind
adamc@38 66 | RelE of string * Expl.con
adamc@38 67 | NamedE of string * Expl.con
adamc@38 68
adamc@38 69 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 70 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 71 exp : ('context, Expl.exp', 'state, 'abort) Search.mapfolderB,
adamc@38 72 bind : 'context * binder -> 'context}
adamc@38 73 -> ('context, Expl.exp, 'state, 'abort) Search.mapfolderB
adamc@38 74 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 75 con : (Expl.con', 'state, 'abort) Search.mapfolder,
adamc@38 76 exp : (Expl.exp', 'state, 'abort) Search.mapfolder}
adamc@38 77 -> (Expl.exp, 'state, 'abort) Search.mapfolder
adamc@38 78 val exists : {kind : Expl.kind' -> bool,
adamc@38 79 con : Expl.con' -> bool,
adamc@38 80 exp : Expl.exp' -> bool} -> Expl.exp -> bool
adamc@38 81 end
adamc@38 82
adamc@38 83 structure Sgn : sig
adamc@38 84 datatype binder =
adamc@38 85 RelC of string * Expl.kind
adamc@38 86 | NamedC of string * Expl.kind
adamc@64 87 | Sgn of string * Expl.sgn
adamc@38 88 | Str of string * Expl.sgn
adamc@38 89
adamc@38 90 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 91 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 92 sgn_item : ('context, Expl.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@38 93 sgn : ('context, Expl.sgn', 'state, 'abort) Search.mapfolderB,
adamc@38 94 bind : 'context * binder -> 'context}
adamc@38 95 -> ('context, Expl.sgn, 'state, 'abort) Search.mapfolderB
adamc@38 96
adamc@38 97
adamc@38 98 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 99 con : (Expl.con', 'state, 'abort) Search.mapfolder,
adamc@38 100 sgn_item : (Expl.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@38 101 sgn : (Expl.sgn', 'state, 'abort) Search.mapfolder}
adamc@38 102 -> (Expl.sgn, 'state, 'abort) Search.mapfolder
adamc@38 103
adamc@38 104 val map : {kind : Expl.kind' -> Expl.kind',
adamc@38 105 con : Expl.con' -> Expl.con',
adamc@38 106 sgn_item : Expl.sgn_item' -> Expl.sgn_item',
adamc@38 107 sgn : Expl.sgn' -> Expl.sgn'}
adamc@38 108 -> Expl.sgn -> Expl.sgn
adamc@38 109
adamc@38 110 end
adamc@38 111
adamc@38 112 end