Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
ff8a1e4
refactor: make SelTarget type an distinct inductive type
ayhon May 7, 2026
8c8b59f
refactor: expose `irevert` as a metaprogramming API
ayhon May 11, 2026
e562c0b
refactor: expose `iintro` as a metaprogramming API
ayhon May 11, 2026
7374db7
refactor: expose `iapply` as a metaprogramming API
ayhon May 11, 2026
67986f9
feat: add `getDecl?` and `getUsername?` functions for `Hyps`
ayhon May 11, 2026
4b5bb60
feat: preliminary `iloeb` tactic implementation
ayhon May 11, 2026
65333f5
docs: extend `ihave` docstring on returned `hyps`
ayhon May 11, 2026
58da6e3
feat: add iloeb to the tactic prelude
ayhon May 11, 2026
018214c
doc: add copyright header comment in iloeb
ayhon May 11, 2026
0b22f6a
fix: imports and dangling reference
ayhon May 11, 2026
5cb6168
refactor: move `ProofModeM` methods to `ProofModeM.lean`
ayhon May 11, 2026
e6622e1
feat: add tests
ayhon May 11, 2026
d8e847e
chore: add TODO justification for opinionated change
ayhon May 11, 2026
c875bdc
fix: `uniq` is now `ivar`
ayhon May 11, 2026
5657c05
refactor: have `iRevertCore` accept a continuation
ayhon May 13, 2026
ba34106
refactor: have `iIntroCore` accept a continuation
ayhon May 13, 2026
8913e35
fix: remove `ProofModeTactic` definition
ayhon May 13, 2026
9b9f425
fix: uniq is now ivar
ayhon May 13, 2026
1672ec6
feat: simplify `iloeb` using continuations
ayhon May 13, 2026
b836417
test: warning when generalizing over spatial hypothesis
ayhon May 13, 2026
2574cee
docs: add `Hyps` docstring explaining hidden invariants
ayhon May 13, 2026
d2a7782
fixup! refactor: make SelTarget type an distinct inductive type
ayhon May 13, 2026
ed9a85c
review: specialize assumption lemma for `iapply`
ayhon May 13, 2026
e9a9297
review: rename `SelId` constructors (`pm`→`ipm`, `lean`→`pure`)
ayhon May 13, 2026
8a70f42
review: BI instance doesn't change between tactics
ayhon May 13, 2026
b561b94
fixup! review: rename `SelId` constructors (`pm`→`ipm`, `lean`→`pure`)
ayhon May 13, 2026
7e6e543
fixup! review: BI instance doesn't always change between tactics
ayhon May 13, 2026
c7c09ac
review: add persistence information in `SelTarget`
ayhon May 13, 2026
4b69bd6
review: remove stale definitions
ayhon May 13, 2026
02f35ed
review: add negative test when no BILoeb instance is available using …
ayhon May 13, 2026
678a03c
refactor: push `persistent?` in `SelTarget` inside `ìpm`
ayhon May 13, 2026
a55e95f
fix: warnings
ayhon May 13, 2026
1638a59
feat: add WeakestPre notation
ayhon May 6, 2026
6f4e724
wip
ayhon May 7, 2026
04858f5
feat: preliminary Texan triple syntax
ayhon May 13, 2026
393e4bf
fix: move WeakestPre BI definitions under the Iris namespace
ayhon May 15, 2026
3f23865
refactor: small opinionated improvements
ayhon May 15, 2026
3a2c745
refactor: qol improvements, use `iframe` and `iloeb` in some proofs
ayhon May 15, 2026
80a3dbe
feat: add stuckness_to_atomicity
ayhon May 15, 2026
49230dc
feat: wp_atomic
ayhon May 15, 2026
727abd0
feat: wp_credit_access
ayhon May 15, 2026
c2c2662
fix: IProp is Leibnitz!
ayhon May 15, 2026
5f406b0
fix: non-terminal simps only
ayhon May 15, 2026
72c3df2
feat: wp_step_fupdN_strong
ayhon May 15, 2026
fa016f4
feat: wp_bind
ayhon May 15, 2026
cd7697d
feat: wp_bind_inv
ayhon May 15, 2026
324c252
feat: wp_mono
ayhon May 15, 2026
9f0a63e
fix: simplify proofs, using UPred being Leibnitz
ayhon May 15, 2026
c1433aa
feat: wp_value
ayhon May 15, 2026
e1f8c77
feat: wp_frame_{l,r}
ayhon May 15, 2026
be16c9a
feat: wp_step_fupdN
ayhon May 15, 2026
b4745d7
feat: wp_frame_step_{l,r}
ayhon May 15, 2026
c76b3bf
feat: wp_wand
ayhon May 15, 2026
e7efdcf
fix: add Stuckness order theorems
ayhon May 15, 2026
8f790c7
feat: add proof mode classes
ayhon May 15, 2026
b6eee98
refactor: rename `wp_expr` to `wpExpr`
ayhon May 15, 2026
000565d
feat: add copyright header
ayhon May 15, 2026
17d9196
Merge branch 'master' into fele/feat/add-weakestpre
ayhon May 18, 2026
d977403
fix: remove infos
ayhon May 18, 2026
415d091
chore: clean up file
ayhon May 18, 2026
6fb81d3
pass over BI
Kaptch May 19, 2026
b6ac945
refactor: commute addition so it plays nicer with defeq
ayhon May 18, 2026
0d918de
fix: remove left over code from merge
ayhon May 20, 2026
3bbfe06
smaller tokens for wp
Kaptch May 20, 2026
15b1a20
feat: add `rocq_alias`
ayhon May 20, 2026
ca7d84c
pass over program logic
Kaptch May 20, 2026
0a8e646
Merge remote-tracking branch 'upstream/master' into pr/ayhon/393
Kaptch May 20, 2026
f059f0b
chore: cleanup updates
markusdemedeiros May 20, 2026
8a76076
minor: wp line length
markusdemedeiros May 20, 2026
f10221a
chore: cleanup in WeakestPre
markusdemedeiros May 20, 2026
357244e
Merge branch 'master' into fele/feat/add-weakestpre
ayhon May 20, 2026
22fe3e6
fix delab bug, minor nits
Kaptch May 21, 2026
f54a7c6
todo icombine
Kaptch May 21, 2026
bddadc5
fix: allow `State` to not be `semiOutParam`
ayhon May 21, 2026
6df094f
fix: remove redundant implicit_reducible
ayhon May 21, 2026
92bb4bf
porting
Kaptch May 21, 2026
cea10ed
add test for irevert change
MackieLoeffel May 21, 2026
3a8adb1
add missing line
MackieLoeffel May 21, 2026
a2875b7
rm missed file
Kaptch May 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Iris/Iris/Algebra/OFE.lean
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ infixr:25 " -c> " => ContractiveHom
instance [OFE α] [OFE β] : CoeFun (α -c> β) (fun _ => α → β) := ⟨fun x => x.toHom.f⟩
instance [OFE α] [OFE β] (f : α -c> β) : Contractive f := f.contractive

