Fix Undo try
This commit is contained in:
parent
6313af9346
commit
8b3b135184
12
main.ml
12
main.ml
@ -165,9 +165,15 @@ let rec interactive (get_instr : unit -> instr) (sl : (interactive_state) list)
|
||||
end
|
||||
end
|
||||
| Tact t ->
|
||||
(* on applique la tactique et on copie l'état actuel de la preuve pour un futur Undo
|
||||
Comme OCaml évalue de la droite vers la gauche, on fait bien la copie avant de modifier les références dans la preuve *)
|
||||
(cg, (apply_tactic (g, gs) t))::(clean_state (cg, (g, gs)))::sq |> interactive get_instr
|
||||
(* on applique la tactique et on copie l'état actuel de la preuve pour un futur Undo *)
|
||||
let previous_state = clean_state (cg, (g, gs)) in
|
||||
let new_proof, status = apply_tactic (g, gs) t in
|
||||
(
|
||||
if status then
|
||||
(cg, new_proof)::previous_state::sq
|
||||
else
|
||||
previous_state::sq
|
||||
) |> interactive get_instr
|
||||
with
|
||||
Parser.Error ->
|
||||
print_error "Invalid input" "";
|
||||
|
25
proof.ml
25
proof.ml
@ -210,17 +210,18 @@ let tact_left ((g, gs) : proof) : proof =
|
||||
Some (new_h, t_l, cs), gs
|
||||
| _ -> raise (TacticFailed "Not a disjunction")
|
||||
|
||||
let rec apply_tactic (p : proof) (t : tactic) : proof =
|
||||
(* applies tactic to proof, returns (new_proof, true if p changed) *)
|
||||
let rec apply_tactic (p : proof) (t : tactic) : proof * bool =
|
||||
match t with
|
||||
TExact_term e -> tact_exact_term p e
|
||||
| TExact_proof hyp -> tact_exact_proof p hyp
|
||||
| TIntros -> tact_intros p
|
||||
| TIntro -> tact_intro p
|
||||
| TAssumption -> tact_assumption p
|
||||
| TCut t -> tact_cut p t
|
||||
| TApply h -> tact_apply p h
|
||||
| TSplit -> tact_split p
|
||||
| TRight -> tact_right p
|
||||
| TLeft -> tact_left p
|
||||
| TTry t -> try apply_tactic p t with TacticFailed _ -> p
|
||||
TExact_term e -> tact_exact_term p e, true
|
||||
| TExact_proof hyp -> tact_exact_proof p hyp, true
|
||||
| TIntros -> tact_intros p, true
|
||||
| TIntro -> tact_intro p, true
|
||||
| TAssumption -> tact_assumption p, true
|
||||
| TCut t -> tact_cut p t, true
|
||||
| TApply h -> tact_apply p h, true
|
||||
| TSplit -> tact_split p, true
|
||||
| TRight -> tact_right p, true
|
||||
| TLeft -> tact_left p, true
|
||||
| TTry t -> try apply_tactic p t with TacticFailed _ -> p, false
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Goal A -> B -> A.
|
||||
intros.
|
||||
try intro.
|
||||
try try try intro.
|
||||
Undo.
|
||||
intro.
|
||||
exact H0.
|
||||
|
Loading…
Reference in New Issue
Block a user