X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Facic_content%2FcicNotationUtil.ml;h=1ddd5c9c3b1572c74034fb70b4f2563867ee6786;hb=9b09890767aaa93e512324f8e7f13e2cdeebac88;hp=d4a55b353adf41221cd44958e294c6ef38ee59a9;hpb=bcf9a65332d321c25761207e2fb17110dbdc8241;p=helm.git diff --git a/helm/software/components/acic_content/cicNotationUtil.ml b/helm/software/components/acic_content/cicNotationUtil.ml index d4a55b353..1ddd5c9c3 100644 --- a/helm/software/components/acic_content/cicNotationUtil.ml +++ b/helm/software/components/acic_content/cicNotationUtil.ml @@ -27,13 +27,19 @@ module Ast = CicNotationPt -let visit_ast ?(special_k = fun _ -> assert false) k = +let visit_ast ?(special_k = fun _ -> assert false) + ?(map_xref_option= fun x -> x) ?(map_case_indty= fun x -> x) + ?(map_case_outtype= + fun k x -> match x with None -> None | Some x -> Some (k x)) + k += let rec aux = function | Ast.Appl terms -> Ast.Appl (List.map k terms) | Ast.Binder (kind, var, body) -> Ast.Binder (kind, aux_capture_variable var, k body) | Ast.Case (term, indtype, typ, patterns) -> - Ast.Case (k term, indtype, aux_opt typ, aux_patterns patterns) + Ast.Case (k term, map_case_indty indtype, map_case_outtype k typ, + aux_patterns map_xref_option patterns) | Ast.Cast (t1, t2) -> Ast.Cast (k t1, k t2) | Ast.LetIn (var, t1, t3) -> Ast.LetIn (aux_capture_variable var, k t1, k t3) @@ -66,11 +72,11 @@ let visit_ast ?(special_k = fun _ -> assert false) k = | None -> None | Some term -> Some (k term) and aux_capture_variable (term, typ_opt) = k term, aux_opt typ_opt - and aux_patterns patterns = List.map aux_pattern patterns - and aux_pattern = + and aux_patterns k_xref patterns = List.map (aux_pattern k_xref) patterns + and aux_pattern k_xref = function Ast.Pattern (head, hrefs, vars), term -> - Ast.Pattern (head, hrefs, List.map aux_capture_variable vars), k term + Ast.Pattern (head, k_xref hrefs, List.map aux_capture_variable vars), k term | Ast.Wildcard, term -> Ast.Wildcard, k term and aux_subst (name, term) = (name, k term) and aux_substs substs = List.map aux_subst substs @@ -85,11 +91,14 @@ let visit_layout k = function | Ast.Over (t1, t2) -> Ast.Over (k t1, k t2) | Ast.Atop (t1, t2) -> Ast.Atop (k t1, k t2) | Ast.Frac (t1, t2) -> Ast.Frac (k t1, k t2) + | Ast.InfRule (t1, t2, t3) -> Ast.InfRule (k t1, k t2, k t3) | Ast.Sqrt t -> Ast.Sqrt (k t) | Ast.Root (arg, index) -> Ast.Root (k arg, k index) | Ast.Break -> Ast.Break | Ast.Box (kind, terms) -> Ast.Box (kind, List.map k terms) | Ast.Group terms -> Ast.Group (List.map k terms) + | Ast.Mstyle (l, term) -> Ast.Mstyle (l, List.map k term) + | Ast.Mpadded (l, term) -> Ast.Mpadded (l, List.map k term) let visit_magic k = function | Ast.List0 (t, l) -> Ast.List0 (k t, l) @@ -352,7 +361,7 @@ let fresh_id () = !fresh_index (* TODO ensure that names generated by fresh_var do not clash with user's *) -let fresh_name () = "fresh" ^ string_of_int (fresh_id ()) +let fresh_name () = "η" ^ string_of_int (fresh_id ()) let rec freshen_term ?(index = ref 0) term = let freshen_term = freshen_term ~index in