Skip to content

Commit 74f8d29

Browse files
change to use GenMap OF
1 parent b758480 commit 74f8d29

File tree

3 files changed

+58
-16
lines changed

3 files changed

+58
-16
lines changed

src/Iris/Algebra/GenMap.lean

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,28 +183,68 @@ instance GenMapOF_instOFunctor (F : OFunctorPre) [OFunctor F] :
183183
OFunctor (GenMapOF Nat F) where
184184
cofe {A B _ _} := GenMap_instOFE Nat (F A B)
185185
map f₁ f₂ := GenMap.lift <| OFunctor.map (F := F) f₁ f₂
186-
map_ne.ne := sorry -- _ _ _ Hx _ _ Hy _ _ := by apply OFunctor.map_ne.ne Hx Hy
187-
map_id := by sorry
188-
map_comp := sorry -- by apply OFunctor.map_comp
186+
map_ne.ne {n x1 x2} Hx {y1 y2} Hy k γ := by
187+
simp only [OFE.Dist, Option.Forall₂, Option.map]
188+
cases _ : k.car γ <;> simp
189+
exact OFunctor.map_ne.ne Hx Hy _
190+
map_id {α β _ _} x γ := by
191+
simp only [Option.map]
192+
cases _ : x.car γ <;> simp
193+
exact OFunctor.map_id _
194+
map_comp _ _ _ _ x γ := by
195+
simp only [Option.map]
196+
cases _ : x.car γ <;> simp
197+
exact OFunctor.map_comp _ _ _ _ _
189198

190199
instance GenMapOF_instURFunctor (F : COFE.OFunctorPre) [RFunctor F] :
191200
URFunctor (GenMapOF Nat F) where
192201
map f g := {
193202
toHom := GenMap.lift <| COFE.OFunctor.map f g
194-
validN hv := by
195-
let X := RFunctor.map (F := F) f g
196-
dsimp [GenMap.lift]
197-
sorry -- (URFunctor.map f g).validN (hv _)
198-
pcore := sorry -- simpa [CMRA.pcore_eq_core] using (URFunctor.map f g).pcore _
199-
op _ := sorry -- (URFunctor.map f g).op _ _
203+
validN {n x} hv := by
204+
rcases hv with ⟨hv, ⟨e, Hf, Hi⟩⟩
205+
refine ⟨fun z => ?_, ⟨e, @fun n => ?_, Hi⟩⟩
206+
· cases h : x.car z <;> simp [Option.map, CMRA.ValidN, optionValidN, h]
207+
rename_i _ α₁ α₂ β₁ β₂ _ _ _ _ v
208+
let Hvalid := @(URFunctor.map (F := OptionOF F) f g).validN n v
209+
simp [CMRA.ValidN, optionValidN, h, URFunctor.map] at Hvalid
210+
specialize Hvalid ?_
211+
· specialize hv z
212+
simp [CMRA.ValidN, optionValidN] at hv
213+
simp [h] at hv
214+
exact hv
215+
exact Hvalid
216+
· specialize @Hf n
217+
simp [IsFree, Option.map] at Hf ⊢
218+
simp [Hf]
219+
pcore x γ := by
220+
let Hcore := @(URFunctor.map (F := OptionOF F) f g).pcore (x.car γ)
221+
simp [Option.map] at Hcore ⊢
222+
cases h : (x.car γ) <;> simp [CMRA.core, Option.getD, optionCore] at Hcore ⊢
223+
rename_i v
224+
simp [OFE.Equiv, Option.Forall₂, URFunctor.map, Option.bind, h, optionCore, OFunctor.map, optionMap, Option.map] at Hcore
225+
cases h' : CMRA.pcore v
226+
· simp_all [h']
227+
cases h'' : CMRA.pcore ((OFunctor.map f g).f v) <;> simp_all
228+
sorry
229+
· simp_all [h']
230+
sorry
231+
op z x γ := by
232+
let Hop := @(URFunctor.map (F := OptionOF F) f g).pcore (z.car γ)
233+
sorry -- (URFunctor.map f g).op _ _
200234
}
201235
map_ne.ne := sorry -- COFE.OFunctor.map_ne.ne
202236
map_id := sorry -- COFE.OFunctor.map_id
203237
map_comp := sorry -- COFE.OFunctor.map_comp
204238

205-
instance GenMapOF_instURFC {C} (F : COFE.OFunctorPre) [HURF : RFunctorContractive F] :
206-
URFunctorContractive (GenMapOF C F) := sorry
207-
-- map_contractive.1 h _ _ := URFunctorContractive.map_contractive.distLater_dist h _
239+
instance GenMapOF_instURFC (F : COFE.OFunctorPre) [HURF : RFunctorContractive F] :
240+
URFunctorContractive (GenMapOF Nat F) where
241+
map_contractive.1 h x n := by
242+
rename_i n x' y'
243+
let Heqv := @(URFunctorContractive.map_contractive (F := OptionOF F)).1 _ x' y' h (x.car n)
244+
simp [Function.uncurry, URFunctor.map, Option.map] at Heqv ⊢
245+
cases h : x.car n <;> simp
246+
rw [h] at Heqv
247+
exact Heqv
208248

209249
end OFunctors
210250

src/Iris/Algebra/IProp.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ abbrev IProp := UPred (IResUR GF)
5555
-- def IProp.unfold : IProp GF -n> IPre GF :=
5656
-- OFE.Iso.hom <| OFunctor.Fix.iso (F := (UPredOF (IResF GF)))
5757

58-
def IProp.unfold :=
59-
OFE.Iso.hom <| OFunctor.Fix.iso (F := (UPredOF (IResF GF)))
58+
def IProp.unfold : IProp GF -n> IPre GF := sorry
59+
-- OFE.Iso.hom <| OFunctor.Fix.iso (F := (UPredOF (IResF GF)))
6060

61-
def IProp.fold : IPre GF -n> IProp GF :=
62-
OFE.Iso.inv <| OFunctor.Fix.iso (F := (UPredOF (IResF GF)))
61+
def IProp.fold : IPre GF -n> IProp GF := sorry
62+
-- OFE.Iso.inv <| OFunctor.Fix.iso (F := (UPredOF (IResF GF)))
6363

6464
end IProp
6565

src/Iris/Instances/IProp/Instance.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ theorem IProp.unfoldi_foldi (x : FF.api τ (IPre FF)) : unfoldi (foldi x) ≡ x
7070
refine .trans (OFunctor.map_comp (F := FF τ |>.fst) ..).symm ?_
7171
refine .trans ?_ (OFunctor.map_id (F := FF τ |>.fst) x)
7272
apply OFunctor.map_ne.eqv <;> intro _ <;> simp [IProp.unfold, IProp.fold]
73+
all_goals sorry
7374

7475
theorem IProp.proj_fold_unfold (x : FF.api τ (IProp FF)) : foldi (unfoldi x) ≡ x := by
7576
refine .trans (OFunctor.map_comp (F := FF τ |>.fst) ..).symm ?_
7677
refine .trans ?_ (OFunctor.map_id (F := FF τ |>.fst) x)
7778
apply OFunctor.map_ne.eqv <;> intro _ <;> simp [IProp.unfold, IProp.fold]
79+
all_goals sorry
7880

7981
end Fold
8082

0 commit comments

Comments
 (0)