Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(group/perm/sign): swap_adj_induction_on #3770

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1c5955d
feat(data/list/basic): Added Mario's lemma pmap_map
zhangir-azerbayev Aug 12, 2020
e1325c6
added lemmas about permutations of fin n
zhangir-azerbayev Aug 12, 2020
b92773d
feat(linear_algebra/multilinear): added the multinear algebra_prod
zhangir-azerbayev Aug 13, 2020
52ee962
feat(linear_algebra/alternating): made linear_algebra/alternating
zhangir-azerbayev Aug 13, 2020
84a3ec5
feat(group_theory/units_action): added units actions
zhangir-azerbayev Aug 13, 2020
1fbd7ea
feat(group_theory/perm/sign) added swap_induction_on'
zhangir-azerbayev Aug 13, 2020
abd3f20
feat(group_theory/group_action: removed units action
zhangir-azerbayev Aug 13, 2020
ae37390
feat(linear_algebra/alternating): added map_perm
zhangir-azerbayev Aug 13, 2020
1017e4e
feat(linear_algebra/alternating: added map_perm
zhangir-azerbayev Aug 13, 2020
d280196
chore(linear_algebra/multilinear, linear_algebra/alternating): cleane…
zhangir-azerbayev Aug 13, 2020
a7a29e2
doc(linear_algebra/alternating): added documentation
zhangir-azerbayev Aug 13, 2020
3f77cbe
style(linear_algebra/alternating): did reviewer suggestions for alter…
zhangir-azerbayev Aug 14, 2020
9529e4d
style(data/list/basic) did reviewer suggestions
zhangir-azerbayev Aug 14, 2020
b2a8c93
style(linear_algebra/multilinear): did reviewer suggestions
zhangir-azerbayev Aug 14, 2020
3fc73db
style(group_theory/perm/sign): reviewer suggestions
zhangir-azerbayev Aug 14, 2020
46ec7e7
style(linear_algebra/multilinear): indenting
zhangir-azerbayev Aug 14, 2020
8cd80b5
style(linear_algebra/multilinear): more indenting
zhangir-azerbayev Aug 14, 2020
6bdeff4
style(linear_algebra/multilinear: even more indenting
zhangir-azerbayev Aug 14, 2020
873ec4e
style(group_theory/perm/sign): more reviewer suggestions
zhangir-azerbayev Aug 14, 2020
1827a5c
feat(linear_algebra/alternating): semimodules over semirings
zhangir-azerbayev Aug 14, 2020
55fa7cc
fix(group_theory/perm/sign): removed unnecessary hypothesis from lemma
zhangir-azerbayev Aug 14, 2020
4665cf5
fix(linear_algebra/alternating, linear_algebra/multilinear): fixed li…
zhangir-azerbayev Aug 15, 2020
0efa5f5
Merge remote-tracking branch 'origin/master' into algebra_multilinear…
eric-wieser Nov 23, 2020
ba16987
chore(*): Remove definitions which now exist elsewhere
eric-wieser Nov 23, 2020
8f7b07e
chore(*): Fix proof broken by updates to fin in core lean
eric-wieser Nov 23, 2020
97bac66
chore(*): Fix linter error
eric-wieser Nov 23, 2020
6aa9f5f
Merge branch 'master' of github.com:leanprover-community/mathlib into…
eric-wieser Nov 24, 2020
765613d
chore(group_theory/perm/sign): Golf a proof
eric-wieser Nov 24, 2020
ffbeb5f
chore(group_theory/perm/sign): Golf another proof
eric-wieser Nov 24, 2020
eb5e386
chore(group_theory/perm/sign): Golf another proof
eric-wieser Nov 24, 2020
3ae70d9
Merge remote-tracking branch 'origin' into algebra_multilinear_maps
eric-wieser Dec 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions src/group_theory/perm/sign.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright (c) 2018 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes
-/
import tactic.linarith
import data.fintype.basic
import data.finset.sort
import algebra.group.conj
Expand Down Expand Up @@ -779,4 +780,106 @@ end

end sign

lemma prod_swap_adj_aug {n i j : ℕ} (hi : i < n) (hj : i + 1 ≤ j) (hj' : j + 1 < n)
{L : list (perm (fin n))}
(hL : L.prod = swap ⟨i, hi⟩ ⟨j, buffer.lt_aux_1 hj'⟩) :
([swap ⟨j, buffer.lt_aux_1 hj'⟩ ⟨j + 1, hj'⟩] ++ L ++
[swap ⟨j, buffer.lt_aux_1 hj'⟩ ⟨j + 1, hj'⟩] : list (perm $ fin n)).prod = swap ⟨i, hi⟩ ⟨j + 1, hj'⟩ :=
begin
rw [list.prod_append, list.prod_append, hL, list.prod_singleton],
rw swap_comm (⟨i, _⟩ : fin n) ⟨j + 1, _⟩,
apply swap_mul_swap_mul_swap,
{ apply ne_of_lt, exact hj },
{ apply ne_of_lt, show i < j+1, linarith }
end

lemma swap_eq_prod_swap_adj_aux (n : ℕ) {i j : fin n} (hij : i < j) : ∃ L : list (perm (fin n)),
L.prod = equiv.swap i j ∧ ∀ l ∈ L, ∃ k : fin n, ∃ h : ↑k + 1 < n,
l = equiv.swap k ⟨k + 1, h⟩ :=
begin
cases j with j hj,
cases i with i hi,
change i < j at hij,
revert hj,
refine nat.le_induction _ _ j (show i+1 ≤ j, from hij),
{ intro hj,
refine ⟨[swap (⟨i, hi⟩ : fin n) (⟨i + 1, hj⟩ : fin n)], _, _⟩,
{ exact list.prod_singleton, },
{ intros l hl,
refine ⟨⟨i, hi⟩, hj, list.mem_singleton.mp hl⟩, }, },
{ clear hij j,
intros j hj h hj',
have hjn : j < n := lt_trans (nat.lt_succ_self j) hj',
rcases h hjn with ⟨L, hL1, hL2⟩,
let M := [swap (⟨j, hjn⟩ : fin n) (⟨j+1, hj'⟩ : fin n)] ++ L ++ [swap (⟨j, hjn⟩ : fin n) (⟨j+1, hj'⟩)],
refine ⟨M, _, _⟩,
{ exact prod_swap_adj_aug hi hj hj' hL1, },
{ intros l hl,
rw [list.mem_append, list.mem_append, list.mem_singleton] at hl,
rcases hl with ⟨rfl | hl⟩ | rfl,
{ exact ⟨⟨j, hjn⟩, hj', rfl⟩ },
{ exact hL2 _ hl, },
{ exact ⟨⟨j, hjn⟩, hj', rfl⟩ }, }, },
end

lemma swap_eq_prod_swap_adj (n : ℕ) {i j : fin n} (hij : i ≠ j) : ∃ L : list (perm (fin n)),
L.prod = equiv.swap i j ∧ ∀ l ∈ L, ∃ k : fin n, ∃ h : ↑k + 1 < n,
l = equiv.swap k ⟨k + 1, h⟩ :=
begin
wlog h1 : i < j using [i j, j i],
{ rcases lt_trichotomy i j with h1 | rfl | h3,
{ left, assumption },
{ exfalso, cc },
{ right, assumption }, },
{ exact swap_eq_prod_swap_adj_aux n h1, },
{ symmetry' at hij,
rw swap_comm,
exact this hij }
end

lemma perm_eq_prod_swap_adj (n : ℕ) (f : perm $ fin n) : ∃ L : list (perm (fin n)),
L.prod = f ∧ ∀ l ∈ L, ∃ k : fin n, ∃ h : ↑k + 1 < n, l = equiv.swap k ⟨k + 1, h⟩ :=
begin
apply swap_induction_on f,
{ refine ⟨list.nil, rfl, _⟩,
intros l hl,
exfalso,
rw list.mem_nil_iff at hl,
assumption, },
{ rintros g x y hxy ⟨base, hbase_prod, hbase_mem⟩,
obtain ⟨add, hadd_prod, hadd_mem⟩ := swap_eq_prod_swap_adj n hxy,
refine ⟨add ++ base, _, _⟩,
{ rw [←hbase_prod, ←hadd_prod],
rw list.prod_append },
{ intros l hl,
rw list.mem_append at hl,
cases hl with hl_add hl_base,
{ exact hadd_mem l hl_add, },
{ exact hbase_mem l hl_base, }, }, },
end

@[elab_as_eliminator]
lemma swap_adj_induction_on {n : ℕ} {P : perm (fin n) → Prop} (f : equiv.perm $ fin n) :
P 1 → (∀ f (x y : fin n), ↑x + 1 = ↑y → P f → P (swap x y * f)) → P f :=
begin
cases perm_eq_prod_swap_adj n f with l hl,
induction l with g l ih generalizing f,
{ simp [hl.1.symm], cc, },
{ assume h1 hmul_swap,
rcases hl.2 g (by simp) with ⟨x, hx, hxy⟩,
rw [← hl.1, list.prod_cons, hxy],
exact hmul_swap l.prod x ⟨x + 1, hx⟩ (by simp)
(ih l.prod
begin
split, refl,
intros v hv,
exact hl.2 _ (list.mem_cons_of_mem _ hv),
end h1 hmul_swap), },
end

@[elab_as_eliminator]
lemma swap_adj_induction_on' {n : ℕ} {P : perm (fin n) → Prop} (f : equiv.perm $ fin n) :
P 1 → (∀ s (x y : fin n), ↑x + 1 = ↑y → P s → P (s * swap x y)) → P f :=
λ h1 IH, inv_inv f ▸ swap_adj_induction_on f⁻¹ h1 (λ f, IH f⁻¹)

end equiv.perm
20 changes: 20 additions & 0 deletions src/linear_algebra/multilinear.lean
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,26 @@ protected def pi_ring_equiv [fintype ι] : M₂ ≃ₗ[R] (multilinear_map R (

end comm_semiring

section algebra

variables (S : Type u) [comm_semiring S]
variables {N : Type u} [semiring N] [algebra S N]
variable {q : ℕ}
variable (ν : fin q → N)

@[priority 100] instance algebra_to_semimodule : semimodule S N := algebra.to_semimodule

/--
The multilinear map sending a vector of elements of a semiring to their product.
-/
def algebra_prod : multilinear_map S (λ i : fin q, N) N :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make sense for any fintype, not only fin q.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is precisely multilinear_map.mk_pi_algebra_fin, I think - so is no longer needed.

multilinear_map.mk_pi_algebra_fin S q N

lemma algebra_prod_split (ν : fin q.succ → N) :
algebra_prod S ν = (ν 0) * algebra_prod S (ν ∘ fin.succ) := by simp [algebra_prod]

end algebra

end multilinear_map

section currying
Expand Down