package rocq-runtime
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
The Rocq Prover -- Core Binaries and Tools
Install
dune-project
Dependency
Authors
Maintainers
Sources
rocq-9.3.0.tar.gz
sha256=3f0fc283e8644394aa9c7a6e3995b6d9ebbe1e6dda712bf431f9c372dcef95ad
doc/src/ltac_plugin/rewriteStratAst.ml.html
Source file rewriteStratAst.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148(************************************************************************) (* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) open Pp open Names open Rewrite type unary_strategy = Subterms | Subterm | Innermost | Outermost | Bottomup | Topdown | Progress | Try | Any | Repeat type binary_strategy = | Compose type nary_strategy = Choice type ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast = | StratId | StratFail | StratRefl | StratUnary of unary_strategy * ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast | StratBinary of binary_strategy * ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast * ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast | StratNAry of nary_strategy * ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast list | StratConstr of 'constr * bool | StratTerms of 'constr list | StratHints of bool * string | StratEval of 'redexpr | StratFold of 'constr | StratVar of 'id | StratFix of 'id * ('constr,'constr_pattern,'redexpr,'id,'tactic) strategy_ast | StratMatches of 'constr_pattern | StratTactic of 'tactic let rec map_strategy f g h i j = function | StratId | StratFail | StratRefl as s -> s | StratUnary (s, str) -> StratUnary (s, map_strategy f g h i j str) | StratBinary (s, str, str') -> StratBinary (s, map_strategy f g h i j str, map_strategy f g h i j str') | StratNAry (s, strs) -> StratNAry (s, List.map (map_strategy f g h i j) strs) | StratConstr (c, b) -> StratConstr (f c, b) | StratTerms l -> StratTerms (List.map f l) | StratHints (b, id) -> StratHints (b, id) | StratEval r -> StratEval (h r) | StratFold c -> StratFold (f c) | StratVar id -> StratVar (i id) | StratFix (id, s) -> StratFix (i id, map_strategy f g h i j s) | StratMatches c -> StratMatches (g c) | StratTactic t -> StratTactic (j t) let pr_ustrategy = function | Subterms -> str "subterms" | Subterm -> str "subterm" | Innermost -> str "innermost" | Outermost -> str "outermost" | Bottomup -> str "bottomup" | Topdown -> str "topdown" | Progress -> str "progress" | Try -> str "try" | Any -> str "any" | Repeat -> str "repeat" let paren p = str "(" ++ p ++ str ")" let rec pr_strategy0 prc prcp prr prid prtac = function | StratId -> str "id" | StratFail -> str "fail" | StratRefl -> str "refl" | str -> paren (pr_strategy prc prcp prr prid prtac str) and pr_strategy1 prc prcp prr prid prtac = function | StratUnary (s, str) -> pr_ustrategy s ++ spc () ++ pr_strategy1 prc prcp prr prid prtac str | StratNAry (Choice, strs) -> str "choice" ++ brk (1,2) ++ prlist_with_sep spc (fun str -> hov 0 (pr_strategy0 prc prcp prr prid prtac str)) strs | StratConstr (c, true) -> prc c | StratConstr (c, false) -> str "<-" ++ spc () ++ prc c | StratVar id -> prid id | StratTerms cl -> str "terms" ++ spc () ++ pr_sequence prc cl | StratHints (old, id) -> let cmd = if old then "old_hints" else "hints" in str cmd ++ spc () ++ str id | StratEval r -> str "eval" ++ spc () ++ prr r | StratFold c -> str "fold" ++ spc () ++ prc c | StratMatches p -> str "pattern" ++ spc () ++ prcp p | StratTactic t -> str"tactic" ++ spc () ++ prtac t | str -> pr_strategy0 prc prcp prr prid prtac str and pr_strategy2 prc prcp prr prid prtac = function | StratBinary (Compose, str1, str2) -> pr_strategy2 prc prcp prr prid prtac str1 ++ str ";" ++ spc () ++ hov 0 (pr_strategy1 prc prcp prr prid prtac str2) | str -> hov 0 (pr_strategy1 prc prcp prr prid prtac str) and pr_strategy prc prcp prr prid prtac = function | StratFix (id,s) -> str "fix" ++ spc() ++ prid id ++ spc() ++ str ":=" ++ spc() ++ hov 0 (pr_strategy1 prc prcp prr prid prtac s) | str -> pr_strategy2 prc prcp prr prid prtac str let strategy_of_ast bindings strat = let rec aux bindings = function | StratId -> Strategies.id | StratFail -> Strategies.fail | StratRefl -> Strategies.refl | StratUnary (f, s) -> let s' = aux bindings s in let f' = match f with | Subterms -> Strategies.all_subterms | Subterm -> Strategies.one_subterm | Innermost -> Strategies.innermost | Outermost -> Strategies.outermost | Bottomup -> Strategies.bottomup | Topdown -> Strategies.topdown | Progress -> Strategies.progress | Try -> Strategies.try_ | Any -> Strategies.any | Repeat -> Strategies.repeat in f' s' | StratBinary (f, s, t) -> let s' = aux bindings s in let t' = aux bindings t in let f' = match f with | Compose -> Strategies.seq in f' s' t' | StratNAry (Choice, strs) -> let strs = List.map (aux bindings) strs in begin match strs with | [] -> assert false | s::strs -> List.fold_left Strategies.choice s strs end | StratConstr ((_, c), b) -> Strategies.one_lemma c b None AllOccurrences | StratHints (old, id) -> if old then Strategies.old_hints id else Strategies.hints id | StratTerms l -> Strategies.lemmas (List.map (fun (_, c) -> (c, true, None)) l) | StratEval r -> Strategies.with_env @@ fun env sigma -> let sigma, r = r env sigma in sigma, Strategies.reduce r | StratFold c -> Strategies.fold_glob (fst c) | StratVar id -> Id.Map.get id bindings | StratFix (id, s) -> Strategies.fix (fun self -> aux (Id.Map.add id self bindings) s) | StratMatches p -> Strategies.matches p | StratTactic t -> Strategies.ltac1_tactic_call t in aux bindings strat let strategy_of_ast s = strategy_of_ast Id.Map.empty s
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>