Equivalence of codes #
Several codes will be identified to make one TTT object. A TTT object has extensions for all type
indices (except possibly ⊥
), so our equivalence classes must too.
One way to do this is to make an equivalence class out of a code and its image under each
cloudCode
map. Thus we want to partition the big tree given by ↝₀
into trees of height 1
that
each contains all descendents of its root (this is a slight lie for empty codes as the one
equivalence class they form won't be a tree but rather a complete graph).
This is where code parity kicks in. We recursively pick out the small trees by noticing that codes
whose preimages under cloud
maps are all in a small tree already (in particular, those that have
no preimage under an cloud
map) must be the root of their own small tree, and that codes that are
an image of some root of a small tree must belong to that same tree. This motivates the following
definitions:
- A code is even if all its preimages under
cloudCode
maps are odd. - A code is odd if one of its preimages under
cloudCode
maps are even.
If we replace "even" and "odd" by "winning" and "losing", we precisely get the rules for determining whether a game position is winning or losing.
Note that for nonempty codes there is at most one preimage under cloud
maps.
Main declarations #
ConNF.IsEven
,ConNF.IsOdd
: Code parity.ConNF.Code.Equiv
: Equivalence of codes.ConNF.exists_even_equiv
: There is a unique even code in each equivalence class.
Parity of a code #
Parity of codes. If we consider codes as states of a game and ↝₀
as the "leads to"
relation, then even codes are precisely losing codes and odd codes are precisely winning codes.
Parity of a nonempty code corresponds to the parity of its number of iterated preimages under
cloudCode
. The only even empty code is ⊥
, all others are odd.
A code is even iff it only leads to odd codes.
- intro: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c : ConNF.Code), (∀ (d : ConNF.Code), d ↝₀ c → d.IsOdd) → c.IsEven
Instances For
A code is odd iff it leads to some even code.
- intro: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c d : ConNF.Code), d ↝₀ c → d.IsEven → c.IsOdd
Instances For
An empty code is even iff its extension is ⊥
.
A code is not odd iff it is even.
A code is not even iff it is odd.
Alias of the reverse direction of ConNF.Code.not_isOdd
.
A code is not odd iff it is even.
Alias of the reverse direction of ConNF.Code.not_isEven
.
A code is not even iff it is odd.
Any code is even or odd.
The cloud map cannot produce a singleton code.
Singleton codes are even.
Equivalence of codes #
Codes are said to be equivalent if they belong to the same tree of height 1 with a single even root.
- refl: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c : ConNF.Code), c ≡ c
- cloud_left: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c : ConNF.Code), c.IsEven → ∀ (β : ConNF.Λ) [inst_6 : ConNF.LtLevel ↑β], c.β ≠ ↑β → ConNF.cloudCode β c ≡ c
- cloud_right: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c : ConNF.Code), c.IsEven → ∀ (β : ConNF.Λ) [inst_6 : ConNF.LtLevel ↑β], c.β ≠ ↑β → c ≡ ConNF.cloudCode β c
- cloud_cloud: ∀ [inst : ConNF.Params] [inst_1 : ConNF.Level] [inst_2 : ConNF.BasePositions] [inst_3 : ConNF.ModelDataLt] [inst_4 : ConNF.TypedObjectsLt] [inst_5 : ConNF.PositionedTanglesLt] (c : ConNF.Code), c.IsEven → ∀ (β : ConNF.Λ) [inst_6 : ConNF.LtLevel ↑β], c.β ≠ ↑β → ∀ (γ : ConNF.Λ) [inst_7 : ConNF.LtLevel ↑γ], c.β ≠ ↑γ → ConNF.cloudCode β c ≡ ConNF.cloudCode γ c
Instances For
We declare new notation for code equivalence.
Equations
- ConNF.Code.«term_≡_» = Lean.ParserDescr.trailingNode `ConNF.Code.term_≡_ 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≡ ") (Lean.ParserDescr.cat `term 51))
Instances For
All empty codes are equivalent.
Code equivalence is transitive.
Code equivalence is an equivalence relation.
If two codes are equal, they are either both empty or both nonempty.
If two codes at the same level are equivalent, they are equal.
There is a unique even code in each equivalence class.