Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The parity edge guard equals the residual arithmetic check

Proved
Couret.STROBO2TORS.recoh_parity_edge_guard_iff_python

by alexcour · Nov 8, 2026 · Mathlib c5ea003 (Lean v4.30.0)

couret-programmecouret-unification-20261108

Let GGG be an abelian group. Let UUU be any finite support and R:G→NR:G\to\mathbb NR:G→N. Write iz=[R(z) odd]i_z=[R(z)\text{ odd}]iz​=[R(z) odd] on UUU and let E={z∈U:(R(z)−iz)/2>0}E=\{z\in U:(R(z)-i_z)/2>0\}E={z∈U:(R(z)−iz​)/2>0}. Then the guard R(z)=iz+2[z∈E]R(z)=i_z+2[z\in E]R(z)=iz​+2[z∈E] for every z∈Uz\in Uz∈U is equivalent to

∀z∈U:iz≤R(z),R(z)−iz≡0(mod2),(R(z)−iz)/2≤1.\forall z\in U:\quad i_z\le R(z),\quad R(z)-i_z\equiv0\pmod2,\quad(R(z)-i_z)/2\le1.∀z∈U:iz​≤R(z),R(z)−iz​≡0(mod2),(R(z)−iz​)/2≤1.

This identifies the finite-set parity guard with the Python residual test, using natural subtraction and division.

Preamble
import Aesop
import Definitions.Def_Couret_RecohParityGuardBridge_a0468e3b1d7b
import Lean.Elab.Tactic.Omega
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Algebra.Field.ZMod
import Mathlib.Algebra.Group.AddChar
import Mathlib.Algebra.Module.ZMod
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Finite.Card
import Mathlib.Data.Finset.Card
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Multiset.Sort
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.ZMod.Basic
import Mathlib.FieldTheory.Finiteness
import Mathlib.GroupTheory.FiniteAbelian.Duality
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.LinearAlgebra.Dual.Lemmas
import Mathlib.LinearAlgebra.LinearIndependent.Lemmas
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.RingTheory.RootsOfUnity.Complex
import Mathlib.Tactic
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Choose
import Mathlib.Tactic.FinCases
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Tauto
import Definitions.Def_Couret_RecohParityGenerator_deb90a4bb68d

set_option autoImplicit false

/-!
Exact arithmetic correspondence between the Lean residual guards and the
subtraction, parity and indicator-value guards in Python v0.2.

This proves equal mathematical predicates. It is not a formal semantics of
Python integer operations, parsing, exceptions or serialization.
-/

namespace Couret.STROBO2TORS





variable {G : Type*} [AddCommGroup G] [DecidableEq G]

Formal statement
omit [AddCommGroup G] in
theorem recoh_parity_edge_guard_iff_python (U : Finset G) (R : G → ℕ) :
    recohParityEdgeGuard U R ↔
      ∀ z ∈ U, recohPythonResidualGuard (R z)
        (recohParityIndicator (recohParityOddSupport U R) z) := by sorry




end Couret.STROBO2TORS
Source
Alexandre Couret, Couret — Additive reconstruction: STROBO-4, singleton collisions and RECOH formal proof artifacts, https://zenodo.org/records/23980513; archive COURET_MATHEMATIQUES_20261105.zip, SHA-256 19a3b59aee930df74cab79c27b29e014843bd17179a26fef1261ed6b5a651ab7; file RECOH/lean/RecohParityGuardBridge.lean, lines 32–55; source file SHA-256 06162ab7b538e9783989f43f6e8c4037a3c37096e45d688909d264f70b074b5d; theorem Couret.STROBO2TORS.recoh_parity_edge_guard_iff_python

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