AFTD Auto-Formalizing Theoretical Domains

petersen_lift20_graph_exists

theoremverified

There exists a 20-vertex simple graph G (the Petersen 2-lift / dodecahedron) with decidable adjacency which is 3-regular, triangle-free, and whose per-vertex hard-core variance equals lift20_poly_variance_per_vertex x for all activities x.

Statement

theorem petersen_lift20_graph_exists :
    ∃ (G : SimpleGraph (Fin 20)) (_ : DecidableRel G.Adj),
      G.IsRegularOfDegree 3 ∧ G.CliqueFree 3 ∧
      ∀ x : ℝ, hardCoreVarSize G (fun _ => x) / 20 = lift20_poly_variance_per_vertex x
Source
step towards op_1354_triangle_free_cubic_petersen_variance_crossover
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • hardCoreVarSizeGiven a finite graph G on a type V with decidable equality and vertex fugacities lam, the variance of the independent set size…
  • lift20_poly_variance_per_vertexFor an activity x, the per-vertex hard-core variance of the 20-vertex Petersen 2-lift computed from its independence polynomial Q(x) = 1 +…

The proof, explained

The proof exhibits the Petersen 2-lift (the dodecahedron graph) on Fin 20 as an explicit 3-regular, triangle-free graph, verifying both properties by finite computational evaluation (decide). To establish that the per-vertex hard-core variance matches lift20_poly_variance_per_vertex, it expresses the partition function and the first two moments as polynomial sums over the independent set counts via fiberwise summation. Substituting the computationally verified counts of independent k-sets into the variance formula, the identity between the hard-core variance and the target rational function is verified by ring normalization.

  1. The graph in1189_G is well-defined as a simple graph with symmetric and loopless adjacency. automation

    The boolean adjacency relation in1189_adjB is verified to be symmetric and irreflexive by finite computational evaluation (decide).

    lines 7–11

    def in1189_G : SimpleGraph (Fin 20) where
      Adj a b := in1189_adjB a b = true
      symm := ⟨by decide⟩
      loopless := ⟨by decide⟩
    
  2. The empty vertex set contains exactly one independent set of size 0 and zero independent sets of size k > 0.

    The powerset of the empty set contains only the empty set by Finset.powerset_empty. Distinguishing cases on k = 0 using Finset.filter_singleton, Finset.card_singleton, and Finset.card_empty establishes that the count is 1 for k = 0 and 0 for k > 0.

    lines 24–34

    uses Finset.powerset_empty, Finset.filter_singleton, Finset.card_singleton, Finset.card_empty

    theorem in1189_nil {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) :
        ((∅ : Finset V).powerset.filter (fun I : Finset V => G.IsIndepSet (I : Set V) ∧ I.card = k)).card
          = if k = 0 then 1 else 0 := by
      classical
      rw [Finset.powerset_empty]
      by_cases hk : k = 0
      · subst hk
        rw [if_pos rfl, Finset.filter_singleton, if_pos ⟨by simp, rfl⟩, Finset.card_singleton]
      · rw [if_neg hk, Finset.filter_singleton, if_neg (by rintro ⟨-, h⟩; exact hk (by simpa using h.symm)),
          Finset.card_empty]
    
  3. The recursive counting function in1189_cnt is correct for fuel 0 and for an empty list.

    By induction on the fuel parameter f. When f = 0, the vertex list must be empty by List.eq_nil_of_length_eq_zero, and both sides evaluate to 1 if k = 0 and 0 otherwise by in1189_nil. When f > 0 and the list is empty, both sides similarly evaluate to 1 if k = 0 and 0 otherwise.

    lines 35–51

    uses List.eq_nil_of_length_eq_zero, in1189_nil

    theorem in1189_cnt_sound {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (adj : V → V → Bool)
        (hadj : ∀ a b, G.Adj a b ↔ adj a b = true) :
        ∀ (f : ℕ) (l : List V), l.length ≤ f → l.Nodup → ∀ k,
          in1189_cnt adj f l k = (l.toFinset.powerset.filter
            (fun I : Finset V => G.IsIndepSet (I : Set V) ∧ I.card = k)).card := by
      classical
      intro f
      induction f with
      | zero =>
        intro l hl _ k
        have : l = [] := List.eq_nil_of_length_eq_zero (by omega)
        subst this
        rw [in1189_cnt.eq_1, List.toFinset_nil, in1189_nil]
      | succ f ih =>
        intro l hl hnd k
        cases l with
        | nil => rw [in1189_cnt.eq_2, List.toFinset_nil, in1189_nil]
  4. For a vertex list v :: rest, the independent k-subsets partition into those disjoint from v and those containing v, matching the inclusion-exclusion recurrence.

    Since the list has no duplicates by List.nodup_cons, v is not in rest. By Finset.powerset_insert, the powerset splits into subsets disjoint from v and subsets formed by inserting v into a subset of rest. Applying Finset.filter_union and Finset.card_union_of_disjoint, the count of independent k-sets disjoint from v equals the induction hypothesis applied to rest.

    lines 52–64

    uses List.nodup_cons, Finset.powerset_insert, Finset.filter_union, Finset.card_union_of_disjoint

        | cons v rest =>
          rw [List.nodup_cons] at hnd
          obtain ⟨hv, hnd⟩ := hnd
          simp only [List.length_cons] at hl
          set s := rest.toFinset with hs
          have hvs : v ∉ s := by rw [hs, List.mem_toFinset]; exact hv
          have key : in1189_cnt adj (f+1) (v :: rest) k = in1189_cnt adj f rest k +
              (match k with
                | 0 => 0
                | k + 1 => in1189_cnt adj f (rest.filter (fun w => !adj v w)) k) := by
            cases k <;> rfl
          rw [key, List.toFinset_cons, Finset.powerset_insert, Finset.filter_union,
            Finset.card_union_of_disjoint, ih rest (by omega) hnd k]
  5. Independent sets containing v are in bijection with independent sets in the sublist of non-neighbors of v, completing the correctness induction.

    Inserting v is injective on subsets disjoint from v (Finset.card_image_of_injOn, Finset.erase_insert), and the image is disjoint from subsets not containing v (Finset.disjoint_left). When k = 0, no set containing v has cardinality 0 by Finset.card_insert_of_notMem. When k = k' + 1, a subset J of rest forms an independent set with v if and only if J is independent and no vertex of J is adjacent to v (SimpleGraph.isIndepSet_iff, Set.pairwise_insert). By the induction hypothesis, this count matches the recursive call on the sublist of rest filtered by non-adjacency to v.

    lines 65–120

    uses Finset.card_image_of_injOn, Finset.card_insert_of_notMem, SimpleGraph.isIndepSet_iff, Set.pairwise_insert, Finset.erase_insert, Finset.disjoint_left

          · congr 1
            rw [Finset.filter_image]
            rw [Finset.card_image_of_injOn]
            · cases k with
              | zero =>
                dsimp only
                rw [eq_comm, Finset.card_eq_zero, Finset.filter_eq_empty_iff]
                intro J _ h
                exact absurd h.2 (by rw [Finset.card_insert_of_notMem (fun hJ => hvs (by
                  rename_i hJs; exact (Finset.mem_powerset.1 hJs) hJ))]; omega)
              | succ k =>
                dsimp only
                rw [ih (rest.filter (fun w => !adj v w)) (le_trans (List.length_filter_le _ _) (by omega))
                  (hnd.filter _) k]
                congr 1
                ext J
                simp only [Finset.mem_filter, Finset.mem_powerset]
                constructor
                · rintro ⟨hJ, hind, hcard⟩
                  have hJs : J ⊆ s := fun x hx => by
                    have := hJ hx
                    rw [List.mem_toFinset, List.mem_filter] at this
                    rw [hs, List.mem_toFinset]; exact this.1
                  have hJa : ∀ x ∈ J, adj v x = false := fun x hx => by
                    have := hJ hx
                    rw [List.mem_toFinset, List.mem_filter] at this
                    simpa using this.2
                  have hvJ : v ∉ J := fun h => hvs (hJs h)
                  refine ⟨hJs, ?_, by rw [Finset.card_insert_of_notMem hvJ, hcard]⟩
                  rw [Finset.coe_insert, SimpleGraph.isIndepSet_iff, Set.pairwise_insert]
                  refine ⟨hind, fun x hx _ => ⟨fun h => ?_, fun h => ?_⟩⟩
                  · have h' := (hadj v x).1 h
                    simp [hJa x hx] at h'
                  · have h' := (hadj v x).1 h.symm
                    simp [hJa x hx] at h'
                · rintro ⟨hJs, hind, hcard⟩
                  have hvJ : v ∉ J := fun h => hvs (hJs h)
                  rw [Finset.coe_insert, SimpleGraph.isIndepSet_iff, Set.pairwise_insert] at hind
                  rw [Finset.card_insert_of_notMem hvJ] at hcard
                  refine ⟨fun x hx => ?_, by rw [SimpleGraph.isIndepSet_iff]; exact hind.1, by omega⟩
                  rw [List.mem_toFinset, List.mem_filter]
                  refine ⟨by rw [← List.mem_toFinset, ← hs]; exact hJs hx, ?_⟩
                  have := (hind.2 x hx (fun h => hvJ (h ▸ hx))).1
                  rw [hadj] at this
                  simpa using this
            · intro J hJ J' hJ' he
              simp only [Finset.coe_filter, Finset.mem_powerset, Set.mem_setOf_eq] at hJ hJ'
              have h1 : v ∉ J := fun h => hvs (hJ.1 h)
              have h2 : v ∉ J' := fun h => hvs (hJ'.1 h)
              rw [← Finset.erase_insert h1, ← Finset.erase_insert h2, he]
          · rw [Finset.disjoint_left]
            intro J hJ hJ'
            simp only [Finset.mem_filter, Finset.mem_powerset, Finset.mem_image] at hJ hJ'
            obtain ⟨⟨K, -, rfl⟩, -⟩ := hJ'
            exact hvs (hJ.1 (Finset.mem_insert_self _ _))
    
  6. The independent set counts of in1189_G by size k = 0, ..., 20 are explicitly given by [1, 20, 160, 660, 1510, 1912, 1240, 320, 5, 0, ..., 0]. automation

    Evaluating in1189_cnt on the 20 vertices with fuel 20 for all k from 0 to 20 is verified by Lean's kernel computation (decide +kernel).

    lines 121–124

    theorem in1189_counts : ∀ k : Fin 21, in1189_cnt in1189_adjB 20 (List.finRange 20) k.val =
        ![1, 20, 160, 660, 1510, 1912, 1240, 320, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] k := by
      decide +kernel
    
  7. The number of independent k-subsets of in1189_G equals in1189_cnt in1189_adjB 20 (List.finRange 20) k.

    We specialize in1189_cnt_sound to in1189_G and List.finRange 20, using List.nodup_finRange and Finset.powerset_univ to identify the vertex list's finset with Finset.univ.

    lines 125–133

    uses in1189_cnt_sound, List.nodup_finRange, Finset.filter_filter, Finset.powerset_univ

    theorem in1189_card (k : ℕ) :
        ((Finset.univ.filter fun I : Finset (Fin 20) => in1189_G.IsIndepSet (I : Set (Fin 20))).filter
          (fun I => I.card = k)).card = in1189_cnt in1189_adjB 20 (List.finRange 20) k := by
      classical
      rw [in1189_cnt_sound in1189_G in1189_adjB (fun a b => Iff.rfl) 20 (List.finRange 20) (by simp)
        (List.nodup_finRange 20) k, Finset.filter_filter,
        show (List.finRange 20).toFinset = Finset.univ by ext; simp, Finset.powerset_univ]
      all_goals first | rfl | (congr 1) | simp
    
  8. Any sum of g(|I|) over all independent sets in in1189_G equals the sum over sizes k from 0 to 20 of the count of independent k-sets multiplied by g(k).

    Using Finset.sum_fiberwise_of_maps_to, independent sets are partitioned by their cardinality k in Finset.range 21 (since every subset of Fin 20 has cardinality at most 20 by Finset.card_le_univ and Fintype.card_fin). On each fiber, the summand is constant, so Finset.sum_const and nsmul_eq_mul replace the fiber sum with the fiber size (evaluated by in1189_card) times g(k).

    lines 134–148

    uses Finset.sum_fiberwise_of_maps_to, Finset.sum_congr, Finset.sum_const, nsmul_eq_mul, in1189_card, Finset.card_le_univ, Fintype.card_fin

    theorem in1189_sum (g : ℕ → ℝ) :
        ∑ I ∈ Finset.univ.filter (fun I : Finset (Fin 20) => in1189_G.IsIndepSet (I : Set (Fin 20))),
          g I.card = ∑ k ∈ Finset.range 21, (in1189_cnt in1189_adjB 20 (List.finRange 20) k : ℝ) * g k := by
      classical
      rw [← Finset.sum_fiberwise_of_maps_to (g := Finset.card) (t := Finset.range 21)]
      · apply Finset.sum_congr rfl
        intro k _
        rw [Finset.sum_congr rfl (fun I hI => by rw [(Finset.mem_filter.1 hI).2]), Finset.sum_const,
          nsmul_eq_mul, ← in1189_card k]
      · intro I _
        rw [Finset.mem_range]
        have := Finset.card_le_univ I
        rw [Fintype.card_fin] at this
        omega
    
  9. The graph in1189_G and its decidability instance in1189_inst provide the witness for the existential claim.

    We supply the concrete 20-vertex graph in1189_G and its decidability instance in1189_inst, splitting the existential goal into three subgoals: 3-regularity, triangle-freeness, and the per-vertex variance equality.

    line 154

      refine ⟨in1189_G, in1189_inst, ?_, ?_, ?_⟩
  10. The graph in1189_G is 3-regular. automation

    Using SimpleGraph.card_neighborFinset_eq_degree, the degree of each vertex is rewritten as the cardinality of its neighbor finset. The claim that this equals 3 for all 20 vertices is closed by finite exhaustive evaluation (decide).

    lines 155–158

    uses SimpleGraph.card_neighborFinset_eq_degree

      · intro v
        rw [← SimpleGraph.card_neighborFinset_eq_degree]
        revert v
        decide
  11. The graph in1189_G is triangle-free (3-clique free). automation

    Given a 3-clique, SimpleGraph.is3Clique_iff decomposes it into three mutually adjacent vertices. A decidable check exhaustively verifies that no three vertices in Fin 20 are mutually adjacent in in1189_adjB, yielding a contradiction.

    lines 159–163

    uses SimpleGraph.is3Clique_iff

      · intro s hs
        obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := SimpleGraph.is3Clique_iff.1 hs
        have notri : ∀ a b c : Fin 20, in1189_adjB a b = true → in1189_adjB a c = true →
            in1189_adjB b c = true → False := by decide
        exact notri a b c hab hac hbc
  12. For all activities x, the per-vertex hard-core variance of in1189_G equals lift20_poly_variance_per_vertex x. automation

    With uniform activity x, the weight of each independent set I is x^|I| by Finset.prod_const. Expanding hardCoreVarSize and lift20_poly_variance_per_vertex, the partition function and moments are converted from sums over independent sets to polynomials in x using the fiberwise summation formula in1189_sum. Unrolling the finite sums with Finset.sum_range_succ and Finset.sum_range_zero, and substituting the independent set counts from in1189_counts via Fin.forall_fin_succ, both sides reduce to the same rational expression, which is verified by polynomial ring normalization (ring_nf).

    lines 164–195

    uses Finset.prod_const, in1189_sum, Finset.sum_range_succ, Finset.sum_range_zero, in1189_counts, Fin.forall_fin_succ

      · intro x
        have hc := in1189_counts
        have e0 : ∀ I : Finset (Fin 20), ∏ _v ∈ I, x = x ^ I.card := fun I => Finset.prod_const x
        simp only [hardCoreVarSize, lift20_poly_variance_per_vertex, e0]
        rw [in1189_sum (fun k => x ^ k), in1189_sum (fun k => x ^ k * (k : ℝ)),
          in1189_sum (fun k => x ^ k * ((k : ℝ) ^ 2))]
        simp only [Finset.sum_range_succ, Finset.sum_range_zero]
        have h := fun k : Fin 21 => hc k
        simp only [Fin.forall_fin_succ] at h
        simp only [show in1189_cnt in1189_adjB 20 (List.finRange 20) 0 = 1 from hc 0,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 1 = 20 from hc 1,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 2 = 160 from hc 2,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 3 = 660 from hc 3,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 4 = 1510 from hc 4,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 5 = 1912 from hc 5,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 6 = 1240 from hc 6,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 7 = 320 from hc 7,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 8 = 5 from hc 8,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 9 = 0 from hc 9,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 10 = 0 from hc 10,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 11 = 0 from hc 11,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 12 = 0 from hc 12,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 13 = 0 from hc 13,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 14 = 0 from hc 14,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 15 = 0 from hc 15,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 16 = 0 from hc 16,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 17 = 0 from hc 17,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 18 = 0 from hc 18,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 19 = 0 from hc 19,
          show in1189_cnt in1189_adjB 20 (List.finRange 20) 20 = 0 from hc 20]
        congr 1
        all_goals ring_nf
