Download data/lean/OAI/Combinatorics/HalvingLines/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/HalvingLines/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/Model.lean
1.72 kB
| import Mathlib | |
| namespace OAI | |
| namespace PlanarHalving | |
| abbrev Point := β Γ β | |
| def orient (p q r : Point) : β := | |
| (q.1 - p.1) * (r.2 - p.2) - (q.2 - p.2) * (r.1 - p.1) | |
| def GeneralPosition {n : β} (P : Fin n β Point) : Prop := | |
| Function.Injective P β§ β i j l, i β j β j β l β i β l β | |
| orient (P i) (P j) (P l) β 0 | |
| noncomputable def sideCount {n : β} (P : Fin n β Point) (i j : Fin n) : β := | |
| (Finset.univ.filter fun l => 0 < orient (P i) (P j) (P l)).card | |
| noncomputable def halvingCount {n : β} (P : Fin n β Point) : β := | |
| (Finset.univ.filter fun ij : Fin n Γ Fin n => | |
| ij.1 < ij.2 β§ sideCount P ij.1 ij.2 = (n - 2) / 2 β§ | |
| sideCount P ij.2 ij.1 = (n - 2) / 2).card | |
| noncomputable def slope (p q : Point) : β := (q.2 - p.2) / (q.1 - p.1) | |
| def Generic {n : β} (P : Fin n β Point) : Prop := | |
| GeneralPosition P β§ | |
| (β i j, i β j β (P i).1 β (P j).1) β§ | |
| (β i j a b, i < j β a < b β slope (P i) (P j) = slope (P a) (P b) β | |
| i = a β§ j = b) β§ | |
| (β i j a b c d, i < j β a < b β c < d β | |
| (i, j) β (a, b) β (c, d) β (i, j) β (c, d) β (a, b) β | |
| β z : Point, z β openSegment β (P i) (P j) β | |
| z β openSegment β (P a) (P b) β z β segment β (P c) (P d)) | |
| noncomputable def belowCount {n : β} (P : Fin n β Point) (i j : Fin n) : β := | |
| let s := slope (P i) (P j) | |
| (Finset.univ.filter fun l => (P l).2 - s * (P l).1 < | |
| (P i).2 - s * (P i).1).card | |
| noncomputable def switchCount {n : β} (P : Fin n β Point) (k : β) : β := | |
| (Finset.univ.filter fun ij : Fin n Γ Fin n => | |
| ij.1 < ij.2 β§ 0 < k β§ k < n β§ belowCount P ij.1 ij.2 = k - 1).card | |
| end PlanarHalving | |
| end OAI | |