Skip to content

Commit

Permalink
Merge branch 'master' into mathport
Browse files Browse the repository at this point in the history
  • Loading branch information
YaelDillies authored Dec 22, 2023
2 parents f30f5cf + 9791f35 commit df76e13
Show file tree
Hide file tree
Showing 68 changed files with 1,475 additions and 2,035 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/push_main.yml

This file was deleted.

116 changes: 116 additions & 0 deletions .github/workflows/push_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
on:
push:
branches:
- master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
style_lint:
name: Lint style
runs-on: ubuntu-latest
steps:
- name: Check for long lines
if: always()
run: |
! (find LeanCamCombi -name "*.lean" -type f -exec grep -E -H -n '^.{101,}$' {} \; | grep -v -E 'https?://')
- name: Don't 'import Mathlib', use precise imports
if: always()
run: |
! (find LeanCamCombi -name "*.lean" -type f -print0 | xargs -0 grep -E -n '^import Mathlib$')
build_project:
runs-on: ubuntu-latest
name: Build project
steps:
- name: Checkout project
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Print files to upstream
run: |
grep -r --exclude-dir=ExampleSheets --files-without-match 'import LeanCamCombi' LeanCamCombi | sort > 1.txt
grep -r --exclude-dir=ExampleSheets --files-with-match 'sorry' LeanCamCombi | sort > 2.txt
mkdir -p docs/_includes
comm -23 1.txt 2.txt | sed -e 's/^\(.*\)$/- [`\1`](https:\/\/github.com\/YaelDillies\/LeanCamCombi\/blob\/master\/\1)/' > docs/_includes/files_to_upstream.md
rm 1.txt 2.txt
- name: Count sorries
run: |
python scripts/count_sorry.py
- name: Install elan
run: curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain leanprover/lean4:4.0.0

- name: Get cache
run: ~/.elan/bin/lake -Kenv=dev exe cache get || true

- name: Build project
run: ~/.elan/bin/lake -Kenv=dev build LeanCamCombi

- name: Cache mathlib docs
uses: actions/cache@v3
with:
path: |
.lake/build/doc/Init
.lake/build/doc/Lake
.lake/build/doc/Lean
.lake/build/doc/Std
.lake/build/doc/Mathlib
.lake/build/doc/declarations
key: MathlibDoc-${{ hashFiles('lake-manifest.json') }}
restore-keys: |
MathlibDoc-
- name: Build documentation
run: ~/.elan/bin/lake -Kenv=dev build LeanCamCombi:docs

# - name: Build blueprint and copy to `docs/blueprint`
# uses: xu-cheng/texlive-action@v2
# with:
# scheme: full
# run: |
# apk update
# apk add --update make py3-pip git
# apk add --update make py3-pip git pkgconfig graphviz graphviz-dev gcc musl-dev
# git config --global --add safe.directory $GITHUB_WORKSPACE
# git config --global --add safe.directory `pwd`
# python3 -m pip install --upgrade pip requests wheel
# python3 -m pip install pygraphviz --global-option=build_ext --global-option="-L/usr/lib/graphviz/" --global-option="-R/usr/lib/graphviz/"
# pip install -r blueprint/requirements.txt
# python3 -m pip install invoke
# inv all

- name: Copy documentation to `docs/docs`
run: |
mv .lake/build/doc docs/docs
- name: Bundle dependencies
uses: ruby/setup-ruby@v1
with:
working-directory: docs
ruby-version: "3.0" # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Bundle website
working-directory: docs
run: JEKYLL_ENV=production bundle exec jekyll build

- name: Upload docs & blueprint artifact
uses: actions/upload-pages-artifact@v1
with:
path: docs/_site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

- name: Make sure the cache works
run: |
mv docs/docs .lake/build/doc
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

*.olean
/_target
/.lake
/doc-gen
/build
/leanpkg.path
/lake-packages
/leanpkg.path

decls.pickle
decls.yaml
Expand Down
6 changes: 4 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This is run when starting a Gitpod workspace on this repository

image: leanprovercommunity/mathlib:gitpod

vscode:
extensions:
- jroesch.lean
- leanprover.lean4 # install the Lean 4 VS Code extension

tasks:
- command: . /home/gitpod/.profile && scripts/get_cache.sh
- command: . /home/gitpod/.profile && lake exe cache get # Download cache
39 changes: 0 additions & 39 deletions Dockerfile