Finset.powerset_empty
The powerset of the empty finset is the singleton set containing the empty set.
Finset.filter_singleton
Filtering a singleton finset {a} by predicate p yields {a} if p a holds, and empty otherwise.
Finset.card_singleton
The cardinality of a singleton finset is 1.
Finset.card_empty
The cardinality of the empty finset is 0.
List.eq_nil_of_length_eq_zero
A list whose length is zero is the empty list.
in1189_nil
The number of independent k-subsets of the empty set is 1 if k = 0, and 0 otherwise.
List.nodup_cons
A list a :: l has no duplicates if and only if a is not in l and l has no duplicates.
Finset.powerset_insert
The powerset of insert a s equals the powerset of s united with the image of inserting a into every element of the powerset of s.
Finset.filter_union
Filtering a union of two finsets distributes over the union.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finsets is the sum of their cardinalities.
Finset.card_image_of_injOn
The cardinality of the image under a function injective on s equals the cardinality of s.
Finset.card_insert_of_notMem
Inserting an element not in s into s increases its cardinality by 1.
SimpleGraph.isIndepSet_iff
A set is independent in a simple graph if and only if all pairs of distinct vertices in it are non-adjacent.
Set.pairwise_insert
A pairwise relation holds on insert a s if and only if it holds on s and r a b and r b a hold for all distinct b in s.
Finset.erase_insert
Erasing an element a from insert a s, when a was not in s, recovers s.
Finset.disjoint_left
Two finsets are disjoint if and only if every element of the first is not in the second.
in1189_cnt_sound
The recursive counting function in1189_cnt correctly computes the number of independent k-subsets of a list with no duplicates.
List.nodup_finRange
The list finRange n of all elements of Fin n contains no duplicate elements.
Finset.filter_filter
Filtering a finset by p and then by q is equivalent to filtering by p and q simultaneously.
Finset.powerset_univ
The powerset of the universal finset is the universal finset of the powerset.
Finset.sum_fiberwise_of_maps_to
A sum over a finset can be rewritten by grouping elements by the value of a function into fiberwise sums.
Finset.sum_congr
Two sums over the same finset are equal if their summands agree on every element.
Finset.sum_const
Summing a constant b over a finset s equals the cardinality of s scalar-multiplied by b.
nsmul_eq_mul
Natural number scalar multiplication n • a equals the product of (n : α) with a.
in1189_card
The number of independent k-subsets in in1189_G equals in1189_cnt in1189_adjB 20 (List.finRange 20) k.
Finset.card_le_univ
The cardinality of any subset of α is at most the cardinality of the ambient finite type α.
Fintype.card_fin
The cardinality of the finite type Fin n is n.
SimpleGraph.card_neighborFinset_eq_degree
The degree of a vertex in a locally finite simple graph equals the cardinality of its neighbor finset.
SimpleGraph.is3Clique_iff
A finset s is a 3-clique in G if and only if it consists of three distinct mutually adjacent vertices a, b, c.
in1189_counts
The counts of independent sets of size k in in1189_G for k = 0, ..., 20 are given by the vector [1, 20, 160, 660, 1510, 1912, 1240, 320, 5, 0, ..., 0].
Finset.prod_const
The product of a constant b over a finite set s equals b raised to the power of the cardinality of s.
in1189_sum
The sum of g(|I|) over all independent sets I of in1189_G equals the sum over k from 0 to 20 of the number of independent k-sets times g(k).
Finset.sum_range_succ
The sum over the range of n + 1 equals the sum over the range of n plus the term at n.
Finset.sum_range_zero
The sum over an empty range (range 0) is zero.
Fin.forall_fin_succ
A universal quantification over Fin (n + 1) is equivalent to the property holding at 0 and at the successor of every element of Fin n.

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

