-let connection_param = "host=mowgli.cs.unibo.it dbname=helm user=helm"
+let connection_param = "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm"
let show_queries = ref false
let lexbuf = Lexing.from_channel stdin in
try
while true do
- match CicTextualParserContext.main
- (UriManager.uri_of_string "cic:/dummy") [] []
- CicTextualLexer.token lexbuf
- with
- | None -> ()
- | Some (_, expr) -> terms := expr :: ! terms
- done;
+ let dom,mk_term =
+ CicTextualParserContext.main [] [] CicTextualLexer.token lexbuf
+ in
+ match dom with
+ [] -> terms := (snd (mk_term (function _ -> None))) :: !terms
+ | _ -> assert false
+ done ;
! terms
with
CicTextualParser0.Eof -> ! terms
let pp_type_of uri =
let u = UriManager.uri_of_string uri in
let s = match (CicEnvironment.get_obj u) with
- | Cic.Definition (_, _, ty, _) -> CicPp.ppterm ty
- | Cic.Axiom (_, ty, _) -> CicPp.ppterm ty
- | Cic.Variable (_, _, ty) -> CicPp.ppterm ty
- | _ -> "Current proof or inductive definition."
+ | Cic.Constant (_, _, ty, _) -> CicPp.ppterm ty
+ | Cic.Variable (_, _, ty, _) -> CicPp.ppterm ty
+ | _ -> "Current proof or inductive definition."
(*
| Cic.CurrentProof (_,conjs,te,ty) ->
| C.InductiveDefinition _ ->
print_string ("? " ^ CicPp.ppterm term ^ nl);
flush stdout
-let levels l =
- let module Gen = MQueryGenerator in
- let rec levels_aux = function
- | [] -> ()
- | term :: tail ->
- levels_aux tail;
- print_string ("? " ^ CicPp.ppterm term ^ nl);
- print_string (Gen.string_of_levels (Gen.levels_of_term [] [] term) nl);
- flush stdout
- in
- levels_aux l
-
let execute ich =
let module Util = MQueryUtil in
let module Gen = MQueryGenerator in
if Mqint.get_stat () then
print_string ("? " ^ CicPp.ppterm term ^ nl);
let t0 = Sys.time () in
- let r = Gen.backward [] [] term level in
+ let list_of_must,can = MQueryLevels.out_restr [] [] term in
+ let len = List.length list_of_must in
+ let must = if level < len then List.nth list_of_must level else can in
+ let r = Gen.searchPattern [] [] term must can in
let t1 = Sys.time () -. t0 in
let info = Gen.get_query_info () in
let num = List.nth info 0 in
prerr_endline "-t -typeof URI outputs the CIC type of the given HELM object";
prerr_endline "-x -execute issues a query given in the input file";
prerr_endline "-d -disply outputs the CIC terms given in the input file";
- prerr_endline "-l -levels outputs the cut levels of the CIC terms given in the input file";
prerr_endline "-L -locate ALIAS issues the \"Locate\" query for the given alias";
prerr_endline "-B -backward LEVEL issues the \"Backward\" query for the given level on all CIC terms";
prerr_endline " in the input file";
| ("-h"|"-help") :: rem -> prerr_help ()
| ("-d"|"-display") :: rem -> display (get_terms ())
| ("-t"|"-typeof") :: arg :: rem -> pp_type_of arg; parse rem
- | ("-l"|"-levels") :: rem -> levels (get_terms ())
| ("-x"|"-execute") :: rem -> execute stdin; parse rem
| ("-q"|"-show-queries") :: rem -> show_queries := true; parse rem
| ("-s"|"-stat") :: rem -> Mqint.set_stat true; parse rem
let _ =
let module Gen = MQueryGenerator in
- CicCooking.init () ;
Logger.log_callback :=
(Logger.log_to_html
~print_and_flush:(function s -> print_string s ; flush stdout)) ;