@@ -150,7 +150,6 @@ end = struct
150150 let + tc = EcPhlSkip. t_skip tc in
151151 let + tc = EcLowGoal. t_intro_s `Fresh tc in
152152 let + tc = EcLowGoal. t_elim_and tc in
153-
154153 let e = EcEnv.LDecl. fresh_id (FApi. tc1_hyps tc) " e" in
155154
156155 let + tc = EcLowGoal. t_intros_i [e] tc in
@@ -173,14 +172,36 @@ end = struct
173172 in
174173
175174 let clean (tc : tcenv1 ) =
175+ let discharge_pre tc =
176+ let + tc =
177+ if Option. is_some side
178+ then EcLowGoal. t_intros_n 2 tc
179+ else EcLowGoal. t_intros_n 1 tc
180+ in
181+ let + tc = EcLowGoal. t_elim_and tc in
182+ let + tc = EcLowGoal. t_intro_s `Fresh tc in
183+ let + tc = EcLowGoal. t_elim_and tc in
184+ let + tc = EcLowGoal. t_intros_n ~clear: true 1 tc in
185+ let + tc = EcLowGoal. t_intro_s `Fresh tc in
186+ tc
187+ |> EcLowGoal. t_split
188+ @! EcLowGoal. t_assumption `Alpha
189+ in
190+ let discharge_post tc =
191+ let + tc =
192+ if Option. is_some side
193+ then EcLowGoal. t_intros_n 3 tc
194+ else EcLowGoal. t_intros_n 2 tc
195+ in
196+ EcLowGoal. t_assumption `Alpha tc
197+ in
198+
176199 let pre = oget (EcLowPhlGoal. get_pre (FApi. tc1_goal tc)) in
177200 let post = oget (EcLowPhlGoal. get_post (FApi. tc1_goal tc)) in
178201 let eq, _, pre = destr_and3 pre in
179- let tc = EcPhlConseq. t_conseq (f_and eq pre) post tc in
180-
181- FApi. t_onall
182- (EcLowGoal. t_clears names)
183- (FApi. t_firsts (EcLowGoal. t_trivial ~keep: false ) 2 tc)
202+ tc
203+ |> EcPhlConseq. t_conseq (f_and eq pre) post
204+ @+ [discharge_pre; discharge_post; EcLowGoal. t_clears names]
184205 in
185206
186207 tc
0 commit comments