From cb7af66937e8c72ae6ea6694350a0c86f3e6ccf9 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Thu, 23 Jun 2005 12:25:56 +0000 Subject: [PATCH] The discriminate tactic accepts a term, not only an identifier! --- helm/ocaml/cic_disambiguation/cicTextualParser2.ml | 4 ++-- helm/ocaml/cic_transformations/tacticAst.ml | 2 +- helm/ocaml/cic_transformations/tacticAst2Box.ml | 7 +++---- helm/ocaml/cic_transformations/tacticAstPp.ml | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml index 086c30787..737673e14 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml @@ -368,8 +368,8 @@ EXTEND principles = ident_list1; where = IDENT -> TacticAst.Decompose (loc, where, principles) | [ IDENT "discriminate" ]; - hyp = IDENT -> - TacticAst.Discriminate (loc, hyp) + t = tactic_term -> + TacticAst.Discriminate (loc, t) | [ IDENT "elimType" ]; t = tactic_term -> TacticAst.ElimType (loc, t) | [ IDENT "elim" ]; diff --git a/helm/ocaml/cic_transformations/tacticAst.ml b/helm/ocaml/cic_transformations/tacticAst.ml index c130cc933..12b7774cd 100644 --- a/helm/ocaml/cic_transformations/tacticAst.ml +++ b/helm/ocaml/cic_transformations/tacticAst.ml @@ -40,7 +40,7 @@ type ('term, 'ident) tactic = | Contradiction of loc | Cut of loc * 'term | Decompose of loc * 'ident * 'ident list (* where, which principles *) - | Discriminate of loc * 'ident + | Discriminate of loc * 'term | Elim of loc * 'term * 'term option (* what to elim, which principle to use *) | ElimType of loc * 'term | Exact of loc * 'term diff --git a/helm/ocaml/cic_transformations/tacticAst2Box.ml b/helm/ocaml/cic_transformations/tacticAst2Box.ml index 35a27ff24..f43091c75 100644 --- a/helm/ocaml/cic_transformations/tacticAst2Box.ml +++ b/helm/ocaml/cic_transformations/tacticAst2Box.ml @@ -56,7 +56,7 @@ let rec count_tactic current_size tac = List.fold_left (fun size s -> size + (String.length s)) (current_size + 11 + String.length ident) principles - | Discriminate (_, ident) -> current_size + 12 + (String.length ident) + | Discriminate (_, term) -> countterm (current_size + 12) term | Elim (_, term, using) -> let size1 = countterm (current_size + 5) term in (match using with @@ -164,9 +164,8 @@ and big_tactic2box = function Box.V([],principles); Box.Text([],"]")]); Box.Text([],ident)]) - | Discriminate (_, ident) -> - Box.V([],[Box.Text([],"discriminate"); - Box.Text([],ident)]) + | Discriminate (_, term) -> + Box.V([],pretty_append [Box.Text([],"discriminate")] term) | Elim (_, term, using) -> let using = (match using with diff --git a/helm/ocaml/cic_transformations/tacticAstPp.ml b/helm/ocaml/cic_transformations/tacticAstPp.ml index 86d10c877..52f7b1ab2 100644 --- a/helm/ocaml/cic_transformations/tacticAstPp.ml +++ b/helm/ocaml/cic_transformations/tacticAstPp.ml @@ -71,7 +71,7 @@ let rec pp_tactic = function | Cut (_, term) -> "cut " ^ pp_term_ast term | Decompose (_, ident, principles) -> sprintf "decompose %s %s" (pp_idents principles) ident - | Discriminate (_, ident) -> "discriminate " ^ ident + | Discriminate (_, term) -> "discriminate " ^ pp_term_ast term | Elim (_, term, using) -> sprintf "elim " ^ pp_term_ast term ^ (match using with None -> "" | Some term -> " using " ^ pp_term_ast term) -- 2.39.2