def in1189_adjB (a b : Fin 20) : Bool :=  (a.val < 10 && b.val < 10 && ((a.val + 1) % 10 == b.val || (b.val + 1) % 10 == a.val)) ||  (a.val < 10 && b.val == a.val + 10) || (b.val < 10 && a.val == b.val + 10) ||  (10 ≤ a.val && 10 ≤ b.val &&    ((a.val - 10 + 2) % 10 == b.val - 10 || (b.val - 10 + 2) % 10 == a.val - 10))def in1189_G : SimpleGraph (Fin 20) where  Adj a b := in1189_adjB a b = true  symm := ⟨by decide⟩  loopless := ⟨by decide⟩instance in1189_inst : DecidableRel in1189_G.Adj := fun a b =>  inferInstanceAs (Decidable (in1189_adjB a b = true))/-- number of independent `k`-subsets of the list `l` (fuel-bounded include/exclude recursion) -/def in1189_cnt {V : Type*} (adj : V → V → Bool) : ℕ → List V → ℕ → ℕ  | 0, _, k => if k = 0 then 1 else 0  | _ + 1, [], k => if k = 0 then 1 else 0  | f + 1, v :: rest, k => in1189_cnt adj f rest k +      (match k with        | 0 => 0        | k + 1 => in1189_cnt adj f (rest.filter (fun w => !adj v w)) k)theorem in1189_nil {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) :    ((∅ : Finset V).powerset.filter (fun I : Finset V => G.IsIndepSet (I : Set V) ∧ I.card = k)).card      = if k = 0 then 1 else 0 := by  classical  rw [Finset.powerset_empty]  by_cases hk : k = 0  · subst hk    rw [if_pos rfl, Finset.filter_singleton, if_pos ⟨by simp, rfl⟩, Finset.card_singleton]  · rw [if_neg hk, Finset.filter_singleton, if_neg (by rintro ⟨-, h⟩; exact hk (by simpa using h.symm)),      Finset.card_empty]theorem in1189_cnt_sound {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (adj : V → V → Bool)    (hadj : ∀ a b, G.Adj a b ↔ adj a b = true) :    ∀ (f : ℕ) (l : List V), l.length ≤ f → l.Nodup → ∀ k,      in1189_cnt adj f l k = (l.toFinset.powerset.filter        (fun I : Finset V => G.IsIndepSet (I : Set V) ∧ I.card = k)).card := by  classical  intro f  induction f with  | zero =>    intro l hl _ k    have : l = [] := List.eq_nil_of_length_eq_zero (by omega)    subst this    rw [in1189_cnt.eq_1, List.toFinset_nil, in1189_nil]  | succ f ih =>    intro l hl hnd k    cases l with    | nil => rw [in1189_cnt.eq_2, List.toFinset_nil, in1189_nil]    | cons v rest =>      rw [List.nodup_cons] at hnd      obtain ⟨hv, hnd⟩ := hnd      simp only [List.length_cons] at hl      set s := rest.toFinset with hs      have hvs : v ∉ s := by rw [hs, List.mem_toFinset]; exact hv      have key : in1189_cnt adj (f+1) (v :: rest) k = in1189_cnt adj f rest k +          (match k with            | 0 => 0            | k + 1 => in1189_cnt adj f (rest.filter (fun w => !adj v w)) k) := by        cases k <;> rfl      rw [key, List.toFinset_cons, Finset.powerset_insert, Finset.filter_union,        Finset.card_union_of_disjoint, ih rest (by omega) hnd k]      · congr 1        rw [Finset.filter_image]        rw [Finset.card_image_of_injOn]        · cases k with          | zero =>            dsimp only            rw [eq_comm, Finset.card_eq_zero, Finset.filter_eq_empty_iff]            intro J _ h            exact absurd h.2 (by rw [Finset.card_insert_of_notMem (fun hJ => hvs (by              rename_i hJs; exact (Finset.mem_powerset.1 hJs) hJ))]; omega)          | succ k =>            dsimp only            rw [ih (rest.filter (fun w => !adj v w)) (le_trans (List.length_filter_le _ _) (by omega))              (hnd.filter _) k]            congr 1            ext J            simp only [Finset.mem_filter, Finset.mem_powerset]            constructor            · rintro ⟨hJ, hind, hcard⟩              have hJs : J ⊆ s := fun x hx => by                have := hJ hx                rw [List.mem_toFinset, List.mem_filter] at this                rw [hs, List.mem_toFinset]; exact this.1              have hJa : ∀ x ∈ J, adj v x = false := fun x hx => by                have := hJ hx                rw [List.mem_toFinset, List.mem_filter] at this                simpa using this.2              have hvJ : v ∉ J := fun h => hvs (hJs h)              refine ⟨hJs, ?_, by rw [Finset.card_insert_of_notMem hvJ, hcard]⟩              rw [Finset.coe_insert, SimpleGraph.isIndepSet_iff, Set.pairwise_insert]              refine ⟨hind, fun x hx _ => ⟨fun h => ?_, fun h => ?_⟩⟩              · have h' := (hadj v x).1 h                simp [hJa x hx] at h'              · have h' := (hadj v x).1 h.symm                simp [hJa x hx] at h'            · rintro ⟨hJs, hind, hcard⟩              have hvJ : v ∉ J := fun h => hvs (hJs h)              rw [Finset.coe_insert, SimpleGraph.isIndepSet_iff, Set.pairwise_insert] at hind              rw [Finset.card_insert_of_notMem hvJ] at hcard              refine ⟨fun x hx => ?_, by rw [SimpleGraph.isIndepSet_iff]; exact hind.1, by omega⟩              rw [List.mem_toFinset, List.mem_filter]              refine ⟨by rw [← List.mem_toFinset, ← hs]; exact hJs hx, ?_⟩              have := (hind.2 x hx (fun h => hvJ (h ▸ hx))).1              rw [hadj] at this              simpa using this        · intro J hJ J' hJ' he          simp only [Finset.coe_filter, Finset.mem_powerset, Set.mem_setOf_eq] at hJ hJ'          have h1 : v ∉ J := fun h => hvs (hJ.1 h)          have h2 : v ∉ J' := fun h => hvs (hJ'.1 h)          rw [← Finset.erase_insert h1, ← Finset.erase_insert h2, he]      · rw [Finset.disjoint_left]        intro J hJ hJ'        simp only [Finset.mem_filter, Finset.mem_powerset, Finset.mem_image] at hJ hJ'        obtain ⟨⟨K, -, rfl⟩, -⟩ := hJ'        exact hvs (hJ.1 (Finset.mem_insert_self _ _))theorem in1189_counts : ∀ k : Fin 21, in1189_cnt in1189_adjB 20 (List.finRange 20) k.val =    ![1, 20, 160, 660, 1510, 1912, 1240, 320, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] k := by  decide +kerneltheorem in1189_card (k : ℕ) :    ((Finset.univ.filter fun I : Finset (Fin 20) => in1189_G.IsIndepSet (I : Set (Fin 20))).filter      (fun I => I.card = k)).card = in1189_cnt in1189_adjB 20 (List.finRange 20) k := by  classical  rw [in1189_cnt_sound in1189_G in1189_adjB (fun a b => Iff.rfl) 20 (List.finRange 20) (by simp)    (List.nodup_finRange 20) k, Finset.filter_filter,    show (List.finRange 20).toFinset = Finset.univ by ext; simp, Finset.powerset_univ]  all_goals first | rfl | (congr 1) | simptheorem in1189_sum (g : ℕ → ℝ) :    ∑ I ∈ Finset.univ.filter (fun I : Finset (Fin 20) => in1189_G.IsIndepSet (I : Set (Fin 20))),      g I.card = ∑ k ∈ Finset.range 21, (in1189_cnt in1189_adjB 20 (List.finRange 20) k : ℝ) * g k := by  classical  rw [← Finset.sum_fiberwise_of_maps_to (g := Finset.card) (t := Finset.range 21)]  · apply Finset.sum_congr rfl    intro k _    rw [Finset.sum_congr rfl (fun I hI => by rw [(Finset.mem_filter.1 hI).2]), Finset.sum_const,      nsmul_eq_mul, ← in1189_card k]  · intro I _    rw [Finset.mem_range]    have := Finset.card_le_univ I    rw [Fintype.card_fin] at this    omega/-- There exists a 20-vertex simple graph G with decidable adjacency which is 3-regular, triangle-free, and whose per-vertex hard-core variance equals lift20_poly_variance_per_vertex x for all activities x. -/theorem petersen_lift20_graph_exists :    ∃ (G : SimpleGraph (Fin 20)) (_ : DecidableRel G.Adj),      G.IsRegularOfDegree 3 ∧ G.CliqueFree 3 ∧      ∀ x : ℝ, hardCoreVarSize G (fun _ => x) / 20 = lift20_poly_variance_per_vertex x := by  refine ⟨in1189_G, in1189_inst, ?_, ?_, ?_⟩  · intro v    rw [← SimpleGraph.card_neighborFinset_eq_degree]    revert v    decide  · intro s hs    obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := SimpleGraph.is3Clique_iff.1 hs    have notri : ∀ a b c : Fin 20, in1189_adjB a b = true → in1189_adjB a c = true →        in1189_adjB b c = true → False := by decide    exact notri a b c hab hac hbc  · intro x    have hc := in1189_counts    have e0 : ∀ I : Finset (Fin 20), ∏ _v ∈ I, x = x ^ I.card := fun I => Finset.prod_const x    simp only [hardCoreVarSize, lift20_poly_variance_per_vertex, e0]    rw [in1189_sum (fun k => x ^ k), in1189_sum (fun k => x ^ k * (k : ℝ)),      in1189_sum (fun k => x ^ k * ((k : ℝ) ^ 2))]    simp only [Finset.sum_range_succ, Finset.sum_range_zero]    have h := fun k : Fin 21 => hc k    simp only [Fin.forall_fin_succ] at h    simp only [show in1189_cnt in1189_adjB 20 (List.finRange 20) 0 = 1 from hc 0,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 1 = 20 from hc 1,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 2 = 160 from hc 2,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 3 = 660 from hc 3,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 4 = 1510 from hc 4,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 5 = 1912 from hc 5,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 6 = 1240 from hc 6,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 7 = 320 from hc 7,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 8 = 5 from hc 8,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 9 = 0 from hc 9,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 10 = 0 from hc 10,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 11 = 0 from hc 11,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 12 = 0 from hc 12,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 13 = 0 from hc 13,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 14 = 0 from hc 14,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 15 = 0 from hc 15,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 16 = 0 from hc 16,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 17 = 0 from hc 17,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 18 = 0 from hc 18,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 19 = 0 from hc 19,      show in1189_cnt in1189_adjB 20 (List.finRange 20) 20 = 0 from hc 20]    congr 1    all_goals ring_nf
See it in the graphDiscuss this resultChallenge it