Skip to content

Commit 45bdcb5

Browse files
committed
Replace >>= with let ...
1 parent 3c4721e commit 45bdcb5

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Iris/Iris/ProofMode/Tactics/Inv.lean

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ open Lean Elab Tactic Meta Qq BI Std
6060
and pattern matching (`match … with …`).
6161
-/
6262
private def reduceWandM (e : Expr) : ProofModeM Expr := do
63-
#[``BIBase.wandM, ``Option.getD].foldlM (·.addDeclToUnfold ·) {} >>=
64-
(Simp.mkContext {} #[·] (← getSimpCongrTheorems) >>= (Lean.Meta.dsimp e · <&> Prod.fst))
63+
let simpThms ← #[``BIBase.wandM, ``Option.getD].foldlM (·.addDeclToUnfold ·) {}
64+
let simpContext ← Simp.mkContext {} #[simpThms] (← getSimpCongrTheorems)
65+
Lean.Meta.dsimp e simpContext <&> Prod.fst
6566

6667
private def iInvCore {u} {prop : Q(Type u)} {bi} {e}
6768
(hyps : Hyps bi e) (goal : Q($prop)) (ivar : IVarId) (specPat : Option SpecPat)
@@ -100,17 +101,17 @@ private def iInvCore {u} {prop : Q(Type u)} {bi} {e}
100101
withLocalDeclDQ (← mkFreshUserName .anonymous) X fun x => do
101102
match closePat with
102103
| some closePat =>
103-
iCasesCore _ hyps'' q($Q'' $x) (.conjunction [casesPat, closePat])
104-
q(false) q(iprop($Pout' $x ∗ $f' $x)) >>=
105-
(mkLambdaFVars #[x] ·)
104+
let pf' ← iCasesCore _ hyps'' q($Q'' $x) (.conjunction [casesPat, closePat])
105+
q(false) q(iprop($Pout' $x ∗ $f' $x))
106+
mkLambdaFVars #[x] pf'
106107
-- Throw an error if `hclose` is not given, but `mPclose` is not `none`
107108
| none => throwError "iinv: missing cases pattern for the closing hypothesis"
108109
return q(tac_inv_elim $inst $hϕ $pf $pfEq $pfPin)
109110
| ~q(none) =>
110111
let pf : Q(∀ x, $e'' ∗ $Pout x ⊢ $Q' x) ←
111112
withLocalDeclDQ (← mkFreshUserName .anonymous) X fun x => do
112-
iCasesCore _ hyps'' q($Q'' $x) casesPat q(false) q($Pout' $x) >>=
113-
(mkLambdaFVars #[x] ·)
113+
let pf' ← iCasesCore _ hyps'' q($Q'' $x) casesPat q(false) q($Pout' $x)
114+
mkLambdaFVars #[x] pf'
114115
return q(tac_inv_elim $inst $hϕ $pf $pfEq $pfPin)
115116

116117
syntax (name := iinv) "iinv " colGt term (" $$ " colGt ppSpace specPat)?

0 commit comments

Comments
 (0)