This file was deleted.

45 changes: 6 additions & 39 deletions LeanCamCombi.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import LeanCamCombi.Archive.CauchyDavenportFromKneser
import LeanCamCombi.BernoulliSeq
import LeanCamCombi.DiscreteDeriv
import LeanCamCombi.ErdosRenyi.Basic
Expand All @@ -7,30 +8,22 @@ import LeanCamCombi.ErdosRenyi.GiantComponent
import LeanCamCombi.ExampleSheets.Graph.ES1
import LeanCamCombi.ExampleSheets.Graph.ES2
import LeanCamCombi.Incidence
import LeanCamCombi.Kneser.CauchyDavenport
import LeanCamCombi.Kneser.CauchyDavenportFromKneser
import LeanCamCombi.Kneser.Impact
import LeanCamCombi.Kneser.Kneser
import LeanCamCombi.Kneser.KneserRuzsa
import LeanCamCombi.Kneser.Mathlib
import LeanCamCombi.Kneser.MulStab
import LeanCamCombi.KruskalKatona
import LeanCamCombi.LittlewoodOfford
import LeanCamCombi.Mathlib.Algebra.BigOperators.Basic
import LeanCamCombi.Mathlib.Algebra.BigOperators.LocallyFinite
import LeanCamCombi.Mathlib.Algebra.Group.Defs
import LeanCamCombi.Mathlib.Algebra.IndicatorFunction
import LeanCamCombi.Mathlib.Algebra.Order.Group.Defs
import LeanCamCombi.Mathlib.Algebra.Order.Monovary
import LeanCamCombi.Mathlib.Algebra.Order.Ring.Canonical
import LeanCamCombi.Mathlib.Algebra.Order.Ring.Defs
import LeanCamCombi.Mathlib.Analysis.Convex.Basic
import LeanCamCombi.Mathlib.Analysis.Convex.Combination
import LeanCamCombi.Mathlib.Analysis.Convex.Exposed
import LeanCamCombi.Mathlib.Analysis.Convex.Extreme
import LeanCamCombi.Mathlib.Analysis.Convex.Independence
import LeanCamCombi.Mathlib.Analysis.Convex.Mul
import LeanCamCombi.Mathlib.Analysis.Convex.SimplicialComplex.Basic
import LeanCamCombi.Mathlib.Combinatorics.Additive.MulETransform
import LeanCamCombi.Mathlib.Combinatorics.Colex
import LeanCamCombi.Mathlib.Combinatorics.SetFamily.AhlswedeZhang
import LeanCamCombi.Mathlib.Combinatorics.SetFamily.Shatter
Expand All @@ -46,57 +39,31 @@ import LeanCamCombi.Mathlib.Data.Finset.Lattice
import LeanCamCombi.Mathlib.Data.Finset.Pointwise
import LeanCamCombi.Mathlib.Data.Finset.PosDiffs
import LeanCamCombi.Mathlib.Data.Fintype.Basic
import LeanCamCombi.Mathlib.Data.List.Basic
import LeanCamCombi.Mathlib.Data.Nat.Factorization.Basic
import LeanCamCombi.Mathlib.Data.Nat.Factors
import LeanCamCombi.Mathlib.Data.Nat.Lattice
import LeanCamCombi.Mathlib.Data.Nat.Order.Lemmas
import LeanCamCombi.Mathlib.Data.Nat.Squarefree
import LeanCamCombi.Mathlib.Data.Set.Equitable
import LeanCamCombi.Mathlib.Data.Set.Finite
import LeanCamCombi.Mathlib.Data.Set.Image
import LeanCamCombi.Mathlib.Data.Set.Pointwise.SMul
import LeanCamCombi.Mathlib.Data.Set.Prod
import LeanCamCombi.Mathlib.Data.Sym.Sym2
import LeanCamCombi.Mathlib.Data.ZMod.Defs
import LeanCamCombi.Mathlib.Data.ZMod.Quotient
import LeanCamCombi.Mathlib.GroupTheory.GroupAction.Defs
import LeanCamCombi.Mathlib.GroupTheory.MinOrder
import LeanCamCombi.Mathlib.GroupTheory.OrderOfElement
import LeanCamCombi.Mathlib.GroupTheory.QuotientGroup
import LeanCamCombi.Mathlib.GroupTheory.SpecificGroups.Cyclic
import LeanCamCombi.Mathlib.GroupTheory.Subgroup.Actions
import LeanCamCombi.Mathlib.GroupTheory.Subgroup.Basic
import LeanCamCombi.Mathlib.GroupTheory.Subgroup.Stabilizer
import LeanCamCombi.Mathlib.GroupTheory.Subgroup.ZPowers
import LeanCamCombi.Mathlib.GroupTheory.Submonoid.Membership
import LeanCamCombi.Mathlib.GroupTheory.Submonoid.Operations
import LeanCamCombi.Mathlib.GroupTheory.Torsion
import LeanCamCombi.Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
import LeanCamCombi.Mathlib.LinearAlgebra.AffineSpace.Independent
import LeanCamCombi.Mathlib.Logic.Basic
import LeanCamCombi.Mathlib.Logic.Nontrivial.Basic
import LeanCamCombi.Mathlib.Logic.Relation
import LeanCamCombi.Mathlib.MeasureTheory.Measure.MeasureSpace
import LeanCamCombi.Mathlib.NumberTheory.MaricaSchoenheim
import LeanCamCombi.Mathlib.MeasureTheory.Measure.Typeclasses
import LeanCamCombi.Mathlib.Order.Category.BoolAlg
import LeanCamCombi.Mathlib.Order.ConditionallyCompleteLattice.Basic
import LeanCamCombi.Mathlib.Order.Disjoint
import LeanCamCombi.Mathlib.Order.Hom.Lattice
import LeanCamCombi.Mathlib.Order.Hom.Set
import LeanCamCombi.Mathlib.Order.LocallyFinite
import LeanCamCombi.Mathlib.Order.Partition.Equipartition
import LeanCamCombi.Mathlib.Order.Partition.Finpartition
import LeanCamCombi.Mathlib.Order.Sublattice
import LeanCamCombi.Mathlib.Order.SupClosed
import LeanCamCombi.Mathlib.Probability.Independence.Basic
import LeanCamCombi.Mathlib.Probability.ProbabilityMassFunction.Constructions
import LeanCamCombi.Mathlib.SetTheory.Cardinal.Basic
import LeanCamCombi.Mathlib.SetTheory.Cardinal.Finite
import LeanCamCombi.MetricBetween
import LeanCamCombi.MinkowskiCaratheodory
import LeanCamCombi.SimplicialComplex.Basic
import LeanCamCombi.SimplicialComplex.Finite
import LeanCamCombi.SimplicialComplex.Pure
import LeanCamCombi.SimplicialComplex.Simplex
import LeanCamCombi.SimplicialComplex.Skeleton
import LeanCamCombi.SimplicialComplex.Subdivision
import LeanCamCombi.SylvesterChvatal
import LeanCamCombi.VanDenBergKesten
37 changes: 37 additions & 0 deletions LeanCamCombi/Archive/CauchyDavenportFromKneser.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/-
Copyright (c) 2023 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies
-/
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import LeanCamCombi.Mathlib.Data.Finset.Pointwise
import LeanCamCombi.Kneser.Kneser

