Commit a8f76c2f authored by Andrei Paskevich's avatar Andrei Paskevich

Start the separation of contexts and tasks.

The proposed architecture is as follows:

- Decl provides the type of declaration, decl, which is a sum
  of type_decl, logic_decl, ind_decl, and prop_decl. decl is 
  h-consed and does not depent on theory, context or anything else.

- Theory provides the types of theories and theories under construction.
  A theory is a list of (decl | use | clone) with namespace, and the set
  of known idents. Theories are not h-consed and they do not depend on
  env or task.

- Task provides the types of environment (env), clone maps (clone), and
  the task itself. It might be interesting to merge Transform with Task.
  An environment stays as it is today. A clone map is a private record 
  with the unique tag and physical equality. A task is essentially what
  context is today:
    
    task_decl  : decl               (* top declaration *)
    task_prev  : task option        (* the previous context *)
    task_known : (ident, decl) map  (* the set of known symbols *)
    task_clone : clone              (* the clone map *)
    task_env   : env                (* the environment *)
    task_tag   : int                (* the unique tag *)

  Tasks are h-consed. There is a guarantee that task_env and task_clone
  of task and task.task_prev are physically equal.

  Unless there is a good reason to do otherwise, the only way to produce
  a task is by split_goal, which takes a theory (and optionally a number
  of goals in it) and creates a list of tasks. Note that sharing IS LOST
  whenever two goals are separated by a clone instruction. However, the
  declarations will still be shared.

- Trasformation works on tasks, producing task lists, tasks, and alphas.

- use_export and clone_export may be allowed on tasks, rebuilding the
  whole task, whenever necessary.

This commit just adds the Decl module, but does not make anything use it.
parent 930fb870
......@@ -117,7 +117,7 @@ doc/version.tex src/version.ml: Version version.sh config.status
# why
#####
CORE_CMO := ident.cmo ty.cmo term.cmo theory.cmo pretty.cmo
CORE_CMO := ident.cmo ty.cmo term.cmo decl.cmo theory.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
(** Type declaration *)
type ty_def =
| Tabstract
| Talgebraic of lsymbol list
type ty_decl = tysymbol * ty_def
(** Logic declaration *)
type ls_defn
type logic_decl = lsymbol * ls_defn option
val make_ls_defn : lsymbol -> vsymbol list -> expr -> logic_decl
val make_fs_defn : lsymbol -> vsymbol list -> term -> logic_decl
val make_ps_defn : lsymbol -> vsymbol list -> fmla -> logic_decl
val open_ls_defn : ls_defn -> vsymbol list * expr
val open_fs_defn : ls_defn -> vsymbol list * term
val open_ps_defn : ls_defn -> vsymbol list * fmla
val ls_defn_axiom : ls_defn -> fmla
(** Inductive predicate declaration *)
type prop
module Spr : Set.S with type elt = prop
module Mpr : Map.S with type key = prop
module Hpr : Hashtbl.S with type key = prop
val create_prop : preid -> prop
val pr_name : prop -> ident
type prop_fmla = prop * fmla
type ind_decl = lsymbol * prop_fmla list
(* Proposition declaration *)
type prop_kind =
| Paxiom
| Plemma
| Pgoal
type prop_decl = prop_kind * prop * fmla
(** Declaration type *)
type decl = private {
d_node : decl_node;
d_tag : int;
}
and decl_node =
| Dtype of ty_decl list (* recursive types *)
| Dlogic of logic_decl list (* recursive functions/predicates *)
| Dind of ind_decl list (* inductive predicates *)
| Dprop of prop_decl (* axiom / lemma / goal *)
(** Declaration constructors *)
val create_ty_decl : ty_decl list -> decl
val create_logic_decl : logic_decl list -> decl
val create_ind_decl : ind_decl list -> decl
val create_prop_decl : prop_kind -> prop -> fmla -> decl
(* separate independent groups of declarations *)
val create_ty_decls : ty_decl list -> decl list
val create_logic_decls : logic_decl list -> decl list
val create_ind_decls : ind_decl list -> decl list
(* exceptions *)
exception ConstructorExpected of lsymbol
exception IllegalTypeAlias of tysymbol
exception UnboundTypeVar of tvsymbol
exception InvalidIndDecl of lsymbol * prop
exception TooSpecificIndDecl of lsymbol * prop * term
exception NonPositiveIndDecl of lsymbol * prop * lsymbol
exception IllegalConstructor of lsymbol
exception BadLogicDecl of ident
exception UnboundVars of Svs.t
exception ClashIdent of ident
exception EmptyDecl
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