Skip to content

Commit d2720db

Browse files
authored
[tactic] Actually improve one-sided match robustness (fixes #799)
1 parent e4eb5d3 commit d2720db

2 files changed

Lines changed: 44 additions & 4 deletions

File tree

src/phl/ecPhlCond.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ end = struct
190190
let discharge_post tc =
191191
let+ tc =
192192
if Option.is_some side
193-
then EcLowGoal.t_intros_n 3 tc
194-
else EcLowGoal.t_intros_n 2 tc
193+
then EcLowGoal.t_intros_n 2 tc
194+
else EcLowGoal.t_intros_n 1 tc
195195
in
196-
EcLowGoal.t_assumption `Alpha tc
196+
let t_imp = EcLowGoal.t_intros_n 1 @! EcLowGoal.t_assumption `Alpha in
197+
let t_iff = EcLowGoal.t_split @! t_imp in
198+
tc |> FApi.t_or t_imp t_iff
197199
in
198200

199201
let pre = oget (EcLowPhlGoal.get_pre (FApi.tc1_goal tc)) in

tests/single_match.ec

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require import AllCore.
2+
13
op w : unit option.
24

35
module M = {
@@ -9,10 +11,46 @@ module M = {
911
}
1012
}.
1113

12-
hoare L: M.f: exists x, x = true ==> true.
14+
hoare L1: M.f: exists x, x = true ==> true.
15+
proof.
16+
proc.
17+
match.
18+
+ by skip.
19+
+ by skip.
20+
qed.
21+
22+
phoare L2: [M.f: exists x, x = true ==> true] <= 1%r.
23+
proof.
24+
proc.
25+
match.
26+
+ by skip.
27+
+ by skip.
28+
qed.
29+
30+
phoare L3: [M.f: exists x, x = true ==> true] = 1%r.
1331
proof.
1432
proc.
1533
match.
1634
+ by skip.
1735
+ by skip.
1836
qed.
37+
38+
phoare L4: [M.f: exists x, x = true ==> true] >= 1%r.
39+
proof.
40+
proc.
41+
match.
42+
+ by skip.
43+
+ by skip.
44+
qed.
45+
46+
equiv L5: M.f ~ M.f: exists x, x = true ==> true.
47+
proof.
48+
proc.
49+
match {1}.
50+
+ match {2}.
51+
+ by skip.
52+
+ by skip.
53+
+ match {2}.
54+
+ by skip.
55+
+ by skip.
56+
qed.

0 commit comments

Comments
 (0)