def _root_.Function.toContractiveHom (f : α → β) [OFE α] [OFE β] [ι : OFE.Contractive f] : α -c> β where
f := f
contractive := ι

@[simp] theorem _root_.Function.toContractiveHom_apply {f : α → β} [OFE α] [OFE β] [ι : OFE.Contractive f] {x} :
f.toContractiveHom x = f x := by rfl

theorem InvImage.equivalence {α : Sort u} {β : Sort v}
{r : β → β → Prop} {f : α → β} (H : Equivalence r) : Equivalence (InvImage r f) where
refl _ := H.refl _
Expand Down Expand Up @@ -1770,4 +1777,3 @@ theorem OFE.cast_dist [Iα : OFE α] [Iβ : OFE β] {x y : α}
(Ht : α = β) (HIt : Iα = Ht ▸ Iβ) (H : x ≡{n}≡ y) :
(Ht ▸ x) ≡{n}≡ (Ht ▸ y) := by
subst Ht; subst HIt; exact H

99 changes: 89 additions & 10 deletions Iris/Iris/BI/Updates.lean
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class BIUpdate (PROP : Type _) [BI PROP] extends BUpd PROP where
frame_r {P R : PROP} : (|==> P) ∗ R ⊢ |==> (P ∗ R)

class BIFUpdate (PROP : Type _) [BI PROP] extends FUpd PROP where
[ne {E1 E2 : CoPset} : OFE.NonExpansive (FUpd.fupd E1 E2 (PROP := PROP))]
[ne {E1 E2 : CoPset} : OFE.NonExpansive (iprop(|={E1,E2}=> · : PROP))]
subset {E1 E2 : CoPset} : E2 ⊆ E1 → ⊢ |={E1,E2}=> |={E2,E1}=> (emp : PROP)
except0 {E1 E2 : CoPset} {P : PROP} : (◇ |={E1,E2}=> P) ⊢ |={E1,E2}=> P
mono {E1 E2 : CoPset} {P Q : PROP} : (P ⊢ Q) → (|={E1,E2}=> P) ⊢ |={E1,E2}=> Q
Expand Down Expand Up @@ -200,25 +200,32 @@ variable [BI PROP] [BIFUpdate PROP]

