refactor(library/data/finset/comb,library/data/set/basic,library/*): rename 'filter' to 'sep' to free up 'set.filter'
This commit is contained in:
parent
4b39400439
commit
8f815cabc0
11 changed files with 107 additions and 107 deletions
|
@ -111,61 +111,61 @@ ext (take y, iff.intro
|
|||
mem_image (mem_union_r xt) fxy)))
|
||||
end image
|
||||
|
||||
/- filter and set-builder notation -/
|
||||
section filter
|
||||
/- separation and set-builder notation -/
|
||||
section sep
|
||||
variables {A : Type} [deceq : decidable_eq A]
|
||||
include deceq
|
||||
variables (p : A → Prop) [decp : decidable_pred p] (s : finset A) {x : A}
|
||||
include decp
|
||||
|
||||
definition filter : finset A :=
|
||||
definition sep : finset A :=
|
||||
quot.lift_on s
|
||||
(λl, to_finset_of_nodup
|
||||
(list.filter p (subtype.elt_of l))
|
||||
(list.nodup_filter p (subtype.has_property l)))
|
||||
(λ l₁ l₂ u, quot.sound (perm.perm_filter u))
|
||||
|
||||
notation [priority finset.prio] `{` binder ∈ s `|` r:(scoped:1 p, filter p s) `}` := r
|
||||
notation [priority finset.prio] `{` binder ∈ s `|` r:(scoped:1 p, sep p s) `}` := r
|
||||
|
||||
theorem filter_empty : filter p ∅ = ∅ := rfl
|
||||
theorem sep_empty : sep p ∅ = ∅ := rfl
|
||||
|
||||
variables {p s}
|
||||
|
||||
theorem of_mem_filter : x ∈ filter p s → p x :=
|
||||
theorem of_mem_sep : x ∈ sep p s → p x :=
|
||||
quot.induction_on s (take l, list.of_mem_filter)
|
||||
|
||||
theorem mem_of_mem_filter : x ∈ filter p s → x ∈ s :=
|
||||
theorem mem_of_mem_sep : x ∈ sep p s → x ∈ s :=
|
||||
quot.induction_on s (take l, list.mem_of_mem_filter)
|
||||
|
||||
theorem mem_filter_of_mem {x : A} : x ∈ s → p x → x ∈ filter p s :=
|
||||
theorem mem_sep_of_mem {x : A} : x ∈ s → p x → x ∈ sep p s :=
|
||||
quot.induction_on s (take l, list.mem_filter_of_mem)
|
||||
|
||||
variables (p s)
|
||||
|
||||
theorem mem_filter_iff : x ∈ filter p s ↔ x ∈ s ∧ p x :=
|
||||
theorem mem_sep_iff : x ∈ sep p s ↔ x ∈ s ∧ p x :=
|
||||
iff.intro
|
||||
(assume H, and.intro (mem_of_mem_filter H) (of_mem_filter H))
|
||||
(assume H, mem_filter_of_mem (and.left H) (and.right H))
|
||||
(assume H, and.intro (mem_of_mem_sep H) (of_mem_sep H))
|
||||
(assume H, mem_sep_of_mem (and.left H) (and.right H))
|
||||
|
||||
theorem mem_filter_eq : x ∈ filter p s = (x ∈ s ∧ p x) :=
|
||||
propext !mem_filter_iff
|
||||
theorem mem_sep_eq : x ∈ sep p s = (x ∈ s ∧ p x) :=
|
||||
propext !mem_sep_iff
|
||||
|
||||
variable t : finset A
|
||||
|
||||
theorem mem_filter_union_iff : x ∈ filter p (s ∪ t) ↔ x ∈ filter p s ∨ x ∈ filter p t :=
|
||||
by rewrite [*mem_filter_iff, mem_union_iff, and.right_distrib]
|
||||
theorem mem_sep_union_iff : x ∈ sep p (s ∪ t) ↔ x ∈ sep p s ∨ x ∈ sep p t :=
|
||||
by rewrite [*mem_sep_iff, mem_union_iff, and.right_distrib]
|
||||
|
||||
end filter
|
||||
end sep
|
||||
|
||||
section
|
||||
|
||||
variables {A : Type} [deceqA : decidable_eq A]
|
||||
include deceqA
|
||||
|
||||
theorem eq_filter_of_subset {s t : finset A} (ssubt : s ⊆ t) : s = {x ∈ t | x ∈ s} :=
|
||||
theorem eq_sep_of_subset {s t : finset A} (ssubt : s ⊆ t) : s = {x ∈ t | x ∈ s} :=
|
||||
ext (take x, iff.intro
|
||||
(suppose x ∈ s, mem_filter_of_mem (mem_of_subset_of_mem ssubt this) this)
|
||||
(suppose x ∈ {x ∈ t | x ∈ s}, of_mem_filter this))
|
||||
(suppose x ∈ s, mem_sep_of_mem (mem_of_subset_of_mem ssubt this) this)
|
||||
(suppose x ∈ {x ∈ t | x ∈ s}, of_mem_sep this))
|
||||
|
||||
theorem mem_singleton_eq' (x a : A) : x ∈ '{a} = (x = a) :=
|
||||
by rewrite [mem_insert_eq, mem_empty_eq, or_false]
|
||||
|
@ -181,13 +181,13 @@ definition diff (s t : finset A) : finset A := {x ∈ s | x ∉ t}
|
|||
infix [priority finset.prio] `\`:70 := diff
|
||||
|
||||
theorem mem_of_mem_diff {s t : finset A} {x : A} (H : x ∈ s \ t) : x ∈ s :=
|
||||
mem_of_mem_filter H
|
||||
mem_of_mem_sep H
|
||||
|
||||
theorem not_mem_of_mem_diff {s t : finset A} {x : A} (H : x ∈ s \ t) : x ∉ t :=
|
||||
of_mem_filter H
|
||||
of_mem_sep H
|
||||
|
||||
theorem mem_diff {s t : finset A} {x : A} (H1 : x ∈ s) (H2 : x ∉ t) : x ∈ s \ t :=
|
||||
mem_filter_of_mem H1 H2
|
||||
mem_sep_of_mem H1 H2
|
||||
|
||||
theorem mem_diff_iff (s t : finset A) (x : A) : x ∈ s \ t ↔ x ∈ s ∧ x ∉ t :=
|
||||
iff.intro
|
||||
|
|
|
@ -77,22 +77,22 @@ lemma binary_union (P : A → Prop) [decP : decidable_pred P] {S : finset A} :
|
|||
S = {a ∈ S | P a} ∪ {a ∈ S | ¬(P a)} :=
|
||||
ext take a, iff.intro
|
||||
(suppose a ∈ S, decidable.by_cases
|
||||
(suppose P a, mem_union_l (mem_filter_of_mem `a ∈ S` this))
|
||||
(suppose ¬ P a, mem_union_r (mem_filter_of_mem `a ∈ S` this)))
|
||||
(suppose a ∈ filter P S ∪ {a ∈ S | ¬ P a}, or.elim (mem_or_mem_of_mem_union this)
|
||||
(suppose a ∈ filter P S, mem_of_mem_filter this)
|
||||
(suppose a ∈ {a ∈ S | ¬ P a}, mem_of_mem_filter this))
|
||||
(suppose P a, mem_union_l (mem_sep_of_mem `a ∈ S` this))
|
||||
(suppose ¬ P a, mem_union_r (mem_sep_of_mem `a ∈ S` this)))
|
||||
(suppose a ∈ sep P S ∪ {a ∈ S | ¬ P a}, or.elim (mem_or_mem_of_mem_union this)
|
||||
(suppose a ∈ sep P S, mem_of_mem_sep this)
|
||||
(suppose a ∈ {a ∈ S | ¬ P a}, mem_of_mem_sep this))
|
||||
|
||||
lemma binary_inter_empty {P : A → Prop} [decP : decidable_pred P] {S : finset A} :
|
||||
{a ∈ S | P a} ∩ {a ∈ S | ¬(P a)} = ∅ :=
|
||||
inter_eq_empty (take a, assume Pa nPa, absurd (of_mem_filter Pa) (of_mem_filter nPa))
|
||||
inter_eq_empty (take a, assume Pa nPa, absurd (of_mem_sep Pa) (of_mem_sep nPa))
|
||||
|
||||
definition disjoint_sets (S : finset (finset A)) : Prop :=
|
||||
∀ s₁ s₂ (P₁ : s₁ ∈ S) (P₂ : s₂ ∈ S), s₁ ≠ s₂ → s₁ ∩ s₂ = ∅
|
||||
|
||||
lemma disjoint_sets_filter_of_disjoint_sets {P : finset A → Prop} [decP : decidable_pred P] {S : finset (finset A)} :
|
||||
lemma disjoint_sets_sep_of_disjoint_sets {P : finset A → Prop} [decP : decidable_pred P] {S : finset (finset A)} :
|
||||
disjoint_sets S → disjoint_sets {s ∈ S | P s} :=
|
||||
assume Pds, take s₁ s₂, assume P₁ P₂, Pds s₁ s₂ (mem_of_mem_filter P₁) (mem_of_mem_filter P₂)
|
||||
assume Pds, take s₁ s₂, assume P₁ P₂, Pds s₁ s₂ (mem_of_mem_sep P₁) (mem_of_mem_sep P₂)
|
||||
|
||||
lemma binary_inter_empty_Union_disjoint_sets {P : finset A → Prop} [decP : decidable_pred P] {S : finset (finset A)} :
|
||||
disjoint_sets S → Union {s ∈ S | P s} id ∩ Union {s ∈ S | ¬P s} id = ∅ :=
|
||||
|
@ -100,8 +100,8 @@ assume Pds, inter_eq_empty (take a, assume Pa nPa,
|
|||
obtain s Psin Pains, from iff.elim_left !mem_Union_iff Pa,
|
||||
obtain t Ptin Paint, from iff.elim_left !mem_Union_iff nPa,
|
||||
assert s ≠ t,
|
||||
from assume Peq, absurd (Peq ▸ of_mem_filter Psin) (of_mem_filter Ptin),
|
||||
Pds s t (mem_of_mem_filter Psin) (mem_of_mem_filter Ptin) `s ≠ t` ▸ mem_inter Pains Paint)
|
||||
from assume Peq, absurd (Peq ▸ of_mem_sep Psin) (of_mem_sep Ptin),
|
||||
Pds s t (mem_of_mem_sep Psin) (mem_of_mem_sep Ptin) `s ≠ t` ▸ mem_inter Pains Paint)
|
||||
|
||||
section
|
||||
variables {B: Type} [deceqB : decidable_eq B]
|
||||
|
@ -134,7 +134,7 @@ assume Pds, calc
|
|||
card (Union S id)
|
||||
= card (Union {s ∈ S | P s} id ∪ Union {s ∈ S | ¬P s} id) : binary_Union
|
||||
... = card (Union {s ∈ S | P s} id) + card (Union {s ∈ S | ¬P s} id) : card_union_of_disjoint (binary_inter_empty_Union_disjoint_sets Pds)
|
||||
... = Sum {s ∈ S | P s} card + Sum {s ∈ S | ¬P s} card : by rewrite [*(card_Union_of_disjoint _ id (disjoint_sets_filter_of_disjoint_sets Pds))]
|
||||
... = Sum {s ∈ S | P s} card + Sum {s ∈ S | ¬P s} card : by rewrite [*(card_Union_of_disjoint _ id (disjoint_sets_sep_of_disjoint_sets Pds))]
|
||||
|
||||
end partition
|
||||
end finset
|
||||
|
|
|
@ -52,10 +52,10 @@ theorem to_set_inter : ts (s ∩ t) = ts s ∩ ts t := funext (λ x, !mem_to_set
|
|||
theorem mem_to_set_diff : x ∈ s \ t = (x ∈ ts s \ ts t) := !mem_diff_eq
|
||||
theorem to_set_diff : ts (s \ t) = ts s \ ts t := funext (λ x, !mem_to_set_diff)
|
||||
|
||||
theorem mem_to_set_filter (p : A → Prop) [h : decidable_pred p] : x ∈ filter p s = (x ∈ set.filter p s) :=
|
||||
!finset.mem_filter_eq
|
||||
theorem to_set_filter (p : A → Prop) [h : decidable_pred p] : filter p s = set.filter p s :=
|
||||
funext (λ x, !mem_to_set_filter)
|
||||
theorem mem_to_set_sep (p : A → Prop) [h : decidable_pred p] : x ∈ sep p s = (x ∈ set.sep p s) :=
|
||||
!finset.mem_sep_eq
|
||||
theorem to_set_sep (p : A → Prop) [h : decidable_pred p] : sep p s = set.sep p s :=
|
||||
funext (λ x, !mem_to_set_sep)
|
||||
|
||||
theorem mem_to_set_image {B : Type} [h : decidable_eq B] (f : A → B) {s : finset A} {y : B} :
|
||||
y ∈ image f s = (y ∈ set.image f s) := !mem_image_eq
|
||||
|
|
|
@ -175,8 +175,8 @@ definition set_of (P : X → Prop) : set X := P
|
|||
notation `{` binder `|` r:(scoped:1 P, set_of P) `}` := r
|
||||
|
||||
-- {x ∈ s | P}
|
||||
definition filter (P : X → Prop) (s : set X) : set X := λx, x ∈ s ∧ P x
|
||||
notation `{` binder ∈ s `|` r:(scoped:1 p, filter p s) `}` := r
|
||||
definition sep (P : X → Prop) (s : set X) : set X := λx, x ∈ s ∧ P x
|
||||
notation `{` binder ∈ s `|` r:(scoped:1 p, sep p s) `}` := r
|
||||
|
||||
/- insert -/
|
||||
|
||||
|
@ -188,9 +188,9 @@ notation `'{`:max a:(foldr `,` (x b, insert x b) ∅) `}`:0 := a
|
|||
theorem subset_insert (x : X) (a : set X) : a ⊆ insert x a :=
|
||||
take y, assume ys, or.inr ys
|
||||
|
||||
/- filter -/
|
||||
/- separation -/
|
||||
|
||||
theorem eq_filter_of_subset {s t : set X} (ssubt : s ⊆ t) : s = {x ∈ t | x ∈ s} :=
|
||||
theorem eq_sep_of_subset {s t : set X} (ssubt : s ⊆ t) : s = {x ∈ t | x ∈ s} :=
|
||||
setext (take x, iff.intro
|
||||
(suppose x ∈ s, and.intro (ssubt this) this)
|
||||
(suppose x ∈ {x ∈ t | x ∈ s}, and.right this))
|
||||
|
|
|
@ -85,15 +85,15 @@ theorem to_finset_inter (s t : set A) [fins : finite s] [fint : finite t] :
|
|||
to_finset (s ∩ t) = (#finset to_finset s ∩ to_finset t) :=
|
||||
by apply to_finset_eq_of_to_set_eq; rewrite [finset.to_set_inter, *to_set_to_finset]
|
||||
|
||||
theorem finite_filter [instance] (s : set A) (p : A → Prop) [h : decidable_pred p]
|
||||
theorem finite_sep [instance] (s : set A) (p : A → Prop) [h : decidable_pred p]
|
||||
[fins : finite s] :
|
||||
finite {x ∈ s | p x} :=
|
||||
exists.intro (finset.filter p (to_finset s))
|
||||
(by rewrite [finset.to_set_filter, *to_set_to_finset])
|
||||
exists.intro (finset.sep p (to_finset s))
|
||||
(by rewrite [finset.to_set_sep, *to_set_to_finset])
|
||||
|
||||
theorem to_finset_filter (s : set A) (p : A → Prop) [h : decidable_pred p] [fins : finite s] :
|
||||
theorem to_finset_sep (s : set A) (p : A → Prop) [h : decidable_pred p] [fins : finite s] :
|
||||
to_finset {x ∈ s | p x} = (#finset {x ∈ to_finset s | p x}) :=
|
||||
by apply to_finset_eq_of_to_set_eq; rewrite [finset.to_set_filter, to_set_to_finset]
|
||||
by apply to_finset_eq_of_to_set_eq; rewrite [finset.to_set_sep, to_set_to_finset]
|
||||
|
||||
theorem finite_image [instance] {B : Type} [h : decidable_eq B] (f : A → B) (s : set A)
|
||||
[fins : finite s] :
|
||||
|
@ -107,14 +107,14 @@ theorem to_finset_image {B : Type} [h : decidable_eq B] (f : A → B) (s : set A
|
|||
by apply to_finset_eq_of_to_set_eq; rewrite [finset.to_set_image, to_set_to_finset]
|
||||
|
||||
theorem finite_diff [instance] (s t : set A) [fins : finite s] : finite (s \ t) :=
|
||||
!finite_filter
|
||||
!finite_sep
|
||||
|
||||
theorem to_finset_diff (s t : set A) [fins : finite s] [fint : finite t] :
|
||||
to_finset (s \ t) = (#finset to_finset s \ to_finset t) :=
|
||||
by apply to_finset_eq_of_to_set_eq; rewrite [finset.to_set_diff, *to_set_to_finset]
|
||||
|
||||
theorem finite_subset {s t : set A} [fint : finite t] (ssubt : s ⊆ t) : finite s :=
|
||||
by rewrite (eq_filter_of_subset ssubt); apply finite_filter
|
||||
by rewrite (eq_sep_of_subset ssubt); apply finite_sep
|
||||
|
||||
theorem to_finset_subset_to_finset_eq (s t : set A) [fins : finite s] [fint : finite t] :
|
||||
(#finset to_finset s ⊆ to_finset t) = (s ⊆ t) :=
|
||||
|
|
|
@ -128,17 +128,17 @@ include deceqA
|
|||
private theorem aux₀ (s : finset A) : {t ∈ powerset s | card t = 0} = '{∅} :=
|
||||
ext (take t, iff.intro
|
||||
(assume H,
|
||||
assert t = ∅, from eq_empty_of_card_eq_zero (of_mem_filter H),
|
||||
assert t = ∅, from eq_empty_of_card_eq_zero (of_mem_sep H),
|
||||
show t ∈ '{ ∅ }, by rewrite [this, mem_singleton_eq'])
|
||||
(assume H,
|
||||
assert t = ∅, by rewrite mem_singleton_eq' at H; assumption,
|
||||
by substvars; exact mem_filter_of_mem !empty_mem_powerset rfl))
|
||||
by substvars; exact mem_sep_of_mem !empty_mem_powerset rfl))
|
||||
|
||||
private theorem aux₁ (k : ℕ) : {t ∈ powerset (∅ : finset A) | card t = succ k} = ∅ :=
|
||||
eq_empty_of_forall_not_mem (take t, assume H,
|
||||
assert t ∈ powerset ∅, from mem_of_mem_filter H,
|
||||
assert t ∈ powerset ∅, from mem_of_mem_sep H,
|
||||
assert t = ∅, by rewrite [powerset_empty at this, mem_singleton_eq' at this]; assumption,
|
||||
have card (∅ : finset A) = succ k, by rewrite -this; apply of_mem_filter H,
|
||||
have card (∅ : finset A) = succ k, by rewrite -this; apply of_mem_sep H,
|
||||
nat.no_confusion this)
|
||||
|
||||
private theorem aux₂ {a : A} {s t : finset A} (anins : a ∉ s) (tpows : t ∈ powerset s) : a ∉ t :=
|
||||
|
@ -160,11 +160,11 @@ iff.intro
|
|||
anins this),
|
||||
assert t' = erase a t, by rewrite [-teq, erase_insert (aux₂ anins t'pows)],
|
||||
have card t' = k, by rewrite [this, card_erase_of_mem aint, cardt],
|
||||
mem_image (mem_filter_of_mem t'pows this) teq)
|
||||
mem_image (mem_sep_of_mem t'pows this) teq)
|
||||
(assume H,
|
||||
obtain t' [Ht' (teq : insert a t' = t)], from exists_of_mem_image H,
|
||||
assert t'pows : t' ∈ powerset s, from mem_of_mem_filter Ht',
|
||||
assert cardt' : card t' = k, from of_mem_filter Ht',
|
||||
assert t'pows : t' ∈ powerset s, from mem_of_mem_sep Ht',
|
||||
assert cardt' : card t' = k, from of_mem_sep Ht',
|
||||
and.intro
|
||||
(show t ∈ (insert a) '[powerset s], from mem_image t'pows teq)
|
||||
(show card t = succ k,
|
||||
|
@ -175,7 +175,7 @@ private theorem aux₄ {a : A} {s : finset A} (anins : a ∉ s) (k : ℕ) :
|
|||
{t ∈ powerset s | card t = succ k} ∪ (insert a) '[{t ∈ powerset s | card t = k}] :=
|
||||
begin
|
||||
apply ext, intro t,
|
||||
rewrite [powerset_insert anins, mem_union_iff, *mem_filter_iff, mem_union_iff, and.right_distrib,
|
||||
rewrite [powerset_insert anins, mem_union_iff, *mem_sep_iff, mem_union_iff, and.right_distrib,
|
||||
aux₃ anins]
|
||||
end
|
||||
|
||||
|
@ -183,7 +183,7 @@ private theorem aux₅ {a : A} {s : finset A} (anins : a ∉ s) (k : ℕ) :
|
|||
{t ∈ powerset s | card t = succ k} ∩ (insert a) '[{t ∈ powerset s | card t = k}] = ∅ :=
|
||||
inter_eq_empty
|
||||
(take t, assume Ht₁ Ht₂,
|
||||
have tpows : t ∈ powerset s, from mem_of_mem_filter Ht₁,
|
||||
have tpows : t ∈ powerset s, from mem_of_mem_sep Ht₁,
|
||||
have anint : a ∉ t, from aux₂ anins tpows,
|
||||
obtain t' [Ht' (teq : insert a t' = t)], from exists_of_mem_image Ht₂,
|
||||
have aint : a ∈ t, by rewrite -teq; apply mem_insert,
|
||||
|
@ -194,9 +194,9 @@ private theorem aux₆ {a : A} {s : finset A} (anins : a ∉ s) (k : ℕ) :
|
|||
have set.inj_on (insert a) (ts {t ∈ powerset s| card t = k}), from
|
||||
take t₁ t₂, assume Ht₁ Ht₂,
|
||||
assume Heq : insert a t₁ = insert a t₂,
|
||||
have t₁ ∈ powerset s, from mem_of_mem_filter Ht₁,
|
||||
have t₁ ∈ powerset s, from mem_of_mem_sep Ht₁,
|
||||
assert anint₁ : a ∉ t₁, from aux₂ anins this,
|
||||
have t₂ ∈ powerset s, from mem_of_mem_filter Ht₂,
|
||||
have t₂ ∈ powerset s, from mem_of_mem_sep Ht₂,
|
||||
assert anint₂ : a ∉ t₂, from aux₂ anins this,
|
||||
calc
|
||||
t₁ = erase a (insert a t₁) : by rewrite (erase_insert anint₁)
|
||||
|
|
|
@ -72,11 +72,11 @@ lemma is_fixed_point_of_mem_fixed_points :
|
|||
a ∈ fixed_points hom H → is_fixed_point hom H a :=
|
||||
assume Pain, take h, assume Phin,
|
||||
eq_of_mem_singleton
|
||||
(of_mem_filter Pain ▸ orbit_of_exists (exists.intro h (and.intro Phin rfl)))
|
||||
(of_mem_sep Pain ▸ orbit_of_exists (exists.intro h (and.intro Phin rfl)))
|
||||
|
||||
lemma mem_fixed_points_of_exists_of_is_fixed_point :
|
||||
(∃ h, h ∈ H) → is_fixed_point hom H a → a ∈ fixed_points hom H :=
|
||||
assume Pex Pfp, mem_filter_of_mem !mem_univ
|
||||
assume Pex Pfp, mem_sep_of_mem !mem_univ
|
||||
(ext take x, iff.intro
|
||||
(assume Porb, obtain h Phin Pha, from exists_of_orbit Porb,
|
||||
by rewrite [mem_singleton_eq, -Pha, Pfp h Phin])
|
||||
|
@ -122,19 +122,19 @@ rfl
|
|||
|
||||
lemma stab_lmul {f g : G} : g ∈ stab hom H a → hom (f*g) a = hom f a :=
|
||||
assume Pgstab,
|
||||
assert hom g a = a, from of_mem_filter Pgstab, calc
|
||||
assert hom g a = a, from of_mem_sep Pgstab, calc
|
||||
hom (f*g) a = perm.f ((hom f) * (hom g)) a : is_hom hom
|
||||
... = ((hom f) ∘ (hom g)) a : by rewrite perm_f_mul
|
||||
... = (hom f) a : by unfold compose; rewrite this
|
||||
|
||||
lemma stab_subset : stab hom H a ⊆ H :=
|
||||
begin
|
||||
apply subset_of_forall, intro f Pfstab, apply mem_of_mem_filter Pfstab
|
||||
apply subset_of_forall, intro f Pfstab, apply mem_of_mem_sep Pfstab
|
||||
end
|
||||
|
||||
lemma reverse_move {h g : G} : g ∈ moverset hom H a (hom h a) → hom (h⁻¹*g) a = a :=
|
||||
assume Pg,
|
||||
assert hom g a = hom h a, from of_mem_filter Pg, calc
|
||||
assert hom g a = hom h a, from of_mem_sep Pg, calc
|
||||
hom (h⁻¹*g) a = perm.f ((hom h⁻¹) * (hom g)) a : by rewrite (is_hom hom)
|
||||
... = ((hom h⁻¹) ∘ hom g) a : by rewrite perm_f_mul
|
||||
... = perm.f ((hom h)⁻¹ * hom h) a : by unfold compose; rewrite [this, perm_f_mul, hom_map_inv hom h]
|
||||
|
@ -145,11 +145,11 @@ lemma moverset_inj_on_orbit : set.inj_on (moverset hom H a) (ts (orbit hom H a))
|
|||
take b1 b2,
|
||||
assume Pb1, obtain h1 Ph1₁ Ph1₂, from exists_of_orbit Pb1,
|
||||
assert Ph1b1 : h1 ∈ moverset hom H a b1,
|
||||
from mem_filter_of_mem Ph1₁ Ph1₂,
|
||||
from mem_sep_of_mem Ph1₁ Ph1₂,
|
||||
assume Psetb2 Pmeq, begin
|
||||
subst b1,
|
||||
rewrite Pmeq at Ph1b1,
|
||||
apply of_mem_filter Ph1b1
|
||||
apply of_mem_sep Ph1b1
|
||||
end
|
||||
|
||||
variable [subgH : is_finsubg H]
|
||||
|
@ -161,37 +161,37 @@ lemma subg_stab_of_move {h g : G} :
|
|||
assert Phinvg : h⁻¹*g ∈ H, from begin
|
||||
apply finsubg_mul_closed H,
|
||||
apply finsubg_has_inv H, assumption,
|
||||
apply mem_of_mem_filter Pg
|
||||
apply mem_of_mem_sep Pg
|
||||
end,
|
||||
mem_filter_of_mem Phinvg (reverse_move Pg)
|
||||
mem_sep_of_mem Phinvg (reverse_move Pg)
|
||||
|
||||
lemma subg_stab_closed : finset_mul_closed_on (stab hom H a) :=
|
||||
take f g, assume Pfstab, assert Pf : hom f a = a, from of_mem_filter Pfstab,
|
||||
take f g, assume Pfstab, assert Pf : hom f a = a, from of_mem_sep Pfstab,
|
||||
assume Pgstab,
|
||||
assert Pfg : hom (f*g) a = a, from calc
|
||||
hom (f*g) a = (hom f) a : stab_lmul Pgstab
|
||||
... = a : Pf,
|
||||
assert PfginH : (f*g) ∈ H,
|
||||
from finsubg_mul_closed H (mem_of_mem_filter Pfstab) (mem_of_mem_filter Pgstab),
|
||||
mem_filter_of_mem PfginH Pfg
|
||||
from finsubg_mul_closed H (mem_of_mem_sep Pfstab) (mem_of_mem_sep Pgstab),
|
||||
mem_sep_of_mem PfginH Pfg
|
||||
|
||||
lemma subg_stab_has_one : 1 ∈ stab hom H a :=
|
||||
assert P : hom 1 a = a, from calc
|
||||
hom 1 a = perm.f (1 : perm S) a : {hom_map_one hom}
|
||||
... = a : rfl,
|
||||
assert PoneinH : 1 ∈ H, from finsubg_has_one H,
|
||||
mem_filter_of_mem PoneinH P
|
||||
mem_sep_of_mem PoneinH P
|
||||
|
||||
lemma subg_stab_has_inv : finset_has_inv (stab hom H a) :=
|
||||
take f, assume Pfstab, assert Pf : hom f a = a, from of_mem_filter Pfstab,
|
||||
take f, assume Pfstab, assert Pf : hom f a = a, from of_mem_sep Pfstab,
|
||||
assert Pfinv : hom f⁻¹ a = a, from calc
|
||||
hom f⁻¹ a = hom f⁻¹ ((hom f) a) : by rewrite Pf
|
||||
... = perm.f ((hom f⁻¹) * (hom f)) a : by rewrite perm_f_mul
|
||||
... = hom (f⁻¹ * f) a : by rewrite (is_hom hom)
|
||||
... = hom 1 a : by rewrite mul.left_inv
|
||||
... = perm.f (1 : perm S) a : by rewrite (hom_map_one hom),
|
||||
assert PfinvinH : f⁻¹ ∈ H, from finsubg_has_inv H (mem_of_mem_filter Pfstab),
|
||||
mem_filter_of_mem PfinvinH Pfinv
|
||||
assert PfinvinH : f⁻¹ ∈ H, from finsubg_has_inv H (mem_of_mem_sep Pfstab),
|
||||
mem_sep_of_mem PfinvinH Pfinv
|
||||
|
||||
definition subg_stab_is_finsubg [instance] :
|
||||
is_finsubg (stab hom H a) :=
|
||||
|
@ -201,17 +201,17 @@ lemma subg_lcoset_eq_moverset {h : G} :
|
|||
h ∈ H → fin_lcoset (stab hom H a) h = moverset hom H a (hom h a) :=
|
||||
assume Ph, ext (take g, iff.intro
|
||||
(assume Pl, obtain f (Pf₁ : f ∈ stab hom H a) (Pf₂ : h*f = g), from exists_of_mem_image Pl,
|
||||
assert Pfstab : hom f a = a, from of_mem_filter Pf₁,
|
||||
assert Pfstab : hom f a = a, from of_mem_sep Pf₁,
|
||||
assert PginH : g ∈ H, begin
|
||||
subst Pf₂,
|
||||
apply finsubg_mul_closed H,
|
||||
assumption,
|
||||
apply mem_of_mem_filter Pf₁
|
||||
apply mem_of_mem_sep Pf₁
|
||||
end,
|
||||
assert Pga : hom g a = hom h a, from calc
|
||||
hom g a = hom (h*f) a : by subst g
|
||||
... = hom h a : stab_lmul Pf₁,
|
||||
mem_filter_of_mem PginH Pga)
|
||||
mem_sep_of_mem PginH Pga)
|
||||
(assume Pr, begin
|
||||
rewrite [↑fin_lcoset, mem_image_iff],
|
||||
existsi h⁻¹*g,
|
||||
|
@ -333,24 +333,24 @@ iff.elim_left (exists_iff_mem_orbits orb)
|
|||
lemma fixed_point_orbits_eq : fixed_point_orbits hom H = image (orbit hom H) (fixed_points hom H) :=
|
||||
ext take s, iff.intro
|
||||
(assume Pin,
|
||||
obtain Psin Ps, from iff.elim_left !mem_filter_iff Pin,
|
||||
obtain Psin Ps, from iff.elim_left !mem_sep_iff Pin,
|
||||
obtain a Pa, from exists_of_mem_orbits Psin,
|
||||
mem_image
|
||||
(mem_filter_of_mem !mem_univ (eq.symm
|
||||
(mem_sep_of_mem !mem_univ (eq.symm
|
||||
(eq_of_card_eq_of_subset (by rewrite [card_singleton, Pa, Ps])
|
||||
(subset_of_forall
|
||||
take x, assume Pxin, eq_of_mem_singleton Pxin ▸ in_orbit_refl))))
|
||||
Pa)
|
||||
(assume Pin,
|
||||
obtain a Pain Porba, from exists_of_mem_image Pin,
|
||||
mem_filter_of_mem
|
||||
mem_sep_of_mem
|
||||
(begin esimp [orbits, equiv_classes, orbit_partition], rewrite [mem_image_iff],
|
||||
existsi a, exact and.intro !mem_univ Porba end)
|
||||
(begin substvars, rewrite [of_mem_filter Pain] end))
|
||||
(begin substvars, rewrite [of_mem_sep Pain] end))
|
||||
|
||||
lemma orbit_inj_on_fixed_points : set.inj_on (orbit hom H) (ts (fixed_points hom H)) :=
|
||||
take a₁ a₂, begin
|
||||
rewrite [-*mem_eq_mem_to_set, ↑fixed_points, *mem_filter_iff],
|
||||
rewrite [-*mem_eq_mem_to_set, ↑fixed_points, *mem_sep_iff],
|
||||
intro Pa₁ Pa₂,
|
||||
rewrite [and.right Pa₁, and.right Pa₂],
|
||||
exact eq_of_singleton_eq
|
||||
|
@ -363,7 +363,7 @@ lemma orbit_class_equation : card S = Sum (orbits hom H) card :=
|
|||
class_equation (orbit_partition hom H)
|
||||
|
||||
lemma card_fixed_point_orbits : Sum (fixed_point_orbits hom H) card = card (fixed_point_orbits hom H) :=
|
||||
calc Sum _ _ = Sum (fixed_point_orbits hom H) (λ x, 1) : Sum_ext (take c Pin, of_mem_filter Pin)
|
||||
calc Sum _ _ = Sum (fixed_point_orbits hom H) (λ x, 1) : Sum_ext (take c Pin, of_mem_sep Pin)
|
||||
... = card (fixed_point_orbits hom H) * 1 : Sum_const_eq_card_mul
|
||||
... = card (fixed_point_orbits hom H) : mul_one (card (fixed_point_orbits hom H))
|
||||
|
||||
|
@ -448,7 +448,7 @@ subset_of_forall take g, begin
|
|||
intro Pg,
|
||||
rewrite -Pg at PH,
|
||||
apply finsubg_has_inv,
|
||||
apply mem_filter_of_mem !mem_univ,
|
||||
apply mem_sep_of_mem !mem_univ,
|
||||
intro h Ph,
|
||||
assert Phg : fin_lcoset (fin_lcoset H g) h = fin_lcoset H g, exact PH Ph,
|
||||
revert Phg,
|
||||
|
@ -536,9 +536,9 @@ ext (take (pp : perm (fin (succ n))), iff.intro
|
|||
pp maxi = lift_perm p maxi : {eq.symm Pp}
|
||||
... = lift_fun p maxi : rfl
|
||||
... = maxi : lift_fun_max,
|
||||
mem_filter_of_mem !mem_univ Ppp)
|
||||
mem_sep_of_mem !mem_univ Ppp)
|
||||
(assume Pstab,
|
||||
assert Ppp : pp maxi = maxi, from of_mem_filter Pstab,
|
||||
assert Ppp : pp maxi = maxi, from of_mem_sep Pstab,
|
||||
mem_image !mem_univ (lift_lower_eq Ppp)))
|
||||
|
||||
definition move_from_max_to (i : fin (succ n)) : perm (fin (succ n)) :=
|
||||
|
|
|
@ -96,7 +96,7 @@ card_le_card_of_subset !subset_univ
|
|||
|
||||
lemma cyc_has_one (a : A) : 1 ∈ cyc a :=
|
||||
begin
|
||||
apply mem_filter_of_mem !mem_univ,
|
||||
apply mem_sep_of_mem !mem_univ,
|
||||
existsi 0, apply and.intro,
|
||||
apply zero_lt_succ,
|
||||
apply pow_zero
|
||||
|
@ -108,11 +108,11 @@ length_pos_of_mem (cyc_has_one a)
|
|||
lemma cyc_mul_closed (a : A) : finset_mul_closed_on (cyc a) :=
|
||||
take g h, assume Pgin Phin,
|
||||
obtain n Plt Pe, from exists_pow_eq_one a,
|
||||
obtain i Pilt Pig, from of_mem_filter Pgin,
|
||||
obtain j Pjlt Pjh, from of_mem_filter Phin,
|
||||
obtain i Pilt Pig, from of_mem_sep Pgin,
|
||||
obtain j Pjlt Pjh, from of_mem_sep Phin,
|
||||
begin
|
||||
rewrite [-Pig, -Pjh, -pow_add, pow_mod Pe],
|
||||
apply mem_filter_of_mem !mem_univ,
|
||||
apply mem_sep_of_mem !mem_univ,
|
||||
existsi ((i + j) mod (succ n)), apply and.intro,
|
||||
apply nat.lt.trans (mod_lt (i+j) !zero_lt_succ) (succ_lt_succ Plt),
|
||||
apply rfl
|
||||
|
@ -121,20 +121,20 @@ end
|
|||
lemma cyc_has_inv (a : A) : finset_has_inv (cyc a) :=
|
||||
take g, assume Pgin,
|
||||
obtain n Plt Pe, from exists_pow_eq_one a,
|
||||
obtain i Pilt Pig, from of_mem_filter Pgin,
|
||||
obtain i Pilt Pig, from of_mem_sep Pgin,
|
||||
let ni := -(mk_mod n i) in
|
||||
assert Pinv : g*a^ni = 1, by
|
||||
rewrite [-Pig, mk_pow_mod Pe, -(pow_madd Pe), add.right_inv],
|
||||
begin
|
||||
rewrite [inv_eq_of_mul_eq_one Pinv],
|
||||
apply mem_filter_of_mem !mem_univ,
|
||||
apply mem_sep_of_mem !mem_univ,
|
||||
existsi ni, apply and.intro,
|
||||
apply nat.lt.trans (is_lt ni) (succ_lt_succ Plt),
|
||||
apply rfl
|
||||
end
|
||||
|
||||
lemma self_mem_cyc (a : A) : a ∈ cyc a :=
|
||||
mem_filter_of_mem !mem_univ
|
||||
mem_sep_of_mem !mem_univ
|
||||
(exists.intro (1 : nat) (and.intro (succ_lt_succ card_pos) !pow_one))
|
||||
|
||||
lemma mem_cyc (a : A) : ∀ {n : nat}, a^n ∈ cyc a
|
||||
|
@ -145,7 +145,7 @@ lemma mem_cyc (a : A) : ∀ {n : nat}, a^n ∈ cyc a
|
|||
lemma order_le {a : A} {n : nat} : a^(succ n) = 1 → order a ≤ succ n :=
|
||||
assume Pe, let s := image (pow a) (upto (succ n)) in
|
||||
assert Psub: cyc a ⊆ s, from subset_of_forall
|
||||
(take g, assume Pgin, obtain i Pilt Pig, from of_mem_filter Pgin, begin
|
||||
(take g, assume Pgin, obtain i Pilt Pig, from of_mem_sep Pgin, begin
|
||||
rewrite [-Pig, pow_mod Pe],
|
||||
apply mem_image,
|
||||
apply mem_upto_of_lt (mod_lt i !zero_lt_succ),
|
||||
|
|
|
@ -355,7 +355,7 @@ variable [finsubgH : is_finsubg H]
|
|||
include finsubgH
|
||||
|
||||
lemma subset_normalizer : H ⊆ normalizer H :=
|
||||
subset_of_forall take g, assume PginH, mem_filter_of_mem !mem_univ
|
||||
subset_of_forall take g, assume PginH, mem_sep_of_mem !mem_univ
|
||||
(take h, assume PhinH, finsubg_conj_closed PginH PhinH)
|
||||
|
||||
lemma normalizer_has_one : 1 ∈ normalizer H :=
|
||||
|
@ -363,10 +363,10 @@ mem_of_subset_of_mem subset_normalizer (finsubg_has_one H)
|
|||
|
||||
lemma normalizer_mul_closed : finset_mul_closed_on (normalizer H) :=
|
||||
take f g, assume Pfin Pgin,
|
||||
mem_filter_of_mem !mem_univ take h, assume Phin, begin
|
||||
mem_sep_of_mem !mem_univ take h, assume Phin, begin
|
||||
rewrite [-conj_compose],
|
||||
apply of_mem_filter Pfin,
|
||||
apply of_mem_filter Pgin,
|
||||
apply of_mem_sep Pfin,
|
||||
apply of_mem_sep Pgin,
|
||||
exact Phin
|
||||
end
|
||||
|
||||
|
@ -375,11 +375,11 @@ assume Pgin,
|
|||
eq_of_card_eq_of_subset (card_image_eq_of_inj_on (take h j, assume P1 P2, !conj_inj))
|
||||
(subset_of_forall take h, assume Phin,
|
||||
obtain j Pjin Pj, from exists_of_mem_image Phin,
|
||||
begin substvars, apply of_mem_filter Pgin, exact Pjin end)
|
||||
begin substvars, apply of_mem_sep Pgin, exact Pjin end)
|
||||
|
||||
lemma normalizer_has_inv : finset_has_inv (normalizer H) :=
|
||||
take g, assume Pgin,
|
||||
mem_filter_of_mem !mem_univ take h, begin
|
||||
mem_sep_of_mem !mem_univ take h, begin
|
||||
rewrite [-(conj_eq_of_mem_normalizer Pgin) at {1}, mem_image_iff],
|
||||
intro Pex, cases Pex with k Pk,
|
||||
rewrite [-(and.right Pk), conj_compose, mul.left_inv, conj_id],
|
||||
|
@ -401,11 +401,11 @@ lemma lrcoset_same_of_mem_normalizer {g : G} :
|
|||
g ∈ normalizer H → fin_lcoset H g = fin_rcoset H g :=
|
||||
assume Pg, ext take h, iff.intro
|
||||
(assume Pl, obtain j Pjin Pj, from exists_of_mem_image Pl,
|
||||
mem_image (of_mem_filter Pg j Pjin)
|
||||
mem_image (of_mem_sep Pg j Pjin)
|
||||
(calc g*j*g⁻¹*g = g*j : inv_mul_cancel_right
|
||||
... = h : Pj))
|
||||
(assume Pr, obtain j Pjin Pj, from exists_of_mem_image Pr,
|
||||
mem_image (of_mem_filter (finsubg_has_inv (normalizer H) Pg) j Pjin)
|
||||
mem_image (of_mem_sep (finsubg_has_inv (normalizer H) Pg) j Pjin)
|
||||
(calc g*(g⁻¹*j*g⁻¹⁻¹) = g*(g⁻¹*j*g) : inv_inv
|
||||
... = g*(g⁻¹*(j*g)) : mul.assoc
|
||||
... = j*g : mul_inv_cancel_left
|
||||
|
|
|
@ -35,7 +35,7 @@ lemma card_mod_eq_of_action_by_psubg {p : nat} :
|
|||
rewrite [@orbit_class_equation' G S ambientG finS deceqS hom Hom H subgH],
|
||||
apply add_mod_eq_of_dvd, apply dvd_Sum_of_dvd,
|
||||
intro s Psin,
|
||||
rewrite mem_filter_iff at Psin,
|
||||
rewrite mem_sep_iff at Psin,
|
||||
cases Psin with Psinorbs Pcardne,
|
||||
esimp [orbits, equiv_classes, orbit_partition] at Psinorbs,
|
||||
rewrite mem_image_iff at Psinorbs,
|
||||
|
|
|
@ -220,15 +220,15 @@ dvd.antisymm
|
|||
definition prime_factors (n : ℕ) : finset ℕ := { p ∈ upto (succ n) | prime p ∧ p ∣ n }
|
||||
|
||||
theorem prime_of_mem_prime_factors {p n : ℕ} (H : p ∈ prime_factors n) : prime p :=
|
||||
and.left (of_mem_filter H)
|
||||
and.left (of_mem_sep H)
|
||||
|
||||
theorem dvd_of_mem_prime_factors {p n : ℕ} (H : p ∈ prime_factors n) : p ∣ n :=
|
||||
and.right (of_mem_filter H)
|
||||
and.right (of_mem_sep H)
|
||||
|
||||
theorem mem_prime_factors {p n : ℕ} (npos : n > 0) (primep : prime p) (pdvdn : p ∣ n) :
|
||||
p ∈ prime_factors n :=
|
||||
have plen : p ≤ n, from le_of_dvd npos pdvdn,
|
||||
mem_filter_of_mem (mem_upto_of_lt (lt_succ_of_le plen)) (and.intro primep pdvdn)
|
||||
mem_sep_of_mem (mem_upto_of_lt (lt_succ_of_le plen)) (and.intro primep pdvdn)
|
||||
|
||||
/- prime factorization -/
|
||||
|
||||
|
|
Loading…
Reference in a new issue