status,[]
| GrafiteAst.Print (_,"proofterm") ->
let _,_,_,p,_, _ = GrafiteTypes.get_current_proof status in
- prerr_endline (Auto.pp_proofterm p);
+ prerr_endline (Auto.pp_proofterm (Lazy.force p));
status,[]
| GrafiteAst.Print (_,_) -> status,[]
| GrafiteAst.Qed loc ->
(GrafiteTypes.Command_error
"Proof not completed! metasenv is not empty!");
let name = UriManager.name_of_uri uri in
- let obj = Cic.Constant (name,Some bo,ty,[],attrs) in
+ let obj = Cic.Constant (name,Some (Lazy.force bo),ty,[],attrs) in
let status, lemmas = add_obj uri obj status in
{status with
GrafiteTypes.proof_status = GrafiteTypes.No_proof},
"\nPlease use a variant."));
end;
let _subst = [] in
- let initial_proof = (Some uri, metasenv', _subst, bo, ty, attrs) in
+ let initial_proof = (Some uri, metasenv', _subst, lazy bo, ty, attrs) in
let initial_stack = Continuationals.Stack.of_metasenv metasenv' in
{ status with GrafiteTypes.proof_status =
GrafiteTypes.Incomplete_proof
type subst = Cic.substitution
type goal = ProofEngineTypes.goal * int * AutoTypes.sort
let candidate_no = ref 0;;
-type candidate = int * Cic.term
+type candidate = int * Cic.term Lazy.t
type cache = AutoCache.cache
type tables =
Saturation.active_table * Saturation.passive_table * Equality.equality_bag
(* the status exported to the external observer *)
type auto_status =
(* context, (goal,candidate) list, and_list, history *)
- Cic.context * (int * Cic.term * bool * int * (int * Cic.term) list) list *
- (int * Cic.term * int) list * Cic.term list
+ Cic.context * (int * Cic.term * bool * int * (int * Cic.term Lazy.t) list) list *
+ (int * Cic.term * int) list * Cic.term Lazy.t list
let d_prefix l =
let rec aux acc = function
| None -> Printf.sprintf "D(%d, _, %d)" gi d
in
let string_of_s m su k (ci,ct) gi =
- Printf.sprintf "S(%d, %s, %s, %d)" gi (pp k) (pp ct) ci
+ Printf.sprintf "S(%d, %s, %s, %d)" gi (pp k) (pp (Lazy.force ct)) ci
in
let string_of_ol m su l =
String.concat " | "
subst, metasenv
;;
let mk_fake_proof metasenv subst (goalno,_,_) goalty context =
- None,metasenv,subst ,Cic.Meta(goalno,mk_irl context),goalty, []
+ None,metasenv,subst ,(lazy (Cic.Meta(goalno,mk_irl context))),goalty, []
;;
let equational_case
tables maxm cache depth fake_proof goalno goalty subst context
let open_goals = order_new_goals metasenv subst open_goals ppterm in
let open_goals = List.map (fun (x,sort) -> x,depth-1,sort) open_goals in
incr candidate_no;
- Some ((!candidate_no,cand),metasenv,subst,open_goals), tables , maxmeta
+ Some ((!candidate_no,lazy cand),metasenv,subst,open_goals), tables , maxmeta
with
| ProofEngineTypes.Fail s -> None,tables, maxm
| CicUnification.Uncertain s -> None,tables, maxm
type auto_status =
Cic.context *
(* or list: goalno, goaltype, grey, depth, candidates: (goalno, c) *)
- (int * Cic.term * bool * int * (int * Cic.term) list) list *
+ (int * Cic.term * bool * int * (int * Cic.term Lazy.t) list) list *
(* and list *)
(int * Cic.term * int) list *
(* last moves *)
- Cic.term list
+ Cic.term Lazy.t list
val get_auto_status : unit -> auto_status
val pause: bool -> unit
let t1 = CicMetaSubst.apply_subst subst t1 in
let t2 = CicMetaSubst.apply_subst subst t2 in
let ty = CicMetaSubst.apply_subst subst ty in
- let pbo = CicMetaSubst.apply_subst subst pbo in
+ let pbo = lazy (CicMetaSubst.apply_subst subst (Lazy.force pbo)) in
let pty = CicMetaSubst.apply_subst subst pty in
let equality = CicMetaSubst.apply_subst subst equality in
let abstr_gty =
let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in
let with_what, metasenv, u = with_what context metasenv u in
let with_what = CicMetaSubst.apply_subst subst with_what in
- let pbo = CicMetaSubst.apply_subst subst pbo in
+ let pbo = lazy (CicMetaSubst.apply_subst subst (Lazy.force pbo)) in
let pty = CicMetaSubst.apply_subst subst pty in
let status = (uri,metasenv,_subst,pbo,pty, attrs),goal in
let ty_of_with_what,u =
let attrs = [`Class (`InversionPrinciple); `Generated] in
let _subst = [] in
let proof=
- (Some inversor_uri,metasenv',_subst,Cic.Meta(goal,[]),ref_theorem, attrs) in
+ (Some inversor_uri,metasenv',_subst,
+ lazy (Cic.Meta(goal,[])),ref_theorem, attrs) in
let _,applies =
List.fold_right
(fun _ (i,applies) ->
Some
(inversor_uri,
Cic.Constant
- (UriManager.name_of_uri inversor_uri,Some bo,ty,[],[]))
+ (UriManager.name_of_uri inversor_uri,Some (Lazy.force bo),ty,[],[]))
with
Inversion.EqualityNotDefinedYet -> None
| CicRefine.RefineFailure ls ->
~conjecture ~pattern in
let context = CicMetaSubst.apply_subst_context subst context in
let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in
- let pbo = CicMetaSubst.apply_subst subst pbo in
+ let pbo = lazy (CicMetaSubst.apply_subst subst (Lazy.force pbo)) in
let pty = CicMetaSubst.apply_subst subst pty in
let term =
match term with
i,canonical_context',(subst_in ty)
) metasenv'
in
- let bo' = subst_in bo in
+ let bo' = lazy (subst_in (Lazy.force bo)) in
(* Metavariables can appear also in the *statement* of the theorem
* since the parser does not reject as statements terms with
* metavariable therein *)
let subst_meta_and_metasenv_in_proof proof meta subst newmetasenv =
let (uri,_,initial_subst,bo,ty, attrs) = proof in
let subst_in = CicMetaSubst.apply_subst subst in
- let bo' = subst_in bo in
+ let bo' = lazy (subst_in (Lazy.force bo)) in
(* Metavariables can appear also in the *statement* of the theorem
* since the parser does not reject as statements terms with
* metavariable therein *)
(**
current proof (proof uri * metas * (in)complete proof * term to be prooved)
*)
-type proof = UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term * Cic.term * Cic.attribute list
+type proof =
+ UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term Lazy.t * Cic.term * Cic.attribute list
(** current goal, integer index *)
type goal = int
type status = proof * goal
let newmeta_idx = aux 0 metasenv in
let _subst = [] in
let proof =
- None, (newmeta_idx, [], ty) :: metasenv, _subst, Cic.Meta (newmeta_idx, []), ty, attrs
+ None, (newmeta_idx, [], ty) :: metasenv, _subst,
+ lazy (Cic.Meta (newmeta_idx, [])), ty, attrs
in
(proof, newmeta_idx)
current proof (proof uri * metas * (in)complete proof * term to be prooved)
*)
type proof =
- UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term * Cic.term * Cic.attribute list
+ UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term Lazy.t * Cic.term * Cic.attribute list
(** current goal, integer index *)
type goal = int
type status = proof * goal
class ['a] status:
?history_size:int -> (** default 20 *)
?uri:UriManager.uri ->
- typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv ->
+ typ:Cic.term -> body:Cic.term Lazy.t -> metasenv:Cic.metasenv ->
attrs:Cic.attribute list ->
(proof_status -> 'a) -> (* init data *)
(proof_status * 'a -> proof_status -> 'a) -> (* update data *)
method proof: ProofEngineTypes.proof
method metasenv: Cic.metasenv
- method body: Cic.term
+ method body: Cic.term Lazy.t
method typ: Cic.term
method attrs: Cic.attribute list
val trivial_status:
?uri:UriManager.uri ->
- typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv ->
+ typ:Cic.term -> body:Cic.term Lazy.t -> metasenv:Cic.metasenv ->
attrs:Cic.attribute list ->
unit ->
unit status
(MatitaScript.current ())#grafite_status.GrafiteTypes.proof_status
with
| GrafiteTypes.No_proof -> (Cic.Implicit None)
- | Incomplete_proof i -> let _,_,_subst,p,_, _ = i.GrafiteTypes.proof in p
- | Proof p -> let _,_,_subst,p,_, _ = p in p
+ | Incomplete_proof i ->
+ let _,_,_subst,p,_, _ = i.GrafiteTypes.proof in
+ Lazy.force p
+ | Proof p -> let _,_,_subst,p,_, _ = p in Lazy.force p
| Intermediate _ -> assert false)));
addDebugItem "Print current proof (natural language) to stderr"
(fun _ ->
| GrafiteTypes.No_proof -> assert false
| Incomplete_proof i ->
let _,m,_subst,p,ty, attrs = i.GrafiteTypes.proof in
- Cic.CurrentProof ("current (incomplete) proof",m,p,ty,[],attrs)
+ Cic.CurrentProof ("current (incomplete) proof",m,Lazy.force p,ty,[],attrs)
| Proof (_,m,_subst,p,ty, attrs) ->
- Cic.CurrentProof ("current proof",m,p,ty,[],attrs)
+ Cic.CurrentProof ("current proof",m,Lazy.force p,ty,[],attrs)
| Intermediate _ -> assert false)));
(* addDebugItem "ask record choice"
(fun _ ->
*)
type status =
- Cic.context * (int * Cic.term * bool * int * (int * Cic.term) list) list *
+ Cic.context * (int * Cic.term * bool * int * (int * Cic.term Lazy.t) list) list *
(int * Cic.term * int) list *
- Cic.term list
+ Cic.term Lazy.t list
let fake_goal = Cic.Implicit None;;
let fake_candidates = [];;
let pp_goal context x =
if x == fake_goal then "" else pp context x
;;
-let pp_candidate context x = pp context x
-let pp_candidate_tip context x = pp ~size:0 context x
+let pp_candidate context x = pp context (Lazy.force x)
+let pp_candidate_tip context x = pp ~size:0 context (Lazy.force x)
let pp_candidate_type context x =
try
let ty, _ =
CicTypeChecker.type_of_aux' [] ~subst:[]
- context x CicUniv.oblivion_ugraph
+ context (Lazy.force x) CicUniv.oblivion_ugraph
in
pp ~size:0 context ty
- with CicUtil.Meta_not_found _ -> pp ~size:0 context x
+ with CicUtil.Meta_not_found _ -> pp ~size:0 context (Lazy.force x)
;;
let sublist start len l =
type status =
Cic.context *
- (int * Cic.term * bool * int * (int * Cic.term) list) list *
- (int * Cic.term * int) list * Cic.term list
+ (int * Cic.term * bool * int * (int * Cic.term Lazy.t) list) list *
+ (int * Cic.term * int) list * Cic.term Lazy.t list
val auto_dialog : (unit -> status) -> unit
val set_font_size: int -> unit
match self#script#grafite_status.proof_status with
| Proof (uri, metasenv, _subst, bo, ty, attrs) ->
let name = UriManager.name_of_uri (HExtlib.unopt uri) in
- let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], attrs) in
+ let obj = Cic.CurrentProof (name, metasenv, Lazy.force bo, ty, [], attrs) in
self#_loadObj obj
| Incomplete_proof { proof = (uri, metasenv, _subst, bo, ty, attrs) } ->
let name = UriManager.name_of_uri (HExtlib.unopt uri) in
- let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], attrs) in
+ let obj = Cic.CurrentProof (name, metasenv, Lazy.force bo, ty, [], attrs) in
self#_loadObj obj
| _ -> self#blank ()
[], "", parsed_text_length
| TA.WHint (loc, term) ->
let _subst = [] in
- let s = ((None,[0,[],term], _subst, Cic.Meta (0,[]) ,term, []),0) in
+ let s = ((None,[0,[],term], _subst, lazy (Cic.Meta (0,[])) ,term, []),0) in
let l = List.map fst (MQ.experimental_hint ~dbd s) in
let entry = `Whelp (pp_macro mac, l) in
guistuff.mathviewer#show_uri_list ~reuse:true ~entry l;