File size: 4,134 Bytes
2c7d975
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import OAI.Algebra.DepthFive.Basic

namespace OAI

noncomputable section

universe u

namespace Problem335

/-- The scalars actually occurring at a leaf. -/
def leafCoefficientSet {K : Type u} {n : ℕ} (x : D5Leaf K n) : Finset K := by
  classical
  exact match x with
  | .scalar a => {a}
  | .variable _ => ∅

/-- All coefficients occurring in a circuit, including weighted wires. -/
def circuitCoefficientSet {K : Type u} [CommSemiring K] {n : ℕ}
    (c : Depth5Circuit K n) : Finset K := by
  classical
  exact (Finset.univ.biUnion fun i => leafCoefficientSet (c.leaves i)) ∪
    (Finset.univ.biUnion fun i => ((c.bottomInputs i).map Prod.fst).toFinset) ∪
    (Finset.univ.biUnion fun i => ((c.middleInputs i).map Prod.fst).toFinset) ∪
    (c.outputInputs.map Prod.fst).toFinset

lemma leaf_scalar_mem_coefficientSet {K : Type u} [CommSemiring K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.leafCount) (a : K)
    (h : c.leaves i = .scalar a) : a ∈ circuitCoefficientSet c := by
  classical
  simp only [circuitCoefficientSet, Finset.mem_union]
  left; left; left
  exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, by simp [h, leafCoefficientSet]⟩

lemma bottom_coeff_mem_coefficientSet {K : Type u} [CommSemiring K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.bottomCount) (entry : K × Fin c.leafCount)
    (h : entry ∈ c.bottomInputs i) : entry.1 ∈ circuitCoefficientSet c := by
  classical
  simp only [circuitCoefficientSet, Finset.mem_union]
  left; left; right
  exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, List.mem_toFinset.mpr
    (List.mem_map.mpr ⟨entry, h, rfl⟩)⟩

lemma middle_coeff_mem_coefficientSet {K : Type u} [CommSemiring K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.middleCount) (entry : K × Fin c.lowerCount)
    (h : entry ∈ c.middleInputs i) : entry.1 ∈ circuitCoefficientSet c := by
  classical
  simp only [circuitCoefficientSet, Finset.mem_union]
  left; right
  exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, List.mem_toFinset.mpr
    (List.mem_map.mpr ⟨entry, h, rfl⟩)⟩

lemma output_coeff_mem_coefficientSet {K : Type u} [CommSemiring K] {n : ℕ}
    (c : Depth5Circuit K n) (entry : K × Fin c.upperCount)
    (h : entry ∈ c.outputInputs) : entry.1 ∈ circuitCoefficientSet c := by
  classical
  simp only [circuitCoefficientSet, Finset.mem_union]
  right
  exact List.mem_toFinset.mpr (List.mem_map.mpr ⟨entry, h, rfl⟩)

/-- The subfield generated by the finitely many coefficients of a circuit. -/
def circuitCoefficientField {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) : Subfield K :=
  Subfield.closure (↑(circuitCoefficientSet c) : Set K)

lemma leaf_scalar_mem {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.leafCount) (a : K)
    (h : c.leaves i = .scalar a) : a ∈ circuitCoefficientField c :=
  Subfield.subset_closure (leaf_scalar_mem_coefficientSet c i a h)

lemma bottom_coeff_mem {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.bottomCount) (entry : K × Fin c.leafCount)
    (h : entry ∈ c.bottomInputs i) : entry.1 ∈ circuitCoefficientField c :=
  Subfield.subset_closure (bottom_coeff_mem_coefficientSet c i entry h)

lemma middle_coeff_mem {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) (i : Fin c.middleCount) (entry : K × Fin c.lowerCount)
    (h : entry ∈ c.middleInputs i) : entry.1 ∈ circuitCoefficientField c :=
  Subfield.subset_closure (middle_coeff_mem_coefficientSet c i entry h)

lemma output_coeff_mem {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) (entry : K × Fin c.upperCount)
    (h : entry ∈ c.outputInputs) : entry.1 ∈ circuitCoefficientField c :=
  Subfield.subset_closure (output_coeff_mem_coefficientSet c entry h)

instance circuitCoefficientField_countable {K : Type u} [Field K] {n : ℕ}
    (c : Depth5Circuit K n) : Countable (circuitCoefficientField c) := by
  apply Cardinal.mk_le_aleph0_iff.mp
  exact (Subfield.cardinalMk_closure_le_max (↑(circuitCoefficientSet c) : Set K)).trans
    (max_le (Cardinal.mk_le_aleph0) le_rfl)

end Problem335

end

end OAI