open BIFUpdate LawfulSet

theorem fupd_mask_intro_subseteq {E1 E2 : CoPset} {P : PROP} : E2 ⊆ E1 → P ⊢ |={E1,E2}=> |={E2,E1}=> P :=
λ h => (emp_sep.2.trans <| sep_mono_l <| subset h).trans <|
theorem fupd_mask_intro_subseteq {E1 E2 : CoPset} {P : PROP} (h : E2 ⊆ E1) :
P ⊢ |={E1,E2}=> |={E2,E1}=> P :=
(emp_sep.2.trans <| sep_mono_l <| subset h).trans <|
frame_r.trans <| mono <| frame_r.trans <| mono emp_sep.1

@[rocq_alias fupd_mask_subseteq]
theorem fupd_mask_subseteq {E1 E2 : CoPset} (h : E2 ⊆ E1) : ⊢@{PROP} |={E1,E2}=> |={E2,E1}=> emp :=
fupd_mask_intro_subseteq h

theorem fupd_intro {E : CoPset} {P : PROP} : P ⊢ |={E}=> P :=
(fupd_mask_intro_subseteq λ _ => id).trans trans

-- Introduction lemma for a mask-chaging fupd
theorem fupd_mask_intro {E1 E2 : CoPset} {P : PROP} :
E2 ⊆ E1 → ((|={E2,E1}=> emp) -∗ P) ⊢ |={E1,E2}=> P :=
λ h => (wand_mono_r fupd_intro).trans <|
theorem fupd_mask_intro {E1 E2 : CoPset} {P : PROP} (h : E2 ⊆ E1) :
((|={E2,E1}=> emp) -∗ P) ⊢ |={E1,E2}=> P :=
(wand_mono_r fupd_intro).trans <|
(emp_sep.2.trans <| sep_mono_l <| subset h).trans <|
frame_r.trans <| (mono wand_elim_r).trans trans

