Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 3.23 — properties of subtraction F − G = F ∧ ¬((¬emp) ∗ G)

Proved
BiAbduction.Systematic.lemma_3_23

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

p2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1separation-logic

For arbitrary predicates F,G,H,F1,…,FnF,G,H,F_1,\dots,F_nF,G,H,F1​,…,Fn​ and a variable XXX, with F−G=F∧¬((¬emp)∗G)F-G=F\wedge\neg((\neg\mathsf{emp})*G)F−G=F∧¬((¬emp)∗G):

  1. min⁡(F)=F−F\min(F)=F-Fmin(F)=F−F;
  2. (F∨G)−H=(F−H)∨(G−H)(F\vee G)-H=(F-H)\vee(G-H)(F∨G)−H=(F−H)∨(G−H);
  3. (∃X.F)−G=∃X.(F−G)(\exists X.F)-G=\exists X.(F-G)(∃X.F)−G=∃X.(F−G), provided XXX is not free in GGG;
  4. F−(G∨H)=(F−G)∧(F−H)F-(G\vee H)=(F-G)\wedge(F-H)F−(G∨H)=(F−G)∧(F−H);
  5. F−(∃X.G)=∀X.(F−G)F-(\exists X.G)=\forall X.(F-G)F−(∃X.G)=∀X.(F−G), provided XXX is not free in FFF;
  6. min⁡(F1∨⋯∨Fn)=G1∨⋯∨Gn\min(F_1\vee\dots\vee F_n)=G_1\vee\dots\vee G_nmin(F1​∨⋯∨Fn​)=G1​∨⋯∨Gn​, where Gi=((Fi−F1)⋯−Fn)G_i=((F_i-F_1)\cdots-F_n)Gi​=((Fi​−F1​)⋯−Fn​).

Property (6) reduces the computation of min⁡\minmin of a disjunction to binary subtraction, the third phase of the systematic algorithm.

Formalization Note In (6) the disjunction is over a list F1,…,FnF_1,\dots,F_nF1​,…,Fn​ (possibly empty) and GiG_iGi​ is the left fold of subtraction starting from FiF_iFi​.

Preamble
import Mathlib
import Definitions.Def_BiAbduction_Systematic_Semantics
Formal statement
namespace BiAbduction.Systematic

/-- Lemma 3.23 (p. 32), properties of subtraction, for arbitrary predicates:
(1) `min(F) = F − F`; (2) `(F ∨ G) − H = (F − H) ∨ (G − H)`;
(3) `(∃X.F) − G = ∃X.(F − G)` if `X` is not free in `G`; (4) `F − (G ∨ H) = (F − G) ∧ (F − H)`;
(5) `F − (∃X.G) = ∀X.(F − G)` if `X` is not free in `F`;
(6) `min(F₁ ∨ ⋯ ∨ Fₙ) = G₁ ∨ ⋯ ∨ Gₙ` with `Gᵢ = ((Fᵢ − F₁) ⋯ − Fₙ)`. -/
theorem lemma_3_23 :
    (∀ F : Pred, minSet F = subP F F) ∧
    (∀ F G H : Pred, subP (F ∪ G) H = subP F H ∪ subP G H) ∧
    (∀ (X : ℕ) (F G : Pred), NotFree X G → subP (exQ X F) G = exQ X (subP F G)) ∧
    (∀ F G H : Pred, subP F (G ∪ H) = subP F G ∩ subP F H) ∧
    (∀ (X : ℕ) (F G : Pred), NotFree X F → subP F (exQ X G) = allQ X (subP F G)) ∧
    (∀ Fs : List Pred,
      minSet (⋃ i : Fin Fs.length, Fs.get i) =
        ⋃ i : Fin Fs.length, Fs.foldl subP (Fs.get i)) := by sorry

end BiAbduction.Systematic
Source
Calcagno, Distefano, O'Hearn, Yang, Compositional Shape Analysis by means of Bi-Abduction, J. ACM (2011), p. 32, Lemma 3.23 (1)–(6)
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me