Skip to content

Commit

Permalink
added intermediate level Equifibred
Browse files Browse the repository at this point in the history
  • Loading branch information
sinhp committed Mar 31, 2024
1 parent e8d0167 commit 2ea6825
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .i18n/Game.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr "Project-Id-Version: Game v4.6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: Sun Mar 31 15:57:31 2024\n"
"POT-Creation-Date: Sun Mar 31 16:07:10 2024\n"
"Last-Translator: \n"
"Language-Team: none\n"
"Language: de\n"
Expand Down
10 changes: 9 additions & 1 deletion Game/Levels/Quotient/Bijection.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import Game.Metadata.StructInstWithHoles
import Game.Levels.Quotient.Respect

World "Quotient"
Level 4
Level 5

Title "Quotient"

Introduction
"
The crucial universal property of `Quotient r` is the following statement:
If `f : A → B` is any function that respects the congruence `r` in the sense that
for every `x y : A`, `r x y` implies `f x = f y`, then `f` uniquely lifts to a function `Quotient.lift f : Quotient r → B`
defined on a typical element `⟦a⟧` by
```
Quotient.lift f ⟦a⟧ = f a
```
In this level you prove that the quotient lift of `rangeFactorization f` with respect to the
congruence relation `ker f` is a bijection.
Expand Down
36 changes: 36 additions & 0 deletions Game/Levels/Quotient/Equifibred.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Game.Metadata
import Game.Metadata.StructInstWithHoles

World "Quotient"
Level 2

Title "Quotient"

Introduction
"
Given a setoid structure `s` on `A` and an element `a : A` the equivalence class of `a`
is the set of all elements of `A` that are congruent to `a`, namely `{x : A | s.Rel x a}`.
We say a function `f : A → B` is equifibred if for any two elements `x` and `y` of `B` the preimages of `x` and `y` are equivlanet.
In this level you show that the equivalence classes of an equifibred function are all equivalent.
"

open Function Set Setoid

section
-- The following lemma is useful: it says that the elements related to x ∈ α by the kernel of f are those in the preimage of f(x) under f.
#check ker_iff_mem_preimage
end


Statement equiv_classes_of_equifibred (f : A → B)
(e : ∀ b b' : B, (f ⁻¹' {b}) ≃ (f ⁻¹' {b'})) :
∀ u v, u ∈ (ker f).classes → v ∈ (ker f).classes → u ≃ v := by
intro u v hu hv
refine {?..!}
· sorry
· sorry
· sorry
· sorry
2 changes: 1 addition & 1 deletion Game/Levels/Quotient/Factorization.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Game.Levels.Quotient.Respect
import Game.Levels.Quotient.Bijection

World "Quotient"
Level 5
Level 6

Title "Quotient"

Expand Down
25 changes: 14 additions & 11 deletions Game/Levels/Quotient/Kernel.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ Introduction
A setoid structure on a type `A` provides a relation `r : A → A → Prop` which is congruence (aka equivalence relation). The congruence `r` tell us which elements of `A` are congruent to other elements of `A`.
We show that every function `f : A → B` induces a congruence on `A`: We say elements `x` and `y` of `A` are in the same fibre of `f` if `f x = f y`.
We show that every function `f : A → B` induces a congruence on `A`. We say elements `x`
and `y` of `A` are kernel-congruent if `f x = f y`.
This is the equivalence relation `ker f` on `A` denoted by `ker f`.
```
x ~ y ↔ f x = f y
x y ↔ f x = f y
```
This is a congruence on `A` denoted by `ker f`.
You might be familiar with the kernel of a group homomorphism. The kernel of a group homomorphism is the set of elements that are sent to the identity element of the codomain. The kernel of a group homomorphism is a subgroup of the domain.
You might be familiar with the kernel of a group homomorphism which the set of elements
that are sent to the identity element of the codomain. The kernel of a group
homomorphism is a subgroup of the domain.
In this level you show that these two notions of kernel coincide: Two elements `x` and `y` of `A` are kernel congruent if and only if their difference is in the kernel of `f`.
Expand All @@ -44,10 +47,10 @@ Statement {A B : Type*} [AddGroup A] [AddGroup B] {f : A →+ B} {x y : A} :
exact h


-- alternate proof using more from mathlib
example {A B : Type*} [AddGroup A] [AddGroup B] {f : A →+ B} {x y : A} :
(ker f).Rel x y ↔ (x - y) ∈ f.ker := by
simp_rw [AddMonoidHom.mem_ker f]
simp only [map_sub]
simp [ker_def]
simp [sub_eq_zero]
-- alternate proof using `AddMonoidHom.mem_ker` from mathlib
-- example {A B : Type*} [AddGroup A] [AddGroup B] {f : A →+ B} {x y : A} :
-- (ker f).Rel x y ↔ (x - y) ∈ f.ker := by
-- simp_rw [AddMonoidHom.mem_ker f]
-- simp only [map_sub]
-- simp [ker_def]
-- simp [sub_eq_zero]
2 changes: 1 addition & 1 deletion Game/Levels/Quotient/Respect.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Game.Metadata
import Game.Metadata.StructInstWithHoles

World "Quotient"
Level 3
Level 4

Title "Quotient"

Expand Down
15 changes: 5 additions & 10 deletions Game/Levels/Quotient/Surjection.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@ import Game.Metadata
import Game.Metadata.StructInstWithHoles

World "Quotient"
Level 2
Level 3

Title "Quotient"

Introduction
"
For a congruence `r` on a type `A`, the quotient type `Quotient r` is the type of
elements of `A` modulo `r`. A mathematically common notation for `Quotient r` is `A / r`.
We can think of `Quotient r` as the collection of equivalence classes `⟦a⟧` of elements `a : A` modulo `r`.
The function `Quotient.mk : A → Quotient r` maps an element `a : A` to its equivalence class `⟦a⟧`.
There is a function `Quotient.mk : A → Quotient r` which maps an element `a : A` to `⟦a⟧`, a typical element of `Quotient r`.
If elements `a b : A` are congruent, then `⟦a⟧ = ⟦b⟧`. This fact is witnessed
by `Quotient.sound`.
The simplest induction principle `Quotient.ind` for the quotient type states that a property of elements of `Quotient r` can be proved by showing that it holds for all congruence classes `⟦a⟧`. In other words, if a property `P` holds for all congruence classes `⟦a⟧`, then `P` holds for all elements of `Quotient r`.
The crucial universal property of `Quotient r` is the following statement:
If `f : A → B` is any function that
respects the congruence `r` in the sense that for every `x y : A`,
`r x y` implies `f x = f y`, then `f` uniquely lifts to a function `Quotient.lift f : Quotient r → B`
defined on each equivalence class `⟦a⟧` by `Quotient.lift f ⟦a⟧ = f a`.
The simplest induction principle `Quotient.ind` for the quotient type states that we can prove a property of elements of `Quotient r` if we can prove that it holds for all typical elements `⟦a⟧`.
In this level you show that the function `Quotient.mk : A → Quotient fiber_setoid` is surjective.
Expand Down

0 comments on commit 2ea6825

Please sign in to comment.