PhyslibSearch

Physlib.Mathematics.DataStructures.FourTree.UniqueMap

13 declarations

definition

Mapping f:α4α4f: \alpha_4 \to \alpha_4 over a Leaf\text{Leaf}

#uniqueMap4

Given a function f:α4α4f: \alpha_4 \to \alpha_4, the function `uniqueMap4` maps a value of type Leaf α4\text{Leaf } \alpha_4. Specifically, for a leaf containing an element xα4x \in \alpha_4, denoted as leaf(x)\text{leaf}(x), the function returns a new leaf containing the transformed element, leaf(f(x))\text{leaf}(f(x)).

definition

Mapping f:α4α4f: \alpha_4 \to \alpha_4 over a Twig\text{Twig} excluding original values

#uniqueMap4

Given a function f:α4α4f: \alpha_4 \to \alpha_4, the function `uniqueMap4` acts on a `Twig` TT, which consists of a value xα3x \in \alpha_3 and a multiset of leaves L={leaf(y1),leaf(y2),,leaf(yn)}L = \{ \text{leaf}(y_1), \text{leaf}(y_2), \dots, \text{leaf}(y_n) \} containing values yiα4y_i \in \alpha_4. The function returns a new `Twig` (x,L)(x, L'), where the new multiset of leaves LL' is constructed by applying ff to each yiy_i and retaining the result f(yi)f(y_i) only if it is not already present in the original set of values {y1,,yn}\{y_1, \dots, y_n\}. Formally, if Y={y1,,yn}Y = \{y_1, \dots, y_n\}, then L={leaf(f(y))yY,f(y)Y}L' = \{ \text{leaf}(f(y)) \mid y \in Y, f(y) \notin Y \}.

definition

Mapping f:α4α4f: \alpha_4 \to \alpha_4 over a `Branch` excluding original leaf values

#uniqueMap4

Given a function f:α4α4f: \alpha_4 \to \alpha_4, the function `uniqueMap4` transforms a branch T=(x0,T)T = (x_0, \mathcal{T}), where x0α2x_0 \in \alpha_2 and T\mathcal{T} is a multiset of twigs {T1,T2,,Tn}\{T_1, T_2, \dots, T_n\} of type `Twig α3 α4`. The result is a new branch (x0,{T1,T2,,Tn})(x_0, \{T'_1, T'_2, \dots, T'_n\}), where each TiT'_i is obtained by applying the `Twig.uniqueMap4` function with ff to the corresponding twig TiT_i. Specifically, for each twig, the function maps ff over its leaves and retains only those transformed values that were not originally present in that twig's leaf multiset.

definition

Mapping f:α4α4f: \alpha_4 \to \alpha_4 over a `Trunk` excluding original leaf values

#uniqueMap4

Given a function f:α4α4f: \alpha_4 \to \alpha_4, the function `uniqueMap4` transforms a trunk T=(x0,B)T = (x_0, \mathcal{B}), where x0α1x_0 \in \alpha_1 is a root value and B\mathcal{B} is a multiset of branches. The resulting trunk is defined as (x0,{Branch.uniqueMap4(f,B)BB})(x_0, \{ \text{Branch.uniqueMap4}(f, B) \mid B \in \mathcal{B} \}). This operation maps ff over all the leaf values within the hierarchical structure of the trunk, while retaining only those transformed values that were not already present in the original leaf multiset of their respective twigs.

definition

Mapping f:α4α4f: \alpha_4 \to \alpha_4 over a `FourTree` excluding original leaf values

#uniqueMap4

Given a function f:α4α4f: \alpha_4 \to \alpha_4, the function `uniqueMap4` transforms a `FourTree` TT (a multiset of trunks) by applying ff to the leaf values a4α4a_4 \in \alpha_4 at the bottom of the tree's hierarchy. The transformation is applied recursively through the `Trunk`, `Branch`, and `Twig` levels. For each leaf in the original tree, the transformed value f(a4)f(a_4) is included in the resulting tree only if it was not already present in the multiset of leaves belonging to the original twig from which the leaf was derived.

theorem

Transformed elements of TT belong to T.uniqueMap4 fT.\text{uniqueMap4 } f or TT

#map_mem_uniqueMap4

Let TT be a `FourTree` over types α1,α2,α3\alpha_1, \alpha_2, \alpha_3, and α4\alpha_4. For any quadruple x=(x1,x2,x3,x4)x = (x_1, x_2, x_3, x_4) such that xTx \in T, and for any function f:α4α4f : \alpha_4 \to \alpha_4, the transformed quadruple (x1,x2,x3,f(x4))(x_1, x_2, x_3, f(x_4)) is either a member of the transformed tree T.uniqueMap4 fT.\text{uniqueMap4 } f or it is a member of the original tree TT.

theorem

CT.uniqueMap4 f    (x1,x2,x3,x4)T,C=(x1,x2,x3,f(x4))C \in T.\text{uniqueMap4 } f \implies \exists (x_1, x_2, x_3, x_4) \in T, C = (x_1, x_2, x_3, f(x_4))

#exists_of_mem_uniqueMap4

Let TT be a `FourTree` over types α1,α2,α3\alpha_1, \alpha_2, \alpha_3, and α4\alpha_4. If a quadruple Cα1×α2×α3×α4C \in \alpha_1 \times \alpha_2 \times \alpha_3 \times \alpha_4 is a member of the transformed tree T.uniqueMap4 fT.\text{uniqueMap4 } f (the tree obtained by applying f:α4α4f: \alpha_4 \to \alpha_4 to the leaf values while filtering out transformed values that were already present in the original structure), then there exists an original quadruple (x1,x2,x3,x4)T(x_1, x_2, x_3, x_4) \in T such that C=(x1,x2,x3,f(x4))C = (x_1, x_2, x_3, f(x_4)).

definition

Mapping f:α3α3f: \alpha_3 \to \alpha_3 over the data value of a `Twig`

#uniqueMap3

Given a function f:α3α3f : \alpha_3 \to \alpha_3, the function `uniqueMap3` transforms a `Twig` TT, which consists of a value xα3x \in \alpha_3 and a multiset of leaves. The transformation results in a new `Twig` where the function ff is applied to the value xx while the leaves remain unchanged, represented as twig(f(x),leafs)\text{twig}(f(x), \text{leafs}).

definition

Mapping f:α3α3f: \alpha_3 \to \alpha_3 over a Branch while filtering existing elements

#uniqueMap3

Given a function f:α3α3f: \alpha_3 \to \alpha_3 and a branch T=(v,T)T = (v, \mathcal{T}) consisting of a value vα2v \in \alpha_2 and a multiset of twigs T\mathcal{T}, the function `uniqueMap3` transforms the branch by mapping the data wα3w \in \alpha_3 within each twig to f(w)f(w). It filters the multiset of leaves L\mathcal{L} associated with each twig such that a leaf zα4z \in \alpha_4 is retained in the new structure only if the tuple (v,f(w),z)(v, f(w), z) is not already a member of the original branch TT.

definition

Mapping f:α3α3f: \alpha_3 \to \alpha_3 over a Trunk while filtering existing elements

#uniqueMap3

Given a function f:α3α3f: \alpha_3 \to \alpha_3 and a trunk node T=(q,B)T = (q, \mathcal{B}), where qα1q \in \alpha_1 and B\mathcal{B} is a multiset of branches of type `Branch α2 α3 α4`, the function `uniqueMap3` transforms the trunk by applying the branch-level transformation `uniqueMap3` to each branch in B\mathcal{B} using ff. Specifically, it preserves the trunk value qq and maps each branch BBB \in \mathcal{B} to a new branch where the underlying data in the twigs (of type α3\alpha_3) is transformed by ff, while any resulting leaf nodes (of type α4\alpha_4) that were already present in the original branch are removed.

definition

Mapping f:α3α3f: \alpha_3 \to \alpha_3 over a `FourTree` while filtering existing leaves

#uniqueMap3

Given a function f:α3α3f: \alpha_3 \to \alpha_3, this function transforms a `FourTree` TT by applying ff to the values of type α3\alpha_3 stored within its twigs. The operation maps the trunk-level transformation `uniqueMap3` over the multiset of trunks that constitute the root of TT. This transformation updates the twig values and filters the leaf nodes of type α4\alpha_4 such that a path (a1,a2,f(a3),a4)(a_1, a_2, f(a_3), a_4) is retained in the new structure only if it was not already a member of the original branch in TT.

theorem

(x1,x2,f(x3),x4)T.uniqueMap3 f(x1,x2,f(x3),x4)T(x_1, x_2, f(x_3), x_4) \in T.\text{uniqueMap3 } f \lor (x_1, x_2, f(x_3), x_4) \in T

#map_mem_uniqueMap3

Let TT be a `FourTree` over types α1,α2,α3,α4\alpha_1, \alpha_2, \alpha_3, \alpha_4, representing a hierarchical collection of quadruples. If a quadruple x=(x1,x2,x3,x4)x = (x_1, x_2, x_3, x_4) is a member of TT, then for any function f:α3α3f: \alpha_3 \to \alpha_3, the transformed quadruple (x1,x2,f(x3),x4)(x_1, x_2, f(x_3), x_4) is either a member of the tree T.uniqueMap3 fT.\text{uniqueMap3 } f (the tree resulting from applying ff to the third component and filtering duplicates) or was already a member of the original tree TT.

theorem

CT.uniqueMap3 fC \in T.\text{uniqueMap3 } f implies existence of a preimage in TT

#exists_of_mem_uniqueMap3

Let TT be a `FourTree` defined over types α1,α2,α3\alpha_1, \alpha_2, \alpha_3, and α4\alpha_4, and let f:α3α3f: \alpha_3 \to \alpha_3 be a function. If a quadruple Cα1×α2×α3×α4C \in \alpha_1 \times \alpha_2 \times \alpha_3 \times \alpha_4 is a member of the tree T.uniqueMap3 fT.\text{uniqueMap3 } f (the tree resulting from applying ff to the α3\alpha_3 components and filtering existing entries), then there exists a quadruple (q1,q2,q3,q4)(q_1, q_2, q_3, q_4) in the original tree TT such that C=(q1,q2,f(q3),q4)C = (q_1, q_2, f(q_3), q_4).