Skip to content

Commit 3be2307

Browse files
committed
Remove if_then_else. Use tryif instead.
if_then_else definition does not account for multi success tactics. tryif_then_else is a primitive tactical with the expected behavior.
1 parent 89ec88f commit 3be2307

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

theories/FSets/FSetDecide.v

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -357,17 +357,8 @@ the above form:
357357
| _ => idtac
358358
end.
359359

360-
(** [if t then t1 else t2] executes [t] and, if it does not
361-
fail, then [t1] will be applied to all subgoals
362-
produced. If [t] fails, then [t2] is executed. *)
363-
Tactic Notation
364-
"if" tactic(t)
365-
"then" tactic(t1)
366-
"else" tactic(t2) :=
367-
first [ t; first [ t1 | fail 2 ] | t2 ].
368-
369360
Ltac abstract_term t :=
370-
if (is_var t) then fail "no need to abstract a variable"
361+
tryif (is_var t) then fail "no need to abstract a variable"
371362
else (let x := fresh "x" in set (x := t) in *; try clearbody x).
372363

373364
Ltac abstract_elements :=
@@ -478,11 +469,11 @@ the above form:
478469
repeat (
479470
match goal with
480471
| H : context [ @Logic.eq ?T ?x ?y ] |- _ =>
481-
if (change T with E.t in H) then fail
482-
else if (change T with t in H) then fail
472+
tryif (change T with E.t in H) then fail
473+
else tryif (change T with t in H) then fail
483474
else clear H
484475
| H : ?P |- _ =>
485-
if prop (FSet_Prop P) holds by
476+
tryif prop (FSet_Prop P) holds by
486477
(auto 100 with FSet_Prop)
487478
then fail
488479
else clear H
@@ -747,7 +738,7 @@ the above form:
747738
| H: (In ?x ?r) -> False |- (E.eq ?y ?x) -> False =>
748739
contradict H; fsetdec_body
749740
| H: ?P -> False |- ?Q -> False =>
750-
if prop (FSet_elt_Prop P) holds by
741+
tryif prop (FSet_elt_Prop P) holds by
751742
(auto 100 with FSet_Prop)
752743
then (contradict H; fsetdec_body)
753744
else fsetdec_body

theories/MSets/MSetDecide.v

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -357,17 +357,8 @@ the above form:
357357
| _ => idtac
358358
end.
359359

360-
(** [if t then t1 else t2] executes [t] and, if it does not
361-
fail, then [t1] will be applied to all subgoals
362-
produced. If [t] fails, then [t2] is executed. *)
363-
Tactic Notation
364-
"if" tactic(t)
365-
"then" tactic(t1)
366-
"else" tactic(t2) :=
367-
first [ t; first [ t1 | fail 2 ] | t2 ].
368-
369360
Ltac abstract_term t :=
370-
if (is_var t) then fail "no need to abstract a variable"
361+
tryif (is_var t) then fail "no need to abstract a variable"
371362
else (let x := fresh "x" in set (x := t) in *; try clearbody x).
372363

373364
Ltac abstract_elements :=
@@ -478,11 +469,11 @@ the above form:
478469
repeat (
479470
match goal with
480471
| H : context [ @Logic.eq ?T ?x ?y ] |- _ =>
481-
if (change T with E.t in H) then fail
482-
else if (change T with t in H) then fail
472+
tryif (change T with E.t in H) then fail
473+
else tryif (change T with t in H) then fail
483474
else clear H
484475
| H : ?P |- _ =>
485-
if prop (MSet_Prop P) holds by
476+
tryif prop (MSet_Prop P) holds by
486477
(auto 100 with MSet_Prop)
487478
then fail
488479
else clear H
@@ -747,7 +738,7 @@ the above form:
747738
| H: (In ?x ?r) -> False |- (E.eq ?y ?x) -> False =>
748739
contradict H; fsetdec_body
749740
| H: ?P -> False |- ?Q -> False =>
750-
if prop (MSet_elt_Prop P) holds by
741+
tryif prop (MSet_elt_Prop P) holds by
751742
(auto 100 with MSet_Prop)
752743
then (contradict H; fsetdec_body)
753744
else fsetdec_body

0 commit comments

Comments
 (0)