aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/miscops.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-05-29 11:08:37 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-05-29 11:08:37 +0000
commit5fa47f1258408541150e2e4c26d60ff694e7c1bc (patch)
tree9e7aee1ea714cebdccc50dbd85735948d8baeaf0 /pretyping/miscops.ml
parent45038a0bfd5621153ba0dd4b6e06755fd15da1e3 (diff)
locus.mli for occurrences+clauses, misctypes.mli for various little things
Corresponding operations in locusops.ml and miscops.ml The type of occurrences is now a clear algebraic one instead of a bool*list hard to understand. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15372 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping/miscops.ml')
-rw-r--r--pretyping/miscops.ml43
1 files changed, 43 insertions, 0 deletions
diff --git a/pretyping/miscops.ml b/pretyping/miscops.ml
new file mode 100644
index 000000000..2528d57f3
--- /dev/null
+++ b/pretyping/miscops.ml
@@ -0,0 +1,43 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+open Misctypes
+open Pp
+open Nameops
+
+let map_cast_type f = function
+ | CastConv a -> CastConv (f a)
+ | CastVM a -> CastVM (f a)
+ | CastCoerce -> CastCoerce
+
+let smartmap_cast_type f c =
+ match c with
+ | CastConv a -> let a' = f a in if a' == a then c else CastConv a'
+ | CastVM a -> let a' = f a in if a' == a then c else CastVM a'
+ | CastCoerce -> CastCoerce
+
+(** Printing of [intro_pattern] *)
+
+let rec pr_intro_pattern (_,pat) = match pat with
+ | IntroOrAndPattern pll -> pr_or_and_intro_pattern pll
+ | IntroWildcard -> str "_"
+ | IntroRewrite true -> str "->"
+ | IntroRewrite false -> str "<-"
+ | IntroIdentifier id -> pr_id id
+ | IntroFresh id -> str "?" ++ pr_id id
+ | IntroForthcoming true -> str "*"
+ | IntroForthcoming false -> str "**"
+ | IntroAnonymous -> str "?"
+
+and pr_or_and_intro_pattern = function
+ | [pl] ->
+ str "(" ++ hv 0 (prlist_with_sep pr_comma pr_intro_pattern pl) ++ str ")"
+ | pll ->
+ str "[" ++
+ hv 0 (prlist_with_sep pr_bar (prlist_with_sep spc pr_intro_pattern) pll)
+ ++ str "]"