Commit fdd42d91 authored by Andrei Paskevich's avatar Andrei Paskevich

add Theory2 to take place of Theory later

parent 8a8a6987
......@@ -117,7 +117,8 @@ doc/version.tex src/version.ml: Version version.sh config.status
# why
#####
CORE_CMO := ident.cmo ty.cmo term.cmo decl.cmo theory.cmo pretty.cmo
CORE_CMO := ident.cmo ty.cmo term.cmo decl.cmo theory.cmo\
theory2.cmo pretty.cmo
CORE_CMO := $(addprefix src/core/,$(CORE_CMO))
UTIL_CMO := pp.cmo loc.cmo util.cmo hashcons.cmo sysutil.cmo\
......
This diff is collapsed.
(**************************************************************************)
(* *)
(* Copyright (C) 2010- *)
(* Francois Bobot *)
(* Jean-Christophe Filliatre *)
(* Johannes Kanig *)
(* Andrei Paskevich *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Library General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *)
(* *)
(**************************************************************************)
open Ident
open Ty
open Term
open Decl
(** Namespace *)
module Snm : Set.S with type elt = string
module Mnm : Map.S with type key = string
type namespace = private {
ns_ts : tysymbol Mnm.t; (* type symbols *)
ns_ls : lsymbol Mnm.t; (* logic symbols *)
ns_pr : prop_fmla Mnm.t; (* propositions *)
ns_ns : namespace Mnm.t; (* inner namespaces *)
}
val ns_find_ts : namespace -> string list -> tysymbol
val ns_find_ls : namespace -> string list -> lsymbol
val ns_find_pr : namespace -> string list -> prop_fmla
val ns_find_prop : namespace -> string list -> prop
val ns_find_fmla : namespace -> string list -> fmla
(** Theory *)
type theory = private {
th_name : ident; (* theory name *)
th_decls : tdecl list; (* theory declarations *)
th_export : namespace; (* exported namespace *)
th_local : Sid.t; (* locally declared idents *)
}
and tdecl = private
| Decl of decl
| Use of theory
| Clone of theory * (ident * ident) list
val builtin_theory : theory
(** Constructors and utilities *)
type theory_uc (* a theory under construction *)
val create_theory : preid -> theory_uc
val close_theory : theory_uc -> theory
val add_decl : theory_uc -> decl -> theory_uc
val open_namespace : theory_uc -> theory_uc
val close_namespace : theory_uc -> bool -> string option -> theory_uc
val get_namespace : theory_uc -> namespace
(** Use and clone *)
type th_inst = {
inst_ts : tysymbol Mts.t;
inst_ls : lsymbol Mls.t;
inst_lemma : Spr.t;
inst_goal : Spr.t;
}
val empty_inst : th_inst
val use_export : theory_uc -> theory -> theory_uc
val clone_export : theory_uc -> theory -> th_inst -> theory_uc
(* exceptions *)
exception NonLocal of ident
exception CannotInstantiate of ident
exception BadInstance of ident * ident
exception CloseTheory
exception NoOpenedNamespace
exception ClashSymbol of string
......@@ -25,12 +25,15 @@ let map_fold_left f acc l =
in
acc, List.rev rev
let of_option = function Some v -> v | None -> assert false
let of_option = function None -> assert false | Some x -> x
let option_map f = function None -> None | Some x -> Some (f x)
let option_apply d f = function None -> d | Some x -> f x
let option_iter f = function None -> () | Some x -> f x
exception FoldSkip
let all_fn pr _ t = pr t || raise FoldSkip
......
......@@ -26,6 +26,8 @@ val option_map : ('a -> 'b) -> 'a option -> 'b option
val option_iter : ('a -> unit) -> 'a option -> unit
val option_apply : 'b -> ('a -> 'b) -> 'a option -> 'b
exception FoldSkip
val all_fn : ('a -> bool) -> 'b -> 'a -> bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment