+
+let pp_auto_params ~term_pp (univ, params) =
+ String.concat " "
+ (List.map (fun (k,v) -> if v <> "" then k ^ "=" ^ v else k) params) ^
+ if univ <> [] then
+ (if params <> [] then " " else "") ^ "by " ^
+ String.concat " " (List.map term_pp univ)
+ else ""
+;;
+
+let pp_just ~term_pp =
+ function
+ `Term term -> "exact " ^ term_pp term
+ | `Auto params -> pp_auto_params ~term_pp params
+;;
+
+let rec pp_ntactic ~map_unicode_to_tex =
+ let term_pp = CicNotationPp.pp_term in
+ let lazy_term_pp = fun _ -> assert false in
+ let pp_tactic_pattern =
+ pp_tactic_pattern ~map_unicode_to_tex ~lazy_term_pp ~term_pp in
+ function
+ | NApply (_,t) -> "napply " ^ CicNotationPp.pp_term t
+ | NAuto (_,(l,flgs)) ->
+ "nauto" ^
+ (if l <> [] then (" by " ^
+ (String.concat "," (List.map CicNotationPp.pp_term l))) else "") ^
+ String.concat " " (List.map (fun a,b -> a ^ "=" ^ b) flgs)
+ | NCases (_,what,where) -> "ncases " ^ CicNotationPp.pp_term what ^
+ assert false ^ " " ^ assert false
+ | NConstructor (_,None,l) -> "@ " ^
+ String.concat " " (List.map CicNotationPp.pp_term l)
+ | NConstructor (_,Some x,l) -> "@" ^ string_of_int x ^ " " ^
+ String.concat " " (List.map CicNotationPp.pp_term l)
+ | NCase1 (_,n) -> "*" ^ n ^ ":"
+ | NChange (_,what,wwhat) -> "nchange " ^ assert false ^
+ " with " ^ CicNotationPp.pp_term wwhat
+ | NCut (_,t) -> "ncut " ^ CicNotationPp.pp_term t
+ | NElim (_,what,where) -> "nelim " ^ CicNotationPp.pp_term what ^
+ assert false ^ " " ^ assert false
+ | NId _ -> "nid"
+ | NIntro (_,n) -> "#" ^ n
+ | NLApply (_,t) -> "lapply " ^ CicNotationPp.pp_term t
+ | NRewrite (_,dir,n,where) -> "nrewrite " ^
+ (match dir with `LeftToRight -> ">" | `RightToLeft -> "<") ^
+ " " ^ CicNotationPp.pp_term n ^ " " ^ pp_tactic_pattern where
+ | NReduce _ | NGeneralize _ | NLetIn _ | NAssert _ -> "TO BE IMPLEMENTED"
+ | NDot _ -> "##."
+ | NSemicolon _ -> "##;"
+ | NBranch _ -> "##["
+ | NShift _ -> "##|"
+ | NPos (_, l) -> "##" ^String.concat "," (List.map string_of_int l)^ ":"
+ | NWildcard _ -> "##*:"
+ | NMerge _ -> "##]"
+ | NFocus (_,l) ->
+ Printf.sprintf "##focus %s"
+ (String.concat " " (List.map string_of_int l))
+ | NUnfocus _ -> "##unfocus"
+ | NSkip _ -> "##skip"
+ | NTry (_,tac) -> "ntry " ^ pp_ntactic ~map_unicode_to_tex tac
+ | NAssumption _ -> "nassumption"
+ | NBlock (_,l) ->
+ "(" ^ String.concat " " (List.map (pp_ntactic ~map_unicode_to_tex) l)^ ")"
+ | NRepeat (_,t) -> "nrepeat " ^ pp_ntactic ~map_unicode_to_tex t
+;;