AFTD Auto-Formalizing Theoretical Domains

op874_binary_path_close_almost_complete

theoremverified

A finite chain of two-state constraints that each contains a bijection can be closed by any constraint excluding at most one pair.

Statement

theorem op874_binary_path_close_almost_complete
    (rs : List (Bool → Bool → Prop)) (R : Bool → Bool → Prop)
    (hr : ∀ T ∈ rs, ∃ f : Bool → Bool, f false ≠ f true ∧ ∀ a, T a (f a))
    (hR : ∀ a b c d : Bool, (a,b) ≠ (c,d) → R a b ∨ R c d) :
    ∃ a b, op874_binary_chain rs a b ∧ R b a
Source
Finite local-phase reduction for OP-874, https://arxiv.org/abs/2610.41950, Section 2.
Verified
27 Nov 2026
Axioms
propext
Built on 2
Used by 1

The proof, explained

By composing the permutations present in each relation along the chain, the entire chain contains a bijection f : Bool → Bool that connects each state a to f(a). Since R excludes at most one pair overall, it must contain at least one of any two distinct pairs. The pairs (f(false), false) and (f(true), true) have distinct second components and are therefore distinct, so R must hold for at least one of them, providing a pair (a, f(a)) that closes the chain with R(f(a), a).

  1. The relation chain contains a function f : Bool → Bool, so that for every state a, the chain connects a to f(a).

    By op874_binary_chain_contains_permutation, since every relation in the list rs contains a bijection on Bool, their composition also contains a bijection f. We extract f along with the fact that the chain connects every a to f(a).

    line 6

    uses op874_binary_chain_contains_permutation

      obtain ⟨f, -, hf⟩ := op874_binary_chain_contains_permutation rs hr
  2. At least one of R(f(false), false) or R(f(true), true) holds.

    By hypothesis hR, R contains at least one of any two distinct pairs in Bool × Bool. The pairs (f(false), false) and (f(true), true) are distinct because projecting onto the second coordinate via Prod.snd yields false and true, which cannot be equal. Thus, R must relate at least one of these two pairs.

    line 7

    uses congrArg, Prod.snd

      have h := hR (f false) false (f true) true (by intro he; have := congrArg Prod.snd he; cases this)
  3. There exist states a, b such that the chain connects a to b and R(b, a) holds.

    We perform a case split on the disjunction from the previous step. If R(f(false), false) holds, we choose a = false and b = f(false). If R(f(true), true) holds, we choose a = true and b = f(true). In either case, the chain relates a to b and R(b, a) holds.

    lines 8–10

      rcases h with h | h
      · exact ⟨false, f false, hf false, h⟩
      · exact ⟨true, f true, hf true, h⟩
op874_binary_chain_contains_permutation
If every relation in a list contains a permutation (a bijection) on Bool, then the chained composition of those relations also contains a permutation on Bool.
congrArg
Functions respect equality: if x = y, then g(x) = g(y).
Prod.snd
The second projection of an ordered pair, mapping (x, y) to y.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem op874_binary_path_close_almost_complete    (rs : List (Bool → Bool → Prop)) (R : Bool → Bool → Prop)    (hr : ∀ T ∈ rs, ∃ f : Bool → Bool, f false ≠ f true ∧ ∀ a, T a (f a))    (hR : ∀ a b c d : Bool, (a,b) ≠ (c,d) → R a b ∨ R c d) :    ∃ a b, op874_binary_chain rs a b ∧ R b a := by  obtain ⟨f, -, hf⟩ := op874_binary_chain_contains_permutation rs hr  have h := hR (f false) false (f true) true (by intro he; have := congrArg Prod.snd he; cases this)  rcases h with h | h  · exact ⟨false, f false, hf false, h⟩  · exact ⟨true, f true, hf true, h⟩
See it in the graphDiscuss this resultChallenge it