annotate src/expl_util.sig @ 198:ab86aa858e6c

'Option' datatype encoding
author Adam Chlipala <adamc@hcoop.net>
date Sat, 09 Aug 2008 19:23:31 -0400
parents 8e9f97508f0d
children 354800878b4d
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@38 30 structure Kind : sig
adamc@38 31 val mapfold : (Expl.kind', 'state, 'abort) Search.mapfolder
adamc@38 32 -> (Expl.kind, 'state, 'abort) Search.mapfolder
adamc@38 33 val exists : (Expl.kind' -> bool) -> Expl.kind -> bool
adamc@38 34 end
adamc@38 35
adamc@38 36 structure Con : sig
adamc@38 37 datatype binder =
adamc@38 38 Rel of string * Expl.kind
adamc@38 39 | Named of string * Expl.kind
adamc@38 40
adamc@38 41 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 42 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 43 bind : 'context * binder -> 'context}
adamc@38 44 -> ('context, Expl.con, 'state, 'abort) Search.mapfolderB
adamc@38 45 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 46 con : (Expl.con', 'state, 'abort) Search.mapfolder}
adamc@38 47 -> (Expl.con, 'state, 'abort) Search.mapfolder
adamc@38 48
adamc@38 49 val mapB : {kind : Expl.kind' -> Expl.kind',
adamc@38 50 con : 'context -> Expl.con' -> Expl.con',
adamc@38 51 bind : 'context * binder -> 'context}
adamc@38 52 -> 'context -> (Expl.con -> Expl.con)
adamc@38 53 val map : {kind : Expl.kind' -> Expl.kind',
adamc@38 54 con : Expl.con' -> Expl.con'}
adamc@38 55 -> Expl.con -> Expl.con
adamc@38 56 val exists : {kind : Expl.kind' -> bool,
adamc@38 57 con : Expl.con' -> bool} -> Expl.con -> bool
adamc@38 58 end
adamc@38 59
adamc@38 60 structure Exp : sig
adamc@38 61 datatype binder =
adamc@38 62 RelC of string * Expl.kind
adamc@38 63 | NamedC of string * Expl.kind
adamc@38 64 | RelE of string * Expl.con
adamc@38 65 | NamedE of string * Expl.con
adamc@38 66
adamc@38 67 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 68 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 69 exp : ('context, Expl.exp', 'state, 'abort) Search.mapfolderB,
adamc@38 70 bind : 'context * binder -> 'context}
adamc@38 71 -> ('context, Expl.exp, 'state, 'abort) Search.mapfolderB
adamc@38 72 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 73 con : (Expl.con', 'state, 'abort) Search.mapfolder,
adamc@38 74 exp : (Expl.exp', 'state, 'abort) Search.mapfolder}
adamc@38 75 -> (Expl.exp, 'state, 'abort) Search.mapfolder
adamc@38 76 val exists : {kind : Expl.kind' -> bool,
adamc@38 77 con : Expl.con' -> bool,
adamc@38 78 exp : Expl.exp' -> bool} -> Expl.exp -> bool
adamc@38 79 end
adamc@38 80
adamc@38 81 structure Sgn : sig
adamc@38 82 datatype binder =
adamc@38 83 RelC of string * Expl.kind
adamc@38 84 | NamedC of string * Expl.kind
adamc@64 85 | Sgn of string * Expl.sgn
adamc@38 86 | Str of string * Expl.sgn
adamc@38 87
adamc@38 88 val mapfoldB : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 89 con : ('context, Expl.con', 'state, 'abort) Search.mapfolderB,
adamc@38 90 sgn_item : ('context, Expl.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@38 91 sgn : ('context, Expl.sgn', 'state, 'abort) Search.mapfolderB,
adamc@38 92 bind : 'context * binder -> 'context}
adamc@38 93 -> ('context, Expl.sgn, 'state, 'abort) Search.mapfolderB
adamc@38 94
adamc@38 95
adamc@38 96 val mapfold : {kind : (Expl.kind', 'state, 'abort) Search.mapfolder,
adamc@38 97 con : (Expl.con', 'state, 'abort) Search.mapfolder,
adamc@38 98 sgn_item : (Expl.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@38 99 sgn : (Expl.sgn', 'state, 'abort) Search.mapfolder}
adamc@38 100 -> (Expl.sgn, 'state, 'abort) Search.mapfolder
adamc@38 101
adamc@38 102 val map : {kind : Expl.kind' -> Expl.kind',
adamc@38 103 con : Expl.con' -> Expl.con',
adamc@38 104 sgn_item : Expl.sgn_item' -> Expl.sgn_item',
adamc@38 105 sgn : Expl.sgn' -> Expl.sgn'}
adamc@38 106 -> Expl.sgn -> Expl.sgn
adamc@38 107
adamc@38 108 end
adamc@38 109
adamc@38 110 end