Skip to content

Commit 02b090b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into SpecPats
2 parents 49a2fc0 + 3d3dfe0 commit 02b090b

120 files changed

Lines changed: 5266 additions & 2897 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ jobs:
8282
path: Iris/.lake
8383
- name: Read pinned Rocq commit
8484
id: rocq-commit
85-
run: echo "sha=$(cat scripts/ROCQ_REVISION)" >> "$GITHUB_OUTPUT"
85+
run: |
86+
sha=$(cat scripts/ROCQ_REVISION)
87+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
8688
- name: Cache Rocq definitions
8789
uses: actions/cache@v6
8890
with:

.github/workflows/check-stale.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ jobs:
2121
- name: Resolve Iris-Rocq master to a commit SHA
2222
id: rocq-commit
2323
run: |
24-
sha=$(curl -fsSL \
25-
"https://gitlab.mpi-sws.org/api/v4/projects/iris%2Firis/repository/commits/master" \
24+
set -euo pipefail
25+
url=$(python3 scripts/check_porting.py --print commit-api-url)
26+
sha=$(curl -fsSL "$url" \
2627
| python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
2728
echo "sha=$sha" >> "$GITHUB_OUTPUT"
2829

Iris/Iris/Algebra.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public import Iris.Algebra.COFESolver
66
public import Iris.Algebra.DFrac
77
public import Iris.Algebra.Excl
88
public import Iris.Algebra.Frac
9+
public import Iris.Algebra.Functions
910
public import Iris.Algebra.GenMap
1011
public import Iris.Algebra.LeibnizSet
1112
public import Iris.Algebra.LocalUpdates

Iris/Iris/Algebra/Agree.lean

Lines changed: 45 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ theorem sameElems_of_dist {x y : Raw α} (h : ∀ n, dist n x y) : SameElems x y
286286
have key : ∀ {x y : Raw α}, (∀ n, dist n x y) → ∀ a ∈ x.car, a ∈ y.car := by
287287
intro x y h a ha
288288
obtain ⟨b, hb, hd⟩ := exists_forall_dist (fun n => (h n).1 a ha)
289-
exact OFE.Equiv.to_eq (OFE.equiv_dist.mpr hd) ▸ hb
289+
exact OFE.eq_dist.mpr hd ▸ hb
290290
⟨key h, key (fun n => Raw.dist_equiv.symm (h n))⟩
291291

292292
end Agree.Raw
@@ -388,17 +388,17 @@ def valid : Agree α → Prop :=
388388
@[simp] theorem valid_mk {x : Raw α} : valid (mk x) ↔ x.valid := .rfl
389389

390390
@[rocq_alias agree_comm]
391-
theorem op_comm {x y : Agree α} : op x y op y x :=
392-
x.ind fun _ => y.ind fun _ => Raw.op_comm
391+
theorem op_comm {x y : Agree α} : op x y = op y x :=
392+
OFE.eq_dist.mpr (x.ind fun _ => y.ind fun _ => Raw.op_comm)
393393

394-
theorem op_commN {x y : Agree α} : op x y ≡{n}≡ op y x := op_comm n
394+
theorem op_commN {x y : Agree α} : op x y ≡{n}≡ op y x := op_comm.dist
395395

396396
@[rocq_alias agree_assoc]
397-
theorem op_assoc {x y z : Agree α} : op x (op y z) op (op x y) z :=
398-
x.ind fun _ => y.ind fun _ => z.ind fun _ => Raw.op_assoc
397+
theorem op_assoc {x y z : Agree α} : op x (op y z) = op (op x y) z :=
398+
OFE.eq_dist.mpr (x.ind fun _ => y.ind fun _ => z.ind fun _ => Raw.op_assoc)
399399

400-
theorem op_idemp {x : Agree α} : op x x x :=
401-
x.ind fun _ => Raw.idemp
400+
theorem op_idemp {x : Agree α} : op x x = x :=
401+
OFE.eq_dist.mpr (x.ind fun _ => Raw.idemp)
402402

403403
@[rocq_alias agree_validN_ne]
404404
theorem validN_ne {x y : Agree α} : x ≡{n}≡ y → validN n x → validN n y :=
@@ -417,15 +417,15 @@ theorem op_ne {x : Agree α} : OFE.NonExpansive (op x) :=
417417
@[rocq_alias agree_op_ne]
418418
theorem op_ne₂ : OFE.NonExpansive₂ (op (α := α)) := by
419419
refine ⟨fun {n} x₁ x₂ hx y₁ y₂ hy => ?_⟩
420-
exact op_ne.ne hy |>.trans (op_comm n) |>.trans (op_ne.ne hx) |>.trans (op_comm n)
420+
exact op_ne.ne hy |>.trans op_commN |>.trans (op_ne.ne hx) |>.trans op_commN
421421

422422
@[rocq_alias agree_op_invN]
423423
theorem op_invN {x y : Agree α} : validN n (op x y) → x ≡{n}≡ y :=
424424
x.ind fun _ => y.ind fun _ => Raw.op_invN
425425

426426
@[rocq_alias agree_op_inv]
427-
theorem op_inv {x y : Agree α} : valid (op x y) → x y :=
428-
x.ind fun _ => y.ind fun _ => Raw.op_inv
427+
theorem op_inv {x y : Agree α} : valid (op x y) → x = y :=
428+
x.ind fun _ => y.ind fun _ h => OFE.eq_dist.mpr (Raw.op_inv h)
429429

430430
@[rocq_alias agree_cmra_mixin]
431431
instance instCMRA : CMRA (Agree α) where
@@ -441,12 +441,12 @@ instance instCMRA : CMRA (Agree α) where
441441
assoc := op_assoc
442442
comm := op_comm
443443
pcore_op_left := fun {x cx} h => by obtain rfl := Option.some.inj h; exact op_idemp
444-
pcore_idem := fun {x cx} h => by obtain rfl := Option.some.inj h; exact .rfl
445-
pcore_op_mono := fun {x cx} h y => by obtain rfl := Option.some.inj h; exact ⟨y, .rfl⟩
444+
pcore_idem := fun {x cx} h => by obtain rfl := Option.some.inj h; exact rfl
445+
pcore_op_mono := fun {x cx} h y => by obtain rfl := Option.some.inj h; exact ⟨y, rfl⟩
446446
validN_op_left := validN_op_left
447447
extend {n x y₁ y₂ hval heq₁} := by
448448
have heq₂ := op_invN (validN_ne heq₁ hval)
449-
have heq₃ : op y₁ y₂ ≡{n}≡ y₁ := op_ne.ne heq₂.symm |>.trans (op_idemp n)
449+
have heq₃ : op y₁ y₂ ≡{n}≡ y₁ := op_ne.ne heq₂.symm |>.trans op_idemp.dist
450450
exact ⟨x, x, op_idemp.symm, heq₁.trans heq₃, heq₁.trans heq₃ |>.trans heq₂⟩
451451

452452
#rocq_ignore agreeR "Use the plain Agree type with a typeclass instance instead."
@@ -467,7 +467,7 @@ instance : CMRA.IsTotal (Agree α) where
467467
total x := ⟨x, rfl⟩
468468

469469
@[rocq_alias agree_idemp]
470-
theorem idemp {x : Agree α} : x • x x := op_idemp
470+
theorem idemp {x : Agree α} : x • x = x := op_idemp
471471

472472
#rocq_ignore agree_validN_proper "Derivable from Agree.validN_ne using NonExpansive.eqv"
473473
#rocq_ignore agree_op_proper "Derivable from Agree.op_ne₂ using NonExpansive₂.eqv"
@@ -476,41 +476,40 @@ theorem idemp {x : Agree α} : x • x ≡ x := op_idemp
476476

477477
@[rocq_alias agree_cmra_discrete]
478478
instance instCMRADiscrete [OFE.Discrete α] : CMRA.Discrete (Agree α) where
479-
discrete_0 {x y} := x.ind fun _ => y.ind fun _ => Raw.discrete_0
479+
discrete_0 {x y} := x.ind fun _ => y.ind fun _ h => OFE.eq_dist.mpr (Raw.discrete_0 h)
480480
discrete_valid {x} := x.ind fun _ => Raw.discrete_valid
481481

482482
instance instDiscrete [OFE.Discrete α] : OFE.Discrete (Agree α) where
483-
discrete_0 {x y} := x.ind fun _ => y.ind fun _ => Raw.discrete_0
483+
discrete_0 {x y} := x.ind fun _ => y.ind fun _ h => OFE.eq_dist.mpr (Raw.discrete_0 h)
484484

485485
@[rocq_alias agree_includedN]
486486
theorem includedN {x y : Agree α} : x ≼{n} y ↔ y ≡{n}≡ y • x := by
487487
refine ⟨fun ⟨z, h⟩ => ?_, fun h => ⟨y, h.trans op_commN⟩⟩
488488
calc
489489
y ≡{n}≡ x • z := h
490-
_ ≡{n}≡ (x • x) • z := .op_l (idemp.symm n)
490+
_ ≡{n}≡ (x • x) • z := .op_l idemp.symm.dist
491491
_ ≡{n}≡ x • (x • z) := CMRA.op_assocN.symm
492492
_ ≡{n}≡ x • y := h.symm.op_r
493493
_ ≡{n}≡ y • x := op_commN
494494

495495
@[rocq_alias agree_included]
496-
theorem included {x y : Agree α} : x ≼ y ↔ y ≡ y • x :=
497-
⟨fun ⟨z, h⟩ n => includedN.mp ⟨z, h n⟩, fun h => ⟨y, h.trans op_comm⟩⟩
496+
theorem included {x y : Agree α} : x ≼ y ↔ y = y • x :=
497+
⟨fun ⟨z, h⟩ => OFE.eq_dist.mpr fun _ => includedN.mp ⟨z, h.dist⟩,
498+
fun h => ⟨y, h.trans op_comm⟩⟩
498499

499500
@[rocq_alias agree_valid_includedN]
500501
theorem valid_includedN {x y : Agree α} : ✓{n} y → x ≼{n} y → x ≡{n}≡ y := by
501502
intro hval ⟨z, heq⟩
502503
calc
503-
x ≡{n}≡ x • x := .symm (idemp _)
504+
x ≡{n}≡ x • x := idemp.dist.symm
504505
_ ≡{n}≡ x • z := (op_invN <| heq.validN.mp hval).op_r
505506
_ ≡{n}≡ y := heq.symm
506507

507508
@[rocq_alias agree_valid_included]
508-
theorem valid_included {x y : Agree α} : ✓ y → x ≼ y → x y := by
509+
theorem valid_included {x y : Agree α} : ✓ y → x ≼ y → x = y := by
509510
intro hval ⟨z, heq⟩
510-
calc
511-
x ≡ x • x := idemp.symm
512-
_ ≡ x • z := .op_r <| op_inv <| (CMRA.valid_iff heq).mp hval
513-
_ ≡ y := heq.symm
511+
have hz : x = z := op_inv (heq ▸ hval : ✓ (x • z))
512+
rw [heq, ← hz, idemp]
514513

515514
set_option synthInstance.checkSynthOrder false in
516515
instance {x : Agree α} : IsOp d x x x where
@@ -538,9 +537,8 @@ theorem Agree.toAgree_injN {a b : α} : toAgree a ≡{n}≡ toAgree b → a ≡{
538537
Raw.toAgree_injN
539538

540539
@[rocq_alias to_agree_inj]
541-
theorem Agree.toAgree_inj {a b : α} : toAgree a ≡ toAgree b → a ≡ b := by
542-
simp only [OFE.equiv_dist]
543-
exact fun heq n => toAgree_injN (heq n)
540+
theorem Agree.toAgree_inj {a b : α} : toAgree a = toAgree b → a = b :=
541+
fun heq => OFE.eq_dist.mpr fun _ => toAgree_injN heq.dist
544542

545543
@[simp] theorem Agree.toAgree_validN {a : α} : ✓{n} toAgree a := Raw.toAgree_validN (a := a) (n := n)
546544

@@ -552,8 +550,8 @@ theorem Agree.toAgree_uninjN {x : Agree α} : ✓{n} x → ∃ a, toAgree a ≡{
552550
x.ind fun _ h => Raw.toAgree_uninjN h
553551

554552
@[rocq_alias to_agree_uninj]
555-
theorem Agree.toAgree_uninj {x : Agree α} : ✓ x → ∃ a, toAgree a x :=
556-
x.ind fun _ h => (Raw.toAgree_uninj h).imp fun _ h n => h n
553+
theorem Agree.toAgree_uninj {x : Agree α} : ✓ x → ∃ a, toAgree a = x :=
554+
x.ind fun _ h => (Raw.toAgree_uninj h).imp fun _ h => OFE.eq_dist.mpr fun n => h n
557555

558556
instance toAgree.ne : OFE.NonExpansive (toAgree : α → Agree α) := instNonExpansive_toAgree
559557

@@ -578,21 +576,18 @@ theorem toAgree_includedN {a b : α} : toAgree a ≼{n} toAgree b ↔ a ≡{n}
578576
· exists toAgree a
579577
calc
580578
toAgree b ≡{n}≡ toAgree a := OFE.NonExpansive.ne h.symm
581-
_ ≡{n}≡ toAgree a • toAgree a := .symm (idemp n)
579+
_ ≡{n}≡ toAgree a • toAgree a := idemp.dist.symm
582580

583581
@[simp, rocq_alias to_agree_included]
584-
theorem toAgree_included {a b : α} : toAgree a ≼ toAgree b ↔ a b := by
582+
theorem toAgree_included {a b : α} : toAgree a ≼ toAgree b ↔ a = b := by
585583
refine ⟨?_, ?_⟩ <;> intro h
586584
· exact toAgree_inj (valid_included (fun _ => trivial) h)
587585
· exists toAgree a
588586
calc
589-
toAgree b toAgree a := OFE.NonExpansive.eqv (OFE.Equiv.symm h)
590-
_ toAgree a • toAgree a := .symm (CMRA.pcore_op_left rfl)
587+
toAgree b = toAgree a := congrArg toAgree h.symm
588+
_ = toAgree a • toAgree a := (CMRA.pcore_op_left rfl).symm
591589

592-
@[simp, rocq_alias to_agree_included_L]
593-
theorem toAgree_included_L {a b : α} :
594-
toAgree a ≼ toAgree b ↔ a = b := by
595-
rw [toAgree_included]; exact ⟨OFE.Equiv.to_eq, OFE.Equiv.of_eq⟩
590+
#rocq_ignore to_agree_included_L "Use toAgree_included"
596591

597592
@[rocq_alias to_agree_op_validN]
598593
theorem toAgree_op_validN_iff_dist {a b : α} :
@@ -601,23 +596,22 @@ theorem toAgree_op_validN_iff_dist {a b : α} :
601596
· exact toAgree_injN (op_invN h)
602597
· have heqv : toAgree a • toAgree b ≡{n}≡ toAgree a := calc
603598
toAgree a • toAgree b ≡{n}≡ toAgree a • toAgree a := (OFE.NonExpansive.ne h).symm.op_r
604-
_ ≡{n}≡ toAgree a := idemp n
599+
_ ≡{n}≡ toAgree a := idemp.dist
605600
exact heqv.symm.validN.mp trivial
606601

607-
@[rocq_alias to_agree_op_valid]
608-
theorem toAgree_op_valid_iff_equiv {a : α} : ✓ (toAgree a • toAgree b) ↔ a ≡ b := by
609-
simp [OFE.equiv_dist, CMRA.valid_iff_validN, toAgree_op_validN_iff_dist]
602+
#rocq_ignore to_agree_op_valid "Use toAgree_op_valid_iff_eq"
610603

611604
@[rocq_alias to_agree_discrete]
612605
instance toAgree.is_discrete {a : α} [OFE.DiscreteE a] : OFE.DiscreteE (toAgree a) where
613-
discrete {y} := y.ind fun _ h n => Raw.toAgree_discrete h n
606+
discrete {y} := y.ind fun _ h => OFE.eq_dist.mpr (Raw.toAgree_discrete h)
614607

615608
end Agree
616609

617610
@[rocq_alias to_agree_op_valid_L]
618611
theorem toAgree_op_valid_iff_eq {a : α} :
619612
✓ (toAgree a • toAgree b) ↔ a = b := by
620-
rw [Agree.toAgree_op_valid_iff_equiv]; exact ⟨OFE.Equiv.to_eq, OFE.Equiv.of_eq⟩
613+
rw [OFE.eq_dist]
614+
simp [CMRA.valid_iff_validN, Agree.toAgree_op_validN_iff_dist]
621615

622616
#rocq_ignore to_agree_op_inv_L "Use toAgree_op_valid_iff_eq"
623617

@@ -660,8 +654,8 @@ def Agree.map : (Agree α) -C> (Agree β) where
660654
f := map' f
661655
ne := instNonExpansive_AgreeMap'
662656
validN {_n x} := x.ind fun _ => Raw.map'_validN
663-
pcore _ := .rfl
664-
op x y := x.ind fun _ => y.ind fun _ => .of_eq (congrArg mk Raw.map'_op)
657+
pcore _ := rfl
658+
op x y := x.ind fun _ => y.ind fun _ => congrArg mk Raw.map'_op
665659

666660
@[simp] theorem Agree.map_mk (f : α → β) [OFE.NonExpansive f] (x : Raw α) :
667661
Agree.map f (mk x) = mk (Raw.map' f x) := rfl
@@ -679,8 +673,8 @@ theorem Agree.map_ne {f g : α → β} [OFE.NonExpansive f] [OFE.NonExpansive g]
679673

680674
@[rocq_alias agree_map_ext]
681675
theorem Agree.agree_map_ext {f g : α → β} [OFE.NonExpansive f] [OFE.NonExpansive g] {x : Agree α}
682-
(H : ∀ a, f a g a) : map f x map g x :=
683-
OFE.equiv_dist.mpr fun _ => map_ne (H · |>.dist)
676+
(H : ∀ a, f a = g a) : map f x = map g x :=
677+
OFE.eq_dist.mpr fun _ => map_ne (H · |>.dist)
684678

685679
@[rocq_alias agree_map_id]
686680
theorem Agree.map_id (x : Agree α) : Agree.map id x = x :=
@@ -708,11 +702,10 @@ instance {F} [COFE.OFunctor F] : RFunctor (AgreeRF F) where
708702
map_ne.ne _ _ _ Hx _ _ Hy _ := Agree.map_ne <| COFE.OFunctor.map_ne.ne Hx Hy
709703
map_id x := by
710704
conv => right; rw [← (Agree.map_id x)]
711-
exact (Agree.map_id x) ▸ Agree.agree_map_ext COFE.OFunctor.map_id
705+
exact Agree.agree_map_ext (fun a => COFE.OFunctor.map_id a)
712706
map_comp f g f' g' x := by
713707
rw [← Agree.map_compose]
714-
apply Agree.agree_map_ext
715-
apply COFE.OFunctor.map_comp
708+
exact Agree.agree_map_ext (fun a => COFE.OFunctor.map_comp f g f' g' a)
716709

717710
@[rocq_alias agreeRF_contractive]
718711
instance {F} [COFE.OFunctorContractive F] : RFunctorContractive (AgreeRF F) where

0 commit comments

Comments
 (0)