/-!
# The Cauchy-Davenport theorem as a corollary of Kneser's lemma
This file proves the Cauchy-Davenport theorem as a corollary of Kneser's lemma.
## Main declarations
* `ZMod.min_le_card_add'`: The Cauchy-Davenport theorem.
## Tags
additive combinatorics, number theory, sumset, cauchy-davenport
-/

open Finset
open scoped Pointwise

/-- The **Cauchy-Davenport Theorem**. -/
lemma ZMod.min_le_card_add' {p : ℕ} (hp : p.Prime) {s t : Finset (ZMod p)} (hs : s.Nonempty)
(ht : t.Nonempty) : min p (s.card + t.card - 1) ≤ (s + t).card := by
haveI : Fact p.Prime := ⟨hp⟩
obtain h | h := eq_bot_or_eq_top (AddAction.stabilizer (ZMod p) (s + t))
· refine' min_le_of_right_le _
rw [← AddSubgroup.coe_eq_zero, ← coe_addStab (hs.add ht), coe_eq_zero] at h
simpa [*] using add_kneser s t
· rw [← AddSubgroup.coe_eq_univ, ← coe_addStab (hs.add ht), coe_eq_univ] at h
refine' card_addStab_le_card.trans' _
simp [*, card_univ]
Loading

0 comments on commit df76e13

Please sign in to comment.