X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_transformations%2FtacticAstPp.ml;h=86c7185ecf1308d75e1f34707059c1cc77f3fc1f;hb=44d337f8d772c6895d310a1b1d62770c3355fe03;hp=ee099e4202a4539e97bfa3baa975c57e9f804051;hpb=bc9cc53fbb0cb8676106e0c4d74053bbe1ac1a8e;p=helm.git diff --git a/helm/ocaml/cic_transformations/tacticAstPp.ml b/helm/ocaml/cic_transformations/tacticAstPp.ml index ee099e420..86c7185ec 100644 --- a/helm/ocaml/cic_transformations/tacticAstPp.ml +++ b/helm/ocaml/cic_transformations/tacticAstPp.ml @@ -37,6 +37,8 @@ let pp_term_cic term = CicPp.ppterm term let pp_idents idents = "[" ^ String.concat "; " idents ^ "]" +let pp_terms_ast terms = String.concat ", " (List.map pp_term_ast terms) + let pp_reduction_kind = function | `Reduce -> "reduce" | `Simpl -> "simplify" @@ -44,29 +46,24 @@ let pp_reduction_kind = function | `Normalize -> "normalize" -let pp_pattern (hyp, goal) = +let pp_pattern (t, hyp, goal) = let pp_hyp_pattern l = String.concat "; " - (List.map (fun (name, p) -> sprintf "%s : %s" name (pp_term_ast p)) l) - in - let pp_goal_pattern p = - match p with - | None -> "" - | Some p -> pp_term_ast p + (List.map (fun (name, p) -> sprintf "%s : %s" name (pp_term_ast p)) l) in + let pp_t t = + match t with + None -> "" + | Some t -> pp_term_ast t in - let separator = - if hyp <> [] then " \\vdash " else " " - in - "in " ^ pp_hyp_pattern hyp ^ separator ^ pp_goal_pattern goal + pp_t t ^ " in " ^ pp_hyp_pattern hyp ^ " \\vdash " ^ pp_term_ast goal let rec pp_tactic = function | Absurd (_, term) -> "absurd" ^ pp_term_ast term | Apply (_, term) -> "apply " ^ pp_term_ast term | Auto _ -> "auto" | Assumption _ -> "assumption" - | Change (_, t1, t2, where) -> - sprintf "change %s with %s %s" (pp_term_ast t1) (pp_term_ast t2) - (pp_pattern where) + | Change (_, where, with_what) -> + sprintf "change %s with %s" (pp_pattern where) (pp_term_ast with_what) | Clear (_,id) -> sprintf "clear %s" id | ClearBody (_,id) -> sprintf "clearbody %s" id | Compare (_,term) -> "compare " ^ pp_term_ast term @@ -86,12 +83,14 @@ let rec pp_tactic = function | Exact (_, term) -> "exact " ^ pp_term_ast term | Exists _ -> "exists" | Fold (_, kind, term, pattern) -> - sprintf "fold %s %s %s" (pp_reduction_kind kind) (pp_term_ast term) - (pp_pattern pattern) - | Generalize (_, term, ident, pattern) -> - sprintf "generalize %s%s %s" (pp_term_ast term) + sprintf "fold %s %s %s" (pp_reduction_kind kind) + (pp_term_ast term) (pp_pattern pattern) + | FwdSimpl (_, hyp, idents) -> + sprintf "fwd %s%s" hyp + (match idents with [] -> "" | idents -> " " ^ pp_idents idents) + | Generalize (_, pattern, ident) -> + sprintf "generalize %s%s" (pp_pattern pattern) (match ident with None -> "" | Some id -> " as " ^ id) - (pp_pattern pattern) | Goal (_, n) -> "goal " ^ string_of_int n | Fail _ -> "fail" | Fourier _ -> "fourier" @@ -102,6 +101,12 @@ let rec pp_tactic = function sprintf "intros%s%s" (match num with None -> "" | Some num -> " " ^ string_of_int num) (match idents with [] -> "" | idents -> " " ^ pp_idents idents) + | LApply (_, level_opt, terms, term, ident_opt) -> + sprintf "lapply %s%s%s%s" + (match level_opt with None -> "" | Some i -> " depth = " ^ string_of_int i ^ " ") + (pp_term_ast term) + (match terms with [] -> "" | _ -> " to " ^ pp_terms_ast terms) + (match ident_opt with None -> "" | Some ident -> " using " ^ ident) | Left _ -> "left" | LetIn (_, term, ident) -> sprintf "let %s in %s" (pp_term_ast term) ident | Reduce (_, kind, pat) -> @@ -111,18 +116,14 @@ let rec pp_tactic = function sprintf "replace %s with %s" (pp_pattern pattern) (pp_term_ast t) | Rewrite (_, pos, t, pattern) -> sprintf "rewrite %s %s %s" - (if pos = `Left then "left" else "right") (pp_term_ast t) + (if pos = `LeftToRight then ">" else "<") + (pp_term_ast t) (pp_pattern pattern) | Right _ -> "right" | Ring _ -> "ring" | Split _ -> "split" | Symmetry _ -> "symmetry" | Transitivity (_, term) -> "transitivity " ^ pp_term_ast term - | FwdSimpl (_, term) -> sprintf "fwd %s" (pp_term_ast term) - | LApply (_, term_opt, term, ident) -> - sprintf "lapply %s%s%s" (pp_term_ast term) - (match term_opt with None -> "" | Some t -> " to " ^ pp_term_ast t) - (match ident with None -> "" | Some id -> " " ^ id) let pp_flavour = function | `Definition -> "Definition"