theorem fupd_mask_intro_discard {E1 E2 : CoPset} {P : PROP} [Absorbing P] : E2 ⊆ E1 → P ⊢ |={E1,E2}=> P :=
λ h => (wand_intro' sep_elim_r).trans <| fupd_mask_intro h
theorem fupd_mask_intro_discard {E1 E2 : CoPset} {P : PROP} [Absorbing P] (h : E2 ⊆ E1) :
P ⊢ |={E1,E2}=> P :=
(wand_intro' sep_elim_r).trans <| fupd_mask_intro h

theorem fupd_elim {E1 E2 E3 : CoPset} {P Q : PROP} : (Q ⊢ |={E2,E3}=> P) → (|={E1,E2}=> Q) ⊢ |={E1,E3}=> P :=
λ h => (mono h).trans trans
theorem fupd_elim {E1 E2 E3 : CoPset} {P Q : PROP} (h : Q ⊢ |={E2,E3}=> P) :
(|={E1,E2}=> Q) ⊢ |={E1,E3}=> P :=
(mono h).trans trans

theorem fupd_frame_l {E1 E2 : CoPset} {P Q : PROP} : P ∗ (|={E1,E2}=> Q) ⊢ |={E1,E2}=> P ∗ Q :=
sep_symm.trans <| frame_r.trans <| mono sep_symm
Expand Down Expand Up @@ -311,6 +318,78 @@ variable [BI PROP] [BIFUpdate PROP]

open BIFUpdate LawfulSet

theorem step_fupdN_contractive {E1 E2 : CoPset} {n : Nat} [ι : BILaterContractive PROP] :
OFE.Contractive (iprop(|={E1}[E2]▷=>^[n + 1] · : PROP)) where
distLater_dist {i x y} xy_i := by
induction n with
| zero => exact ne.ne (ι.distLater_dist (ne.ne <| xy_i · ·))
| succ n IH => exact ne.ne (later_ne.ne (ne.ne IH))

theorem step_fupdN_ne {E1 E2 : CoPset} {n : Nat} :
OFE.NonExpansive (iprop(|={E1}[E2]▷=>^[n] · : PROP)) where
ne {i x y} xy_i := by
induction n with
| zero => simp [Nat.repeat, xy_i]
| succ n IH => exact ne.ne (later_ne.ne (ne.ne IH))

@[rocq_alias step_fupdN_wand]
theorem step_fupdN_wand {Eo Ei : CoPset} {n : Nat} {P Q : PROP} :
(|={Eo}[Ei]▷=>^[n] P) ⊢ (P -∗ Q) -∗ (|={Eo}[Ei]▷=>^[n] Q) := by
refine wand_intro' ?_
induction n with
| zero =>
exact wand_elim_l
| succ n IH =>
calc iprop((P -∗ Q) ∗ |={Eo,Ei}=> ▷ |={Ei,Eo}=> _)
_ ⊢ |={Eo,Ei}=> (P -∗ Q) ∗ ▷ |={Ei,Eo}=> _ := (fupd_frame_l ..)
_ ⊢ |={Eo,Ei}=> (▷ (P -∗ Q)) ∗ ▷ |={Ei,Eo}=> _ := mono (sep_mono (later_intro) .rfl)
_ ⊢ |={Eo,Ei}=> ▷ ((P -∗ Q) ∗ |={Ei,Eo}=> _) := mono (later_sep.2)
_ ⊢ |={Eo,Ei}=> ▷ |={Ei,Eo}=> ((P -∗ Q) ∗ _) := mono (later_mono (fupd_frame_l ..))
_ ⊢ |={Eo,Ei}=> ▷ |={Ei,Eo}=> _ := mono (later_mono (mono IH))

@[rocq_alias step_fupd_wand]
theorem step_fupd_wand {Eo Ei : CoPset} {P Q : PROP} :
(|={Eo}[Ei]▷=> P) ⊢ (P -∗ Q) -∗ (|={Eo}[Ei]▷=> Q) :=
step_fupdN_wand (n := 1)

@[rocq_alias step_fupd_mask_mono]
theorem step_fupd_mask_mono {Eo₁ Eo₂ Ei₁ Ei₂ : CoPset} {P : PROP}
(Ei₂_Ei₁ : Ei₂ ⊆ Ei₁) (Eo₁_Eo₂ : Eo₁ ⊆ Eo₂) :
(|={Eo₁}[Ei₁]▷=> P) ⊢ |={Eo₂}[Ei₂]▷=> P := by
refine emp_sep.2.trans ?_
refine (sep_mono (fupd_mask_intro_subseteq Eo₁_Eo₂) .rfl).trans ?_
refine fupd_frame_r.trans ?_
refine BI.Entails.trans (mono ?_) (trans (E2 := Eo₁))
refine fupd_frame_l.trans ?_
refine BI.Entails.trans (mono ?_) (trans (E2 := Ei₁))
refine (sep_mono (fupd_mask_intro_subseteq Ei₂_Ei₁) .rfl).trans ?_
refine fupd_frame_r.trans ?_
refine mono ?_
refine (sep_mono later_intro .rfl).trans ?_
refine later_sep.2.trans ?_
refine later_mono ?_
refine fupd_frame_r.trans ?_
refine BI.Entails.trans (mono ?_) (trans (E2 := Ei₁))
refine fupd_frame_l.trans ?_
refine BI.Entails.trans (mono ?_) (trans (E2 := Eo₁))
refine fupd_frame_r.trans ?_
exact mono emp_sep.1

@[rocq_alias step_fupd_intro]
theorem step_fupd_intro {Ei Eo : CoPset} {P : PROP} (Ei_Eo : Ei ⊆ Eo) :
▷ P ⊢ |={Eo}[Ei]▷=> P := by
calc iprop(▷ P)
_ ⊢ |={Ei}=> ▷ P := fupd_intro
_ ⊢ |={Ei}[Ei]▷=> P := mono <| later_mono fupd_intro
_ ⊢ |={Eo}[Ei]▷=> P := step_fupd_mask_mono (subset_refl) Ei_Eo

@[rocq_alias step_fupdN_le]
theorem step_fupdN_le {n m : Nat} {Eo Ei : CoPset} {P : PROP} :
n ≤ m → Ei ⊆ Eo → (|={Eo}[Ei]▷=>^[n] P) ⊢ |={Eo}[Ei]▷=>^[m] P
| .refl, _ => .rfl
| .step (m := m) n_m, Ei_Eo =>
step_fupdN_le n_m Ei_Eo |>.trans (later_intro.trans (step_fupd_intro Ei_Eo))

@[rocq_alias step_fupd_fupd]
theorem step_fupd_fupd {Eo Ei : CoPset} {P : PROP} : (|={Eo}[Ei]▷=> P) ⊣⊢ (|={Eo}[Ei]▷=> |={Eo}=> P) :=
⟨mono <| later_mono <| mono fupd_intro, mono <| later_mono BIFUpdate.trans⟩
Expand Down
146 changes: 146 additions & 0 deletions Iris/Iris/BI/WeakestPre.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
module

public import Iris.Std.CoPset
public import Iris.BI
public meta import Iris.BI
public import Iris.BI.BIBase
public meta import Iris.Std.Rewrite
public import Std
meta import Lean
public import Lean

public import Iris.BI.BI
public import Iris.BI.Classes
public import Iris.BI.DerivedLaws
public import Iris.BI.DerivedLawsLater
public import Iris.BI.Extensions
public import Iris.BI.SIProp
public meta import Iris.Std.RocqPorting

public section

namespace Iris

open Lean

inductive Stuckness where
| NotStuck
| MaybeStuck

namespace Stuckness

@[simp]
instance instLE: LE Stuckness where
le x y := ¬ (x = .MaybeStuck ∧ y = .NotStuck)

instance : Std.IsPreorder Stuckness where
le_refl := by grind only [Stuckness, LE.le, instLE]
le_trans := by grind only [Stuckness, LE.le, instLE]

@[simp] theorem le_MaybeStuck {s : Stuckness} : s ≤ MaybeStuck := by
cases s <;> grind only [Stuckness, LE.le, instLE]

@[simp] theorem NotSuck_le {s : Stuckness} : NotStuck ≤ s := by
cases s <;> grind only [Stuckness, LE.le, instLE]

end Stuckness

class Wp (PROP Expr : Type _) (Val : outParam (Type _)) (A : Type _) where
wp : A → CoPset → Expr → (Val → PROP) → PROP

class TotalWP (PROP Expr) (Val : outParam (Type _)) (A : Type _) where
totalWp : A → CoPset → Expr → (Val → PROP) → PROP

syntax wpExpr :=
term:max (" @ " term:max (" ; " term:max) <|> ((" ? ")? )) <|> (" ? ")?

declare_syntax_cat wpPostcondInner
syntax ident ", " term : wpPostcondInner
syntax term : wpPostcondInner

declare_syntax_cat wpPostcond
-- Avoids conflicts with
-- example {a : PUnit.{i}} : PUnit.{i} := a
-- ^^
-- see: https://github.com/leanprover-community/iris-lean/pull/393
syntax " {" "{ " wpPostcondInner " }" "} " : wpPostcond
syntax " [" "{ " wpPostcondInner " }" "] " : wpPostcond
Comment thread
ayhon marked this conversation as resolved.
syntax " ⦃ " wpPostcondInner " ⦄ " : wpPostcond
syntax " 〖 " wpPostcondInner " 〗 " : wpPostcond

syntax (name := wp) "WP " wpExpr wpPostcond : term

open Lean in
meta def parseWpExpr : Lean.TSyntax ``wpExpr → Lean.MacroM (TSyntax `term × TSyntax `term × TSyntax `term) := fun
| `(wpExpr| $e @ $s ; $E) =>
return (e, s, E)
| `(wpExpr| $e @ $E) =>
return (e, ←`(Stuckness.NotStuck), E)
| `(wpExpr| $e @ $E ?) =>
return (e, ←`(Stuckness.MaybeStuck), E)
| `(wpExpr| $e:term) =>
return (e, ←`(Stuckness.NotStuck), ←`(⊤))
| `(wpExpr| $e:term ?) =>
return (e, ←`(Stuckness.MaybeStuck), ←`(⊤))
| _ => Lean.Macro.throwUnsupported

open Lean in
meta def parseWpPostcondInner (stx : TSyntax `wpPostcondInner) : MacroM (TSyntax `term) := do
match stx with
| `(wpPostcondInner| $v:ident, $Φ:term) => `(fun $v => iprop($Φ))
| `(wpPostcondInner| $Φ:term) => return iprop(Φ)
| _ => Macro.throwUnsupported

open Lean in
meta def parseWpPostcond (stx : TSyntax `wpPostcond) : MacroM (TSyntax `term × Bool) := do
match stx with
| `(wpPostcond| {{ $inner:wpPostcondInner }})
| `(wpPostcond| ⦃ $inner:wpPostcondInner ⦄) =>
return (←parseWpPostcondInner inner, false)
| `(wpPostcond| [{ $inner:wpPostcondInner }])
| `(wpPostcond| 〖 $inner:wpPostcondInner 〗) =>
return (←parseWpPostcondInner inner, true)
| _ => Macro.throwUnsupported (α := TSyntax `term × Bool)

