aboutsummaryrefslogtreecommitdiffhomepage
path: root/proofs/logic.ml
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2017-08-29 14:37:55 +0200
committerGravatar Maxime Dénès <mail@maximedenes.fr>2017-08-29 14:37:55 +0200
commit751246d893470b95d3d96ef87fe6dc86950d8d63 (patch)
treea4512b9db59c10ed761d124f63f18a30ce1f51aa /proofs/logic.ml
parent7e29b535397c98a46999ecdd827fa5f4cebc8798 (diff)
parent4f392bc8114309f388791c1ddc7cc95cc021aa5e (diff)
Merge PR #830: Moving assert (the "Cut" rule) to new proof engine
Diffstat (limited to 'proofs/logic.ml')
-rw-r--r--proofs/logic.ml50
1 files changed, 4 insertions, 46 deletions
diff --git a/proofs/logic.ml b/proofs/logic.ml
index 17128b92e..20d075ae1 100644
--- a/proofs/logic.ml
+++ b/proofs/logic.ml
@@ -22,7 +22,6 @@ open Proof_type
open Type_errors
open Retyping
open Misctypes
-open Context.Named.Declaration
module NamedDecl = Context.Named.Declaration
@@ -93,15 +92,6 @@ let check_typability env sigma c =
(* Implementation of the structural rules (moving and deleting
hypotheses around) *)
-(* The Clear tactic: it scans the context for hypotheses to be removed
- (instead of iterating on the list of identifier to be removed, which
- forces the user to give them in order). *)
-
-let clear_hyps2 env sigma ids sign t cl =
- let evdref = ref (Evd.clear_metas sigma) in
- let (hyps,t,cl) = Evarutil.clear_hyps2_in_evi env evdref sign t cl ids in
- (hyps, t, cl, !evdref)
-
(* The ClearBody tactic *)
(* Reordering of the context *)
@@ -200,14 +190,6 @@ let move_location_eq m1 m2 = match m1, m2 with
| MoveFirst, MoveFirst -> true
| _ -> false
-let rec get_hyp_after h = function
- | [] -> error_no_such_hypothesis h
- | d :: right ->
- if Id.equal (NamedDecl.get_id d) h then
- match right with d' ::_ -> MoveBefore (NamedDecl.get_id d') | [] -> MoveFirst
- else
- get_hyp_after h right
-
let split_sign hfrom hto l =
let rec splitrec left toleft = function
| [] -> error_no_such_hypothesis hfrom
@@ -282,6 +264,10 @@ let move_hyp_in_named_context sigma hfrom hto sign =
split_sign hfrom hto (named_context_of_val sign) in
move_hyp sigma toleft (left,declfrom,right) hto
+let insert_decl_in_named_context sigma decl hto sign =
+ let open EConstr in
+ move_hyp sigma false ([],decl,named_context_of_val sign) hto
+
(**********************************************************************)
@@ -535,37 +521,9 @@ let convert_hyp check sign sigma d =
(* Primitive tactics are handled here *)
let prim_refiner r sigma goal =
- let env = Goal.V82.env sigma goal in
- let sign = Goal.V82.hyps sigma goal in
let cl = Goal.V82.concl sigma goal in
- let mk_goal hyps concl =
- Goal.V82.mk_goal sigma hyps concl (Goal.V82.extra sigma goal)
- in
- let open EConstr in
match r with
(* Logical rules *)
- | Cut (b,replace,id,t) ->
-(* if !check && not (Retyping.get_sort_of env sigma t) then*)
- let t = EConstr.of_constr t in
- let (sg1,ev1,sigma) = mk_goal sign (nf_betaiota sigma t) in
- let sign,t,cl,sigma =
- if replace then
- let nexthyp = get_hyp_after id (named_context_of_val sign) in
- let sign,t,cl,sigma = clear_hyps2 env sigma (Id.Set.singleton id) sign t cl in
- move_hyp sigma false ([], LocalAssum (id,t),named_context_of_val sign)
- nexthyp,
- t,cl,sigma
- else
- (if !check && mem_named_context_val id sign then
- user_err ~hdr:"Logic.prim_refiner"
- (str "Variable " ++ pr_id id ++ str " is already declared.");
- push_named_context_val (LocalAssum (id,t)) sign,t,cl,sigma) in
- let (sg2,ev2,sigma) =
- Goal.V82.mk_goal sigma sign cl (Goal.V82.extra sigma goal) in
- let oterm = mkLetIn (Name id, ev1, t, EConstr.Vars.subst_var id ev2) in
- let sigma = Goal.V82.partial_solution_to sigma goal sg2 oterm in
- if b then ([sg1;sg2],sigma) else ([sg2;sg1],sigma)
-
| Refine c ->
let cl = EConstr.Unsafe.to_constr cl in
check_meta_variables c;