Skip to content

Commit d5cffc7

Browse files
fix: ihave and iapply do not synthesize all tc (#159)
* fix: ihave and iapply do not synthesize all tc --------- Co-authored-by: Michael Sammler <noreply@sammler.me>
1 parent 24138a1 commit d5cffc7

3 files changed

Lines changed: 10 additions & 17 deletions

File tree

src/Iris/BI/Lib/Fixpoint.lean

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ instance least_fixpoint_absorbing [BIMonoPred F]
8585
letI _ : NonExpansive fun x => iprop(True -∗ bi_least_fixpoint F x) :=
8686
fun _ _ _ H => wand_ne.ne .rfl (NonExpansive.ne H)⟩
8787
iapply least_fixpoint_iter
88-
· infer_instance -- FIXME: Issue #156
8988
iintro !> %y HF HT
9089
iapply least_fixpoint_unfold
91-
· infer_instance -- FIXME: Issue #156
9290
iapply mono_pred (Φ := (fun x : A => iprop(True -∗ bi_least_fixpoint F x))) $$ [], [HF, HT]
9391
· iintro !> %x HF
9492
iapply HF
@@ -106,10 +104,8 @@ instance least_fixpoint_persistent_affine [BIMonoPred F]
106104
letI _ : NonExpansive fun x => iprop(□ bi_least_fixpoint F x) :=
107105
fun _ _ _ H => intuitionistically_ne.ne (NonExpansive.ne H)⟩
108106
iapply least_fixpoint_iter
109-
· infer_instance -- FIXME: Issue #156
110107
iintro !> %y #HY !>
111108
iapply least_fixpoint_unfold
112-
· infer_instance -- FIXME: Issue #156
113109
iapply mono_pred (Φ := fun x => iprop(□ bi_least_fixpoint F x))
114110
· iintro !> %_ #Hx
115111
iexact Hx
@@ -124,10 +120,8 @@ instance least_fixpoint_persistent_absorbing [BIMonoPred F]
124120
letI _ : NonExpansive fun x => iprop(<pers> bi_least_fixpoint F x) :=
125121
fun _ _ _ H => persistently_ne.ne <| NonExpansive.ne H⟩
126122
iapply least_fixpoint_iter
127-
· infer_instance -- FIXME: Issue #156
128123
iintro !> %y #HF !>
129124
iapply least_fixpoint_unfold
130-
· infer_instance -- FIXME: Issue #156
131125
iapply mono_pred (Φ := fun x => iprop(<pers> bi_least_fixpoint F x)) $$ [], HF
132126
letI _ := @least_fixpoint_absorbing _ _ _ _ _ _ Habsorb
133127
iintro !> %x #H
@@ -137,10 +131,8 @@ theorem least_fixpoint_strong_mono (G : (A → PROP) → (A → PROP)) [BIMonoPr
137131
⊢ □ (∀ Φ x, F Φ x -∗ G Φ x) -∗ ∀ x, bi_least_fixpoint F x -∗ bi_least_fixpoint G x := by
138132
iintro #Hmon
139133
iapply least_fixpoint_iter
140-
· infer_instance -- FIXME: Issue #156
141134
iintro !> %y IH
142135
iapply least_fixpoint_unfold
143-
· infer_instance -- FIXME: Issue #156
144136
iapply Hmon $$ IH
145137

146138
section Strong
@@ -169,18 +161,15 @@ theorem least_fixpoint_ind_wf :
169161
· iintro H1 H2
170162
iapply H1
171163
iapply least_fixpoint_unfold
172-
· infer_instance
173164
iexact H2
174165
iapply Hthis
175166
iintro HF
176167
iapply HM
177168
iapply mono_pred (Φ := (bi_least_fixpoint F)) $$ [], HF
178169
imodintro
179170
iapply least_fixpoint_iter
180-
· infer_instance -- FIXME: Issue #156
181171
iintro !> %y Hy
182172
iapply least_fixpoint_unfold
183-
· exact wf_pred_mono (F := F) (Φ := Φ)
184173
isplit
185174
· iapply HM $$ Hy
186175
· iexact Hy
@@ -190,8 +179,6 @@ theorem least_fixpoint_ind :
190179
∀ x, bi_least_fixpoint F x -∗ Φ x := by
191180
iintro #HM
192181
iapply least_fixpoint_ind_wf
193-
· infer_instance
194-
· infer_instance
195182
iintro !> %y Hy
196183
iapply HM
197184
letI _ : NonExpansive fun x => iprop(Φ x ∧ bi_least_fixpoint F x) :=
@@ -202,7 +189,6 @@ theorem least_fixpoint_ind :
202189
· iclear HM
203190
exact (least_fixpoint_unfold_1 ..).trans and_elim_l
204191
· iapply least_fixpoint_strong_mono $$ [], Hx
205-
· infer_instance
206192
iintro !> %_ %_ ⟨-, H⟩
207193
iexact H
208194

src/Iris/ProofMode/ProofModeM.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/-
22
Copyright (c) 2025 Michael Sammler. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Michael Sammler
4+
Authors: Michael Sammler, Zongyuan Liu
55
-/
66
import Iris.ProofMode.Expr
77
import Iris.ProofMode.Classes
@@ -90,7 +90,7 @@ def ProofModeM.runTactic (x : MVarId → IrisGoal → ProofModeM α) (s : ProofM
9090
let (res, {goals}) ← StateRefT'.run (x mvar g) s
9191

9292
-- make sure to synthesize everything postponed
93-
Term.synthesizeSyntheticMVarsNoPostponing
93+
Term.synthesizeSyntheticMVarsNoPostponing (ignoreStuckTC := true)
9494

9595
-- put the goals that depend on other goals last
9696
let dependees ← goals.foldlM (λ m g => do

src/Iris/ProofMode/Tactics/HaveCore.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/-
22
Copyright (c) 2025 Michael Sammler. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Michael Sammler
4+
Authors: Michael Sammler, Zongyuan Liu
55
-/
66
import Iris.ProofMode.Patterns.ProofModeTerm
77
import Iris.ProofMode.Tactics.Basic
@@ -55,6 +55,13 @@ private def iHaveCore {e} (hyps : @Hyps u prop bi e)
5555
let newMVarIds ← newMVars.map Expr.mvarId! |>.filterM fun mvarId => not <$> mvarId.isAssigned
5656
let otherMVarIds ← getMVarsNoDelayed val
5757
let otherMVarIds := otherMVarIds.filter (!newMVarIds.contains ·)
58+
59+
-- If the new mvars have type class assumption that could not be solved, register them such
60+
-- that they are tried to be solved again at the end of `ProofModeM.runTactic` (using Term.synthesizeSyntheticMVarsNoPostponing)
61+
for mvar in newMVars do
62+
if (← isSyntheticMVar mvar) && !(← mvar.mvarId!.isAssignedOrDelayedAssigned) then
63+
Term.registerSyntheticMVarWithCurrRef mvar.mvarId! (.typeClass .none)
64+
5865
for mvar in newMVarIds ++ otherMVarIds do
5966
addMVarGoal mvar
6067

0 commit comments

Comments
 (0)