@[macro wp]
meta def wpMacro : Lean.Macro := fun stx => do
match stx with
| `(WP $expr $postcond) =>
let (e, s, E) ← parseWpExpr expr
let (Φ, useTotal?) ← parseWpPostcond postcond
if useTotal? then
`(TotalWP.totalWp $s $E $e $Φ)
else
`(Wp.wp $s $E $e $Φ)
| _ => Lean.Macro.throwUnsupported

meta def unexpandWpPostcondInner : TSyntax `term → PrettyPrinter.UnexpandM (TSyntax `wpPostcondInner)
| `(fun $v:ident => iprop($Φ:term)) => `(wpPostcondInner|$v:ident, $Φ:term)
| `(iprop($Φ:term)) => `(wpPostcondInner| $Φ:term)
| `(fun $v:ident => $Φ:term) => `(wpPostcondInner|$v:ident, $Φ:term)
| `($Φ:term) => `(wpPostcondInner| $Φ:term)

open Lean in
meta def makeWpExpr (s E e : TSyntax `term) : PrettyPrinter.UnexpandM (TSyntax ``wpExpr) := do
match s, E with
| `(Stuckness.NotStuck), `(⊤) => `(wpExpr| $e:term)
| `(Stuckness.NotStuck), E => `(wpExpr| $e:term @ $E:term)
| `(Stuckness.MaybeStuck), `(⊤) => `(wpExpr| $e:term ?)
| `(Stuckness.MaybeStuck), E => `(wpExpr| $e:term @ $E:term ?)
| s, E => `(wpExpr| $e:term @ $s:term ; $E:term)

@[app_unexpander Wp.wp]
meta def unexpanderWp : PrettyPrinter.Unexpander
| `($_wp $s $E $e $Φ) => do
let wpExpr ← makeWpExpr s E e
let wpPostcondInner ← unexpandWpPostcondInner Φ
`(WP $wpExpr {{ $wpPostcondInner }})
| _ => throw ()

@[app_unexpander TotalWP.totalWp]
meta def unexpanderTotalWp : PrettyPrinter.Unexpander
| `($_wp $s $E $e $Φ) => do
let wpExpr ← makeWpExpr s E e
let wpPostcondInner ← unexpandWpPostcondInner Φ
`(WP $wpExpr [{ $wpPostcondInner }])
| _ => throw ()
7 changes: 7 additions & 0 deletions Iris/Iris/HeapLang/Notation.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Authors: Michael Sammler
module

public import Iris.HeapLang.Syntax
public meta import Lean.PrettyPrinter.Parenthesizer

public meta section
namespace Iris.HeapLang
Expand Down Expand Up @@ -149,6 +150,12 @@ syntax:100 "fork(" hl_exp ")" : hl_exp
/-- assert -/
syntax:100 "assert(" hl_exp ")" : hl_exp

open Lean.PrettyPrinter.Parenthesizer in
@[category_parenthesizer hl_exp]
def hl_exp.parenthesizer : CategoryParenthesizer := fun prec => do
maybeParenthesize `hl_exp false (fun stx => Unhygienic.run `(hl_exp|($(⟨stx⟩)))) prec <|
parenthesizeCategoryCore `hl_exp prec

partial def unpackHLExp [Monad m] [MonadRef m] [MonadQuotation m] : Term → m (TSyntax `hl_exp)
| `(hl($e)) => `(hl_exp|$e)
| `($t) => `(hl_exp|{$t})
Expand Down
3 changes: 3 additions & 0 deletions Iris/Iris/Instances/IProp/Instance.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ namespace Iris

open COFE

@[ext]
theorem IProp.ext {P Q : IProp GF} : P ⊣⊢ Q → P = Q := OFE.Leibniz.eq_of_eqv ∘ BI.equiv_iff.mpr

/-- Apply an OFunctor at a fixed type -/
abbrev COFE.OFunctorPre.ap (F : OFunctorPre) (T : Type _) [OFE T] :=
F T T
Expand Down
5 changes: 2 additions & 3 deletions Iris/Iris/Instances/Lib/LaterCredits.lean
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ section Operations

variable {GF : BundledGFunctors} [LC : LcGS GF]

theorem lc_split {n m} : £ (n + m) ⊣⊢@{IProp GF} £ n ∗ £ m := by
theorem lc_split {n m} : £ (n + m) ⊣⊢@{IProp GF} £ n ∗ £ m :=
-- FIXME: Timeout on iOwn_op. Why?
refine .trans ?_ iOwn_op
exact .rfl
iOwn_op (E := LC.lc_elem) (a1 := ◯ n) (a2 := ◯ m)

@[rocq_alias lc_zero]
theorem lc_zero : ⊢@{IProp GF} |==> £ 0 := iOwn_unit (ε := UCMRA.unit)
Expand Down
Loading