Download lean/OAI/Algebra/DepthFive/CoefficientSupport.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 4.13 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Algebra/DepthFive/CoefficientSupport.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Algebra/DepthFive/CoefficientSupport.lean
-
curl -L -o CoefficientSupport.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Algebra/DepthFive/CoefficientSupport.lean
4.13 kB
| 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 | |