diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0250b21d..e8abf785 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,7 @@ repos: - id: check-merge-conflict - id: check-xml - id: check-yaml + args: ['--unsafe'] - id: debug-statements - id: end-of-file-fixer - id: requirements-txt-fixer diff --git a/README.md b/README.md index bfded412..a88f7b49 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,120 @@ - +Python library for Formal Order Analysis (FOA) of symbolic sequences. -[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/) +## What is FOA? -# foapy +Formal Order Analysis (FOA) studies the structure of symbolic sequences by: + +- Mapping a sequence to its order and alphabet (the set of unique symbols in order of first appearance). +- Extracting intervals between repeated occurrences of the same symbol under different boundary modes. +- Quantifying structure with characteristics (e.g., arithmetic/geometric means, volume, average remoteness, depth, descriptive/identifying information, regularity, uniformity). + +This enables robust analysis for text, biological sequences, musical motifs, logs, and any categorical time series. + +## Features + +- **Alphabets and Orders:** Define alphabets and compute orders of sequences. +- **Intervals and Chains:** Extract intervals for multiple binding and boundary modes. +- **Congeneric Decomposition:** Decompose sequences into congeneric components. +- **Mathematical Characteristics:** Arithmetic mean, geometric mean, volume, average remoteness, depth, descriptive and identifying information, regularity, uniformity. +- **Masked-array Support:** FOA on partially observed sequences via `foapy.ma`. +- **Extensive Documentation:** Theory, algorithms, and examples. + +## Installation + +- From PyPI: + +```bash +pip install foapy +``` + +- From source (with tox workflows): + +```bash +git clone https://github.com/intervals-mining-lab/foapy.git +cd foapy +python -m pip install --upgrade pip +python -m pip install tox + +# Run tests (isolated env) +tox -e default + +# Build distribution artifacts (sdist and wheel) +tox -e build + +# Optionally clean build artifacts +tox -e clean +``` + +## Quick start + +Compute order, intervals, and a characteristic: + +```python +import foapy + +# 1) Order and alphabet +source = ['a', 'b', 'a', 'c', 'd'] +order = foapy.order(source) +print(order) # [0 1 0 2 3] + +order_arr, alphabet = foapy.order(source, True) +print(order_arr, alphabet) # [0 1 0 2 3] ['a' 'b' 'c' 'd'] + +# 2) Intervals (binding to start, normal mode) +from foapy import binding, mode +intervals = foapy.intervals(['a', 'b', 'a', 'c', 'a', 'd'], binding.start, mode.normal) +print(intervals) # [1 2 2 3 2 5] + +# 3) A characteristic (volume = product of intervals) +val = foapy.characteristics.volume(intervals) +print(val) # 192 +``` + +Masked arrays (optional): + +```python +import numpy as np +import numpy.ma as ma +import foapy + +seq = ma.masked_array(['a', 'b', 'a', 'c', 'd'], mask=[0, 1, 0, 0, 0]) +order_ma = foapy.ma.order(seq) +intervals_grouped = foapy.ma.intervals(order_ma, foapy.binding.start, foapy.mode.normal) +u = foapy.characteristics.uniformity(intervals_grouped) +print(u) +``` + +## Project Structure + +- **Source Code:** [`./src`](./src) +- **Documentation:** [`./docs`](./docs) +- **Tests:** [`./tests`](./tests) + +## Documentation + +Online documentation: [intervals-mining-lab.github.io/foapy](https://intervals-mining-lab.github.io/foapy). + +The documentation in [`./docs`](./docs) covers fundamentals, algorithms, characteristics, applications, and development notes. + +Build and serve the docs locally (via tox): -> Formal order analysis library +```bash +# Build docs into docs/_build +tox -e docs -A longer description of your project goes here... +# Serve docs with live-reload for development +tox -e docsserve +``` +## Testing - +Run the test suite (via tox): -## Note +```bash +tox -e default -This project has been set up using PyScaffold 4.5. For details and usage -information on PyScaffold see https://pyscaffold.org/. +# Pass arguments to pytest after --, e.g. run a subset: +tox -e default -- -k order -q +``` diff --git a/docs/assets/js/mathjax.js b/docs/assets/js/mathjax.js index 0c7803cf..561944cd 100644 --- a/docs/assets/js/mathjax.js +++ b/docs/assets/js/mathjax.js @@ -1,9 +1,11 @@ window.MathJax = { + loader: {load: ['[tex]/colortbl']}, tex: { inlineMath: [["\\(", "\\)"]], displayMath: [["\\[", "\\]"]], processEscapes: true, - processEnvironments: true + processEnvironments: true, + packages: {'[+]': ['colortbl']}, }, options: { ignoreHtmlClass: ".*|", diff --git a/docs/fundamentals/characteristics/arithmetic_mean.md b/docs/fundamentals/characteristics/arithmetic_mean.md deleted file mode 100644 index 3f3ed90f..00000000 --- a/docs/fundamentals/characteristics/arithmetic_mean.md +++ /dev/null @@ -1,3 +0,0 @@ -# Arithmetic Mean - -Coming soon diff --git a/docs/fundamentals/characteristics/average_remoteness.md b/docs/fundamentals/characteristics/average_remoteness.md deleted file mode 100644 index 415f7290..00000000 --- a/docs/fundamentals/characteristics/average_remoteness.md +++ /dev/null @@ -1,3 +0,0 @@ -# Average Remoteness - -Coming soon diff --git a/docs/fundamentals/characteristics/depth.md b/docs/fundamentals/characteristics/depth.md deleted file mode 100644 index 16f82bad..00000000 --- a/docs/fundamentals/characteristics/depth.md +++ /dev/null @@ -1,3 +0,0 @@ -# Depth - -Coming soon diff --git a/docs/fundamentals/characteristics/descriptive_information.md b/docs/fundamentals/characteristics/descriptive_information.md deleted file mode 100644 index 57d65081..00000000 --- a/docs/fundamentals/characteristics/descriptive_information.md +++ /dev/null @@ -1,3 +0,0 @@ -# Descriptive Information - -Coming soon diff --git a/docs/fundamentals/characteristics/geometric_mean.md b/docs/fundamentals/characteristics/geometric_mean.md deleted file mode 100644 index bfe6dcdb..00000000 --- a/docs/fundamentals/characteristics/geometric_mean.md +++ /dev/null @@ -1,3 +0,0 @@ -# Geometric Mean - -Coming soon diff --git a/docs/fundamentals/characteristics/identifying_information.md b/docs/fundamentals/characteristics/identifying_information.md deleted file mode 100644 index 6bd90c57..00000000 --- a/docs/fundamentals/characteristics/identifying_information.md +++ /dev/null @@ -1,3 +0,0 @@ -# Identifying Information - -Coming soon diff --git a/docs/fundamentals/characteristics/index.md b/docs/fundamentals/characteristics/index.md deleted file mode 100644 index ba1feea7..00000000 --- a/docs/fundamentals/characteristics/index.md +++ /dev/null @@ -1,3 +0,0 @@ -# Characteristics - -Coming soon diff --git a/docs/fundamentals/characteristics/periodicity.md b/docs/fundamentals/characteristics/periodicity.md deleted file mode 100644 index a26aaa16..00000000 --- a/docs/fundamentals/characteristics/periodicity.md +++ /dev/null @@ -1,3 +0,0 @@ -# Periodicity - -Coming soon diff --git a/docs/fundamentals/characteristics/uniformity.md b/docs/fundamentals/characteristics/uniformity.md deleted file mode 100644 index 35fc8f22..00000000 --- a/docs/fundamentals/characteristics/uniformity.md +++ /dev/null @@ -1,3 +0,0 @@ -# Uniformity - -Coming soon diff --git a/docs/fundamentals/characteristics/volume.md b/docs/fundamentals/characteristics/volume.md deleted file mode 100644 index 0cee8e6a..00000000 --- a/docs/fundamentals/characteristics/volume.md +++ /dev/null @@ -1,3 +0,0 @@ -# Volume - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/alphabet.md b/docs/fundamentals/congeneric_decomposition/alphabet.md new file mode 100644 index 00000000..b1f21ba9 --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/alphabet.md @@ -0,0 +1,357 @@ +# Alphabet of Congeneric sequences + +_Alphabet_ of [_Congeneric sequences_](./sequences.md#mathematical-definition) is an [_Alphabet_](../order/alphabet.md#mathematical-definition). + + +=== "Congeneric sequences" + ``` mermaid + block-beta + columns 31 + + space:2 i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] + i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] + i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] + i28["28"] i29["29"] + + space j1["1"] s1["I"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["I"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + + space j2["2"] n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] + n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] + n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + + space j3["3"] t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] + t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] + t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] + + space j4["4"] e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + + space j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] + l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] + l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + + space j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] + g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] + g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + + space j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] + c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] + c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + + space j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] + sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] + sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + + space j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] + b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] + b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + classDef index fill:#ffffff,stroke-width:0px + + class s2,s3,s4,s5,s6,s8,s9,s10 index + class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index + class s21,s22,s23,s24,s25,s26,s27,s28,s29 index + + class n1,n3,n4,n5,n6,n7,n8,n9 index + class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index + class n21,n22,n23,n24,n25,n26,n27,n28,n29 index + + class t1,t2,t4,t5,t6,t7,t8,t9,t10 index + class t11,t12,t13,t14,t15,t16,t18,t19,t20 index + class t21,t22,t23,t24,t25,t27,t28 index + + class e1,e2,e3,e5,e6,e7,e8,e10 index + class e11,e13,e14,e15,e16,e17,e18,e19,e20 index + class e21,e22,e23,e24,e25,e26,e27,e28,e29 index + + class l1,l2,l3,l4,l7,l8,l9,l10 index + class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 index + class l21,l22,l23,l25,l26,l27,l28,l29 index + + class g1,g2,g3,g4,g5,g6,g7,g9,g10 index + class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index + class g21,g22,g23,g24,g25,g26,g27,g28,g29 index + + class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index + class c12,c13,c14,c15,c16,c17,c18,c19,c20 index + class c21,c22,c23,c24,c25,c26,c27,c28,c29 index + + class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 index + class sp11,sp12,sp14,sp15,sp17,sp18,sp19 index + class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + + class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index + class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index + class b21,b23,b24,b25,b26,b27,b28,b29 index + + + class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index + class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index + class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + + class j1,j2,j3,j4,j5,j6,j7,j8,j9 index + ``` + + +=== "Alphabet and Congeneric sequences" + ``` mermaid + block-beta + columns 31 + + space:2 i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] + i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] + i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] + i28["28"] i29["29"] + + a1["I"] j1["1"] s1["I"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["I"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + + a2["N"] j2["2"] n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] + n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] + n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + + a3["T"] j3["3"] t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] + t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] + t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] + + a4["E"] j4["4"] e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + + a5["L"] j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] + l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] + l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + + a6["G"] j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] + g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] + g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + + a7["C"] j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] + c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] + c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + + a8[" "] j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] + sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] + sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + + a9["B"] j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] + b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] + b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#fff + classDef index fill:#fff,stroke-width:0px + classDef hide fill:#fff,color:#fff,stroke-width:0px + + class s2,s3,s4,s5,s6,s8,s9,s10 index + class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index + class s21,s22,s23,s24,s25,s26,s27,s28,s29 index + + class n1,n3,n4,n5,n6,n7,n8,n9 index + class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index + class n21,n22,n23,n24,n25,n26,n27,n28,n29 index + + class t1,t2,t4,t5,t6,t7,t8,t9,t10 index + class t11,t12,t13,t14,t15,t16,t18,t19,t20 index + class t21,t22,t23,t24,t25,t27,t28 index + + class e1,e2,e3,e5,e6,e7,e8,e10 index + class e11,e13,e14,e15,e16,e17,e18,e19,e20 index + class e21,e22,e23,e24,e25,e26,e27,e28,e29 index + + class l1,l2,l3,l4,l7,l8,l9,l10 index + class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 index + class l21,l22,l23,l25,l26,l27,l28,l29 index + + class g1,g2,g3,g4,g5,g6,g7,g9,g10 index + class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index + class g21,g22,g23,g24,g25,g26,g27,g28,g29 index + + class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index + class c12,c13,c14,c15,c16,c17,c18,c19,c20 index + class c21,c22,c23,c24,c25,c26,c27,c28,c29 index + + class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 index + class sp11,sp12,sp14,sp15,sp17,sp18,sp19 index + class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + + class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index + class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index + class b21,b23,b24,b25,b26,b27,b28,b29 index + + + class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index + class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index + class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + + class j1,j2,j3,j4,j5,j6,j7,j8,j9 index + ``` + + +=== "Alphabet" + + ``` mermaid + block-beta + columns 31 + + space:2 i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] + i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] + i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] + i28["28"] i29["29"] + + a1["I"] j1["1"] s1["I"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["I"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + + a2["N"] j2["2"] n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] + n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] + n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + + a3["T"] j3["3"] t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] + t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] + t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] + + a4["E"] j4["4"] e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + + a5["L"] j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] + l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] + l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + + a6["G"] j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] + g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] + g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + + a7["C"] j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] + c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] + c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + + a8[" "] j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] + sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] + sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + + a9["B"] j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] + b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] + b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#fff + classDef index fill:#fff,stroke-width:0px + classDef hide fill:#fff,color:#fff,stroke-width:0px + + class s1,s2,s3,s4,s5,s6,s7,s8,s9,s10 hide + class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 hide + class s21,s22,s23,s24,s25,s26,s27,s28,s29 hide + + class n1,n2,n3,n4,n5,n6,n7,n8,n9,n10 hide + class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 hide + class n21,n22,n23,n24,n25,n26,n27,n28,n29 hide + + class t1,t2,t3,t4,t5,t6,t7,t8,t9,t10 hide + class t11,t12,t13,t14,t15,t16,t17,t18,t19,t20 hide + class t21,t22,t23,t24,t25,t26,t27,t28,t29 hide + + class e1,e2,e3,e4,e5,e6,e7,e8,e9,e10 hide + class e11,e12,e13,e14,e15,e16,e17,e18,e19,e20 hide + class e21,e22,e23,e24,e25,e26,e27,e28,e29 hide + + class l1,l2,l3,l4,l5,l6,l7,l8,l9,l10 hide + class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 hide + class l21,l22,l23,l24,l25,l26,l27,l28,l29 hide + + class g1,g2,g3,g4,g5,g6,g7,g8,g9,g10 hide + class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 hide + class g21,g22,g23,g24,g25,g26,g27,g28,g29 hide + + class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 hide + class c11,c12,c13,c14,c15,c16,c17,c18,c19,c20 hide + class c21,c22,c23,c24,c25,c26,c27,c28,c29 hide + + class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 hide + class sp11,sp12,sp13,sp14,sp15,sp16,sp17,sp18,sp19,sp20 hide + class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 hide + + class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 hide + class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 hide + class b21,b22,b23,b24,b25,b26,b27,b28,b29 hide + + + class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 hide + class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 hide + class i21,i22,i23,i24,i25,i26,i27,i28,i29 hide + + class j1,j2,j3,j4,j5,j6,j7,j8,j9 index + ``` + + +## Mathematical Definition + +Let $X_{-}$ is [_Partial Carrier set_](../partials_and_congenerics/carrier_set.md#mathematical-definition) + +Let $CS$ is [_Congeneric Sequences_](./sequences.md#as-m-tuple-of-congeneric-sequences) + +Let $alphabet_p$ is [_Alphabet of partial sequence_](../partials_and_congenerics/alphabet/index.md#mathematical-definition) + +Because by definition of _Congeneric sequences_ $\forall j \in \{1,...,m\}$ $CS(j)$ is [_Congeneric sequence_](../partials_and_congenerics/sequence/congeneric.md), so +$|alphabet_p(CS(j))| = 1$ because of [_Alphabet of Congeneric sequences_](../partials_and_congenerics/alphabet/congeneric.md#mathematical-definition) lemma. + +Define _Alphabet of congeneric sequences_ function + +$$alphabet_c : \big\{\{1,...,m\} \times \{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\},$$ + +$$alphabet_c(CS)(j) = alphabet_p(CS(j))(1)$$ diff --git a/docs/fundamentals/congeneric_decomposition/characteristics/descriptive_information.md b/docs/fundamentals/congeneric_decomposition/characteristics/descriptive_information.md new file mode 100644 index 00000000..b747c47f --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/characteristics/descriptive_information.md @@ -0,0 +1,57 @@ +# Descriptive Information + +The Descriptive Information + +## Mathematical Definition + +The descriptive information can be calculated + + +### from Congeneric Intervals Chains + +Let $CIC$ is [_Congenerics Intervals Chains_](../intervals_chains.md#as-matrix-ml) defined as matrix + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +$$D=\prod_{j=1}^{m}{\left(\frac{1}{n_j} \times \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}\right)^{\frac{n_j}{n}}}$$ + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + 1, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}$ is count of _non-empty_ elements in $j$ _congeneric intervals chain_, +$\Delta_{i,j}$ the $i$-th element of $j$-th _congeneric intervals chain_. + +$$n=\sum_{j=1}^{m}{n_j}$$ + + +### from Congenerics Intervals Distributions + +Let $CID$ is [_Congenerics Intervals Distributions_](../intervals_distribution.md#as-matrix-ml) defined as matrix + +$$ +CID = +\begin{pmatrix} +cid_{1,1} & cid_{1,2} & \cdots & cid_{1,l} \\ +cid_{2,1} & cid_{2,2} & \cdots & cid_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cid_{m,1} & cid_{m,2} & \cdots & cid_{m,l} +\end{pmatrix} +$$ + +$$D=\prod_{j=1}^{m}{\left(\sum_{i=1}^{l}{\frac{i \times cid_{i,j}}{n_j}}\right)^{\frac{n_j}{n}}}$$ + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{cid_{i,j}}$ is count of _non-empty_ elements in $j$ _congeneric intervals distribution_, +$cid_{i,j}$ the $i$-th element of $j$-th _congeneric intervals distribution_. + +$$n=\sum_{j=1}^{m}{n_j}$$ diff --git a/docs/fundamentals/congeneric_decomposition/characteristics/identifying_information.md b/docs/fundamentals/congeneric_decomposition/characteristics/identifying_information.md new file mode 100644 index 00000000..15ffe80d --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/characteristics/identifying_information.md @@ -0,0 +1,58 @@ +# Identifying Information + +The Identifying Information or Entropy + +## Mathematical Definition + +The identifying information/entropy can be calculated + + +### from Congeneric Intervals Chains + +Let $CIC$ is [_Congenerics Intervals Chains_](../intervals_chains.md#as-matrix-ml) defined as matrix + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +$$H=\frac {1} {n} * \sum_{j=1}^{m}{\Bigg(n_j \times \log_2 \bigg( \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}\bigg) - \log_2 n_j^{n_j} \Bigg)}$$ + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + 1, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}$ is count of _non-empty_ elements in $j$ _congeneric intervals chain_, +$\Delta_{i,j}$ the $i$-th element of $j$-th _congeneric intervals chain_. + +$$n=\sum_{j=1}^{m}{n_j}$$ + + +### from Congenerics Intervals Distributions + +Let $CID$ is [_Congenerics Intervals Distributions_](../intervals_distribution.md#as-matrix-ml) defined as matrix + +$$ +CID = +\begin{pmatrix} +cid_{1,1} & cid_{1,2} & \cdots & cid_{1,l} \\ +cid_{2,1} & cid_{2,2} & \cdots & cid_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cid_{m,1} & cid_{m,2} & \cdots & cid_{m,l} +\end{pmatrix} +$$ + +$$H=\frac {1} {n} * \sum_{j=1}^{m}{\Bigg(n_j \times \log_2 \sum_{i=1}^{l}{ \frac{i \times cid_{i,j}}{n_j}} \Bigg)}$$ + + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{cid_{i,j}}$ is count of _non-empty_ elements in $j$ _congeneric intervals distribution_, +$cid_{i,j}$ the $i$-th element of $j$-th _congeneric intervals distribution_. + +$$n=\sum_{j=1}^{m}{n_j}$$ diff --git a/docs/fundamentals/congeneric_decomposition/characteristics/index.md b/docs/fundamentals/congeneric_decomposition/characteristics/index.md new file mode 100644 index 00000000..e7d3122b --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/characteristics/index.md @@ -0,0 +1,11 @@ +# Characteristics + +Applying any of [_interval-based characteristics_](../../order/characteristics/index.md) to each element of _Congenetric Itervals Distributions_ stack produce +a vector of the characteristic. These vectors could be useful in analyzing parts of the sequence. + +In addition to that, there are four integral measures based on _congeneric intervals distributions_ that characterise the whole sequence + +- [Descriptive Information](./descriptive_information.md) +- [Identifying Information](./identifying_information.md) +- [Regularity](./regularity.md) +- [Uniformity](./uniformity.md) diff --git a/docs/fundamentals/congeneric_decomposition/characteristics/regularity.md b/docs/fundamentals/congeneric_decomposition/characteristics/regularity.md new file mode 100644 index 00000000..64f4c65e --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/characteristics/regularity.md @@ -0,0 +1,73 @@ +# Regularity + +The Regularity + +## Mathematical Definition + +The regularity can be calculated + + +### from Congeneric Intervals Chains + +Let $CIC$ is [_Congenerics Intervals Chains_](../intervals_chains.md#as-matrix-ml) defined as matrix + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +$$r= \sqrt[n]{\prod_{j=1}^{m} \frac{ +\prod_{j=1}^{l} \Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 1, & \Delta_{i,j} \in \{ - \} +\end{array}} +{{\left(\frac{1}{n_j} \times \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}\right)^{n_j}} +} +}$$ + + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + 1, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}$ is count of _non-empty_ elements in $j$ _congeneric intervals chain_, +$\Delta_{i,j}$ the $i$-th element of $j$-th _congeneric intervals chain_. + +$$n=\sum_{j=1}^{m}{n_j}$$ + + +### from Congenerics Intervals Distributions + +Let $CID$ is [_Congenerics Intervals Distributions_](../intervals_distribution.md#as-matrix-ml) defined as matrix + +$$ +CID = +\begin{pmatrix} +cid_{1,1} & cid_{1,2} & \cdots & cid_{1,l} \\ +cid_{2,1} & cid_{2,2} & \cdots & cid_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cid_{m,1} & cid_{m,2} & \cdots & cid_{m,l} +\end{pmatrix} +$$ + +$$r= \sqrt[n]{\prod_{j=1}^{m} \frac{ +\prod_{j=1}^{l} \Bigg\{\begin{array}{l} + i \times cid_{i,j}, & cid_{i,j} \neq 0 \\ + 1, & cid_{i,j} = 0 +\end{array}} +{{\left(\frac{1}{n_j} \times \sum_{i=1}^{l}{(i \times cid_{i,j})}\right)^{n_j}} +} +}$$ + + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{cid_{i,j}}$ is count of _non-empty_ elements in $j$ _congeneric intervals distribution_, +$cid_{i,j}$ the $i$-th element of $j$-th _congeneric intervals distribution_. + +$$n=\sum_{j=1}^{m}{n_j}$$ diff --git a/docs/fundamentals/congeneric_decomposition/characteristics/uniformity.md b/docs/fundamentals/congeneric_decomposition/characteristics/uniformity.md new file mode 100644 index 00000000..260ee66d --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/characteristics/uniformity.md @@ -0,0 +1,63 @@ +# Uniformity + +The Uniformity + +## Mathematical Definition + +The uniformity can be calculated + +### from Congeneric Intervals Chains + +Let $CIC$ is [_Congenerics Intervals Chains_](../intervals_chains.md#as-matrix-ml) defined as matrix + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +$$u = \frac {1} {n} * \sum_{j=1}^{m}{\log_2 \frac{ \left(\sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}\right)^{n_j} } { \prod_{j=1}^{l} \Bigg\{\begin{array}{l} + \Delta_{i,j}, & \Delta_{i,j} \notin \{-\} \\ + 1, & \Delta_{i,j} \in \{ - \} +\end{array}} }$$ + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{\Bigg\{\begin{array}{l} + 1, & \Delta_{i,j} \notin \{-\} \\ + 0, & \Delta_{i,j} \in \{ - \} +\end{array}}$ is count of _non-empty_ elements in $j$ _congeneric intervals chain_, +$\Delta_{i,j}$ the $i$-th element of $j$-th _congeneric intervals chain_. + +$$n=\sum_{j=1}^{m}{n_j}$$ + + +### from Congenerics Intervals Distributions + +Let $CID$ is [_Congenerics Intervals Distributions_](../intervals_distribution.md#as-matrix-ml) defined as matrix + +$$ +CID = +\begin{pmatrix} +cid_{1,1} & cid_{1,2} & \cdots & cid_{1,l} \\ +cid_{2,1} & cid_{2,2} & \cdots & cid_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cid_{m,1} & cid_{m,2} & \cdots & cid_{m,l} +\end{pmatrix} +$$ + +$$u = \frac {1} {n} * \sum_{j=1}^{m}{\log_2 \Bigg(\frac{ \sum_{i=1}^{l}{(i \times cid_{i,j})}^{n_j} } { \prod_{j=1}^{l} \Bigg\{\begin{array}{l} + i \times cid_{i,j}, & cid_{i,j} \neq 0 \\ + 1, & cid_{i,j} = 0 +\end{array}} }\Bigg)$$ + + +where $m$ the _power_, $n_j = \sum_{i=1}^{l}{cid_{i,j}}$ is count of _non-empty_ elements in $j$ _congeneric intervals distribution_, +$cid_{i,j}$ the $i$-th element of $j$-th _congeneric intervals distribution_. + +$$n=\sum_{j=1}^{m}{n_j}$$ diff --git a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_distribution.md b/docs/fundamentals/congeneric_decomposition/congeneric_intervals_distribution.md deleted file mode 100644 index a887f538..00000000 --- a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_distribution.md +++ /dev/null @@ -1,3 +0,0 @@ -# Congeneric Intervals Distribution - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_order.md b/docs/fundamentals/congeneric_decomposition/congeneric_intervals_order.md deleted file mode 100644 index b86f13ae..00000000 --- a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_order.md +++ /dev/null @@ -1,3 +0,0 @@ -# Congeneric Intervals Order - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_tuple.md b/docs/fundamentals/congeneric_decomposition/congeneric_intervals_tuple.md deleted file mode 100644 index 2423c53a..00000000 --- a/docs/fundamentals/congeneric_decomposition/congeneric_intervals_tuple.md +++ /dev/null @@ -1,3 +0,0 @@ -# Congeneric Intervals Tuple - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/congeneric_orders.md b/docs/fundamentals/congeneric_decomposition/congeneric_orders.md deleted file mode 100644 index 57c3cd38..00000000 --- a/docs/fundamentals/congeneric_decomposition/congeneric_orders.md +++ /dev/null @@ -1,3 +0,0 @@ -# Congeneric Orders - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/congeneric_sequences.md b/docs/fundamentals/congeneric_decomposition/congeneric_sequences.md deleted file mode 100644 index dfbdda11..00000000 --- a/docs/fundamentals/congeneric_decomposition/congeneric_sequences.md +++ /dev/null @@ -1,3 +0,0 @@ -# Congeneric Sequences - -Coming soon diff --git a/docs/fundamentals/congeneric_decomposition/index.md b/docs/fundamentals/congeneric_decomposition/index.md index 878292d3..912a6df4 100644 --- a/docs/fundamentals/congeneric_decomposition/index.md +++ b/docs/fundamentals/congeneric_decomposition/index.md @@ -1,3 +1,244 @@ # Congeneric Decomposition -Coming soon +Any [_Sequence_](../order/sequence.md) (including [_Partial Sequence_](../partials_and_congenerics/sequence/index.md)) can be decomposed into $m$ (power of an [_Alphabet_](../order/alphabet.md)) [_Congeneric Sequences_](../partials_and_congenerics/sequence/congeneric.md) length of $l$. Each _congeneric sequence_ would be [_compatible_](../partials_and_congenerics/sequence/index.md#compatibility) with all other _congeneric sequences_, so the procedure is invertible. Result of the decomposition can be represented as a matrix $m \times l$ + +The sequence + +``` mermaid +block-beta + columns 36 + seq1["I"] seq2["N"] seq3["T"] seq4["E"] seq5["L"] seq6["L"] seq7["I"] seq8["G"] seq9["E"] seq10["N"] + seq11["C"] seq12["E"] seq13[" "] seq14["I"] seq15["S"] seq16[" "] seq17["T"] seq18["H"] seq19["E"] seq20[" "] + seq21["A"] seq22["B"] seq23["I"] seq24["L"] seq25["I"] seq26["T"] seq27["Y"] seq28[" "] seq29["T"] seq30["O"] + seq31[" "] seq32["A"] seq33["D"] seq34["A"] seq35["P"] seq36["T"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + class seq1,seq7,seq14,seq23,seq25,i1,i7,i14,i23,i25 c1 + class seq2,seq10,n2,n10 c2 + class seq3,seq17,seq26,seq29,seq36,t3,t17,t26,t29,t36 c3 + class seq4,seq9,seq12,seq19,e4,e9,e12,e19 c4 + class seq5,seq6,seq24,l5,l6,l24 c5 + class seq8,g8 c6 + class seq11,c11 c7 + class seq13,seq16,seq20,seq28,seq31,sp13,sp16,sp20,sp28,sp31 c8 + class seq15,s15 c9 + class seq18,h18 c10 + class seq21,seq32,seq34,a21,a32,a34 c11 + class seq22,b22 c12 + class seq27,y27 c13 + class seq30,o30 c14 + class seq33,d33 c15 + class seq35,p35 c16 +``` + +decomposed into + +``` mermaid +block-beta + columns 37 + diag["⟍"] col1["1"] col2["2"] space:16 col19["..."] space:16 col36["l"] + row1["1"] i1["I"] i2["-"] i3["-"] i4["-"] i5["-"] i6["-"] i7["I"] i8["-"] i9["-"] i10["-"] + i11["-"] i12["-"] i13["-"] i14["I"] i15["-"] i16["-"] i17["-"] i18["-"] i19["-"] i20["-"] + i21["-"] i22["-"] i23["I"] i24["-"] i25["I"] i26["-"] i27["-"] i28["-"] i29["-"] i30["-"] + i31["-"] i32["-"] i33["-"] i34["-"] i35["-"] i36["-"] + row2["2"] n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] + n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] + n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] n30["-"] + n31["-"] n32["-"] n33["-"] n34["-"] n35["-"] n36["-"] + space t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] + t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] + t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] t30["-"] + t31["-"] t32["-"] t33["-"] t34["-"] t35["-"] t36["T"] + space e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["E"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] e30["-"] + e31["-"] e32["-"] e33["-"] e34["-"] e35["-"] e36["-"] + space l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] + l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] + l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] l30["-"] + l31["-"] l32["-"] l33["-"] l34["-"] l35["-"] l36["-"] + space g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] + g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] + g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] g30["-"] + g31["-"] g32["-"] g33["-"] g34["-"] g35["-"] g36["-"] + space c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] + c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] + c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] c30["-"] + c31["-"] c32["-"] c33["-"] c34["-"] c35["-"] c36["-"] + space sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] + sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] + sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28[" "] sp29["-"] sp30["-"] + sp31[" "] sp32["-"] sp33["-"] sp34["-"] sp35["-"] sp36["-"] + row9["⋮"] s1["-"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["S"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] s30["-"] + s31["-"] s32["-"] s33["-"] s34["-"] s35["-"] s36["-"] + space h1["-"] h2["-"] h3["-"] h4["-"] h5["-"] h6["-"] h7["-"] h8["-"] h9["-"] h10["-"] + h11["-"] h12["-"] h13["-"] h14["-"] h15["-"] h16["-"] h17["-"] h18["H"] h19["-"] h20["-"] + h21["-"] h22["-"] h23["-"] h24["-"] h25["-"] h26["-"] h27["-"] h28["-"] h29["-"] h30["-"] + h31["-"] h32["-"] h33["-"] h34["-"] h35["-"] h36["-"] + space a1["-"] a2["-"] a3["-"] a4["-"] a5["-"] a6["-"] a7["-"] a8["-"] a9["-"] a10["-"] + a11["-"] a12["-"] a13["-"] a14["-"] a15["-"] a16["-"] a17["-"] a18["-"] a19["-"] a20["-"] + a21["A"] a22["-"] a23["-"] a24["-"] a25["-"] a26["-"] a27["-"] a28["-"] a29["-"] a30["-"] + a31["-"] a32["A"] a33["-"] a34["A"] a35["-"] a36["-"] + space b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] + b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] + b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] b30["-"] + b31["-"] b32["-"] b33["-"] b34["-"] b35["-"] b36["-"] + space y1["-"] y2["-"] y3["-"] y4["-"] y5["-"] y6["-"] y7["-"] y8["-"] y9["-"] y10["-"] + y11["-"] y12["-"] y13["-"] y14["-"] y15["-"] y16["-"] y17["-"] y18["-"] y19["-"] y20["-"] + y21["-"] y22["-"] y23["-"] y24["-"] y25["-"] y26["-"] y27["Y"] y28["-"] y29["-"] y30["-"] + y31["-"] y32["-"] y33["-"] y34["-"] y35["-"] y36["-"] + space o1["-"] o2["-"] o3["-"] o4["-"] o5["-"] o6["-"] o7["-"] o8["-"] o9["-"] o10["-"] + o11["-"] o12["-"] o13["-"] o14["-"] o15["-"] o16["-"] o17["-"] o18["-"] o19["-"] o20["-"] + o21["-"] o22["-"] o23["-"] o24["-"] o25["-"] o26["-"] o27["-"] o28["-"] o29["-"] o30["O"] + o31["-"] o32["-"] o33["-"] o34["-"] o35["-"] o36["-"] + space d1["-"] d2["-"] d3["-"] d4["-"] d5["-"] d6["-"] d7["-"] d8["-"] d9["-"] d10["-"] + d11["-"] d12["-"] d13["-"] d14["-"] d15["-"] d16["-"] d17["-"] d18["-"] d19["-"] d20["-"] + d21["-"] d22["-"] d23["-"] d24["-"] d25["-"] d26["-"] d27["-"] d28["-"] d29["-"] d30["-"] + d31["-"] d32["-"] d33["D"] d34["-"] d35["-"] d36["-"] + row16["m"] p1["-"] p2["-"] p3["-"] p4["-"] p5["-"] p6["-"] p7["-"] p8["-"] p9["-"] p10["-"] + p11["-"] p12["-"] p13["-"] p14["-"] p15["-"] p16["-"] p17["-"] p18["-"] p19["-"] p20["-"] + p21["-"] p22["-"] p23["-"] p24["-"] p25["-"] p26["-"] p27["-"] p28["-"] p29["-"] p30["-"] + p31["-"] p32["-"] p33["-"] p34["-"] p35["P"] p36["-"] + + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + classDef text fill:#fff,color:#000,stroke-width:0px + + class row1,row2,row9,row16 text + class col1,col2,col19,col36 text + class diag text + + + class i2,i3,i4,i5,i6,i8,i9,i10 text + class i11,i12,i13,i15,i16,i17,i18,i19,i20 text + class i21,i22,i24,i26,i27,i28,i29,i30 text + class i31,i32,i33,i34,i35,i36 text + + class n1,n3,n4,n5,n6,n7,n8,n9 text + class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 text + class n21,n22,n23,n24,n25,n26,n27,n28,n29,n30 text + class n31,n32,n33,n34,n35,n36 text + + class t1,t2,t4,t5,t6,t7,t8,t9,t10 text + class t11,t12,t13,t14,t15,t16,t18,t19,t20 text + class t21,t22,t23,t24,t25,t27,t28,t30 text + class t31,t32,t33,t34,t35 text + + class e1,e2,e3,e5,e6,e7,e8,e10 text + class e11,e13,e14,e15,e16,e17,e18,e20 text + class e21,e22,e23,e24,e25,e26,e27,e28,e29,e30 text + class e31,e32,e33,e34,e35,e36 text + + class l1,l2,l3,l4,l7,l8,l9,l10 text + class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 text + class l21,l22,l23,l25,l26,l27,l28,l29,l30 text + class l31,l32,l33,l34,l35,l36 text + + class g1,g2,g3,g4,g5,g6,g7,g9,g10 text + class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 text + class g21,g22,g23,g24,g25,g26,g27,g28,g29,g30 text + class g31,g32,g33,g34,g35,g36 text + + class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 text + class c12,c13,c14,c15,c16,c17,c18,c19,c20 text + class c21,c22,c23,c24,c25,c26,c27,c28,c29,c30 text + class c31,c32,c33,c34,c35,c36 text + + class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 text + class sp11,sp12,sp14,sp15,sp17,sp18,sp19 text + class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29,sp30 text + class sp31,sp32,sp33,sp34,sp35,sp36 text + + class s1,s2,s3,s4,s5,s6,s7,s8,s9,s10 text + class s11,s12,s13,s14,s16,s17,s18,s19,s20 text + class s21,s22,s23,s24,s25,s26,s27,s28,s29,s30 text + class s31,s32,s33,s34,s35,s36 text + + class h1,h2,h3,h4,h5,h6,h7,h8,h9,h10 text + class h11,h12,h13,h14,h15,h16,h17,h19,h20 text + class h21,h22,h23,h24,h25,h26,h27,h28,h29,h30 text + class h31,h32,h33,h34,h35,h36 text + + + class a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 text + class a11,a12,a13,a14,a15,a16,a17,a18,a19,a20 text + class a22,a23,a24,a25,a26,a27,a28,a29,a30 text + class a31,a33,a35,a36 text + + class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 text + class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 text + class b21,b23,b24,b25,b26,b27,b28,b29,b30 text + class b31,b32,b33,b34,b35,b36 text + + class y1,y2,y3,y4,y5,y6,y7,y8,y9,y10 text + class y11,y12,y13,y14,y15,y16,y17,y18,y19,y20 text + class y21,y22,y23,y24,y25,y26,y28,y29,y30 text + class y31,y32,y33,y34,y35,y36 text + + class o1,o2,o3,o4,o5,o6,o7,o8,o9,o10 text + class o11,o12,o13,o14,o15,o16,o17,o18,o19,o20 text + class o21,o22,o23,o24,o25,o26,o27,o28,o29 text + class o31,o32,o33,o34,o35,o36 text + + class d1,d2,d3,d4,d5,d6,d7,d8,d9,d10 text + class d11,d12,d13,d14,d15,d16,d17,d18,d19,d20 text + class d21,d22,d23,d24,d25,d26,d27,d28,d29,d30 text + class d31,d32,d34,d35,d36 text + + class p1,p2,p3,p4,p5,p6,p7,p8,p9,p10 text + class p11,p12,p13,p14,p15,p16,p17,p18,p19,p20 text + class p21,p22,p23,p24,p25,p26,p27,p28,p29,p30 text + class p31,p32,p33,p34,p36 text + + class seq1,seq7,seq14,seq23,seq25,i1,i7,i14,i23,i25 c1 + class seq2,seq10,n2,n10 c2 + class seq3,seq17,seq26,seq29,seq36,t3,t17,t26,t29,t36 c3 + class seq4,seq9,seq12,seq19,e4,e9,e12,e19 c4 + class seq5,seq6,seq24,l5,l6,l24 c5 + class seq8,g8 c6 + class seq11,c11 c7 + class seq13,seq16,seq20,seq28,seq31,sp13,sp16,sp20,sp28,sp31 c8 + class seq15,s15 c9 + class seq18,h18 c10 + class seq21,seq32,seq34,a21,a32,a34 c11 + class seq22,b22 c12 + class seq27,y27 c13 + class seq30,o30 c14 + class seq33,d33 c15 + class seq35,p35 c16 +``` + +Applying [operations](../order/index.md) to [_Congeneric sequences_](./sequences.md) and its derivatives produces [_Congenerics Orders_](./orders.md), [_Congenerics Intervals Chains_](./intervals_chains.md), +[_Congenerics Intervals Distributions_](./intervals_distribution.md) and finally [_Characteristics_](./characteristics/index.md) specific for _congeneric_ matrix. diff --git a/docs/fundamentals/congeneric_decomposition/intervals_chains.md b/docs/fundamentals/congeneric_decomposition/intervals_chains.md new file mode 100644 index 00000000..5c21222c --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/intervals_chains.md @@ -0,0 +1,245 @@ +# Congeneric Intervals Chains + +_Congeneric Intervals Chains_ is a stack of a [_compatible_](../partials_and_congenerics/sequence/index.md#compatibility) [_congeric interval chain_](../partials_and_congenerics/intervals_chain/congeneric.md) +that represents [_Intervals Chain_](../order/intervals_chain/index.md) or [_Partial Intervals Chain_](../partials_and_congenerics/intervals_chain/index.md). The _congeneric intervals chains_ are sorted in the stack by the first position with a _non-empty_ element in it. + +``` mermaid +block-beta +columns 30 + +space i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +j1["1"] s1["23"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["6"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + +j2["2"] n1["-"] n2["21"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["8"] +n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] +n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + +j3["3"] t1["-"] t2["-"] t3["3"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] +t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["14"] t18["-"] t19["-"] t20["-"] +t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["9"] t27["-"] t28["-"] t29["3"] + +j4["4"] e1["-"] e2["-"] e3["-"] e4["21"] e5["-"] e6["-"] e7["-"] e8["-"] e9["5"] e10["-"] +e11["-"] e12["3"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] +e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + +j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["10"] l6["1"] l7["-"] l8["-"] l9["-"] l10["-"] +l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] +l21["-"] l22["-"] l23["-"] l24["18"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + +j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["29"] g9["-"] g10["-"] +g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] +g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + +j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] +c11["29"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] +c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + +j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] +sp11["-"] sp12["-"] sp13["22"] sp14["-"] sp15["-"] sp16["3"] sp17["-"] sp18["-"] sp19["-"] sp20["4"] +sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + +j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] +b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] +b21["-"] b22["29"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s2,s3,s4,s5,s6,s8,s9,s10 index +class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index +class s21,s22,s23,s24,s25,s26,s27,s28,s29 index + +class n1,n3,n4,n5,n6,n7,n8,n9 index +class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index +class n21,n22,n23,n24,n25,n26,n27,n28,n29 index + +class t1,t2,t4,t5,t6,t7,t8,t9,t10 index +class t11,t12,t13,t14,t15,t16,t18,t19,t20 index +class t21,t22,t23,t24,t25,t27,t28 index + +class e1,e2,e3,e5,e6,e7,e8,e10 index +class e11,e13,e14,e15,e16,e17,e18,e19,e20 index +class e21,e22,e23,e24,e25,e26,e27,e28,e29 index + +class l1,l2,l3,l4,l7,l8,l9,l10 index +class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 index +class l21,l22,l23,l25,l26,l27,l28,l29 index + +class g1,g2,g3,g4,g5,g6,g7,g9,g10 index +class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index +class g21,g22,g23,g24,g25,g26,g27,g28,g29 index + +class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index +class c12,c13,c14,c15,c16,c17,c18,c19,c20 index +class c21,c22,c23,c24,c25,c26,c27,c28,c29 index + +class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 index +class sp11,sp12,sp14,sp15,sp17,sp18,sp19 index +class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + +class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index +class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index +class b21,b23,b24,b25,b26,b27,b28,b29 index + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + +class j1,j2,j3,j4,j5,j6,j7,j8,j9 index +``` + +## Mathematical Definition + +Let $IC_{c}$ is [_Congeneric Interval Chain_](../partials_and_congenerics/intervals_chain/congeneric.md#mathematical-definition) + +Define a _Congeric intervals chains_ + +### as m-tuple of congeneric intervals chain + +Let $compatible(IC1_c, IC2_c)$ is [_compatibility of Partial Sequences function_](../partials_and_congenerics/sequence/index.md#compatibility) + +$CIC$ is m-tuple of $IC_c$ _intervals chain_ + +$$CIC = ,$$ + +$$\forall j \in \{1, ..., m\} \exists cic_j \in \{IC_c\}, $$ + +all _congeneric intervals chains_ are _compatible_ + +$$compatible(CIC(k), CIC(j)) \bigg| \forall k,j \in \{1, ..., m\}, k \ne j,$$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, CIC(k)(x) \ne 1 \bigg| CIC(j)(i) \notin \{-\} \land CIC(j)(x) \in \{-\}$$ + +where: + +- $cic_j$​ is called the $j$-th _congeneric intervals chain_. +- $l := |CIC(1)|$ is _length_, $l \in N$ +- $m := |CIC|$ is _power_, $m \in N$ + +### as matrix (m,l) + +$CIC$ is (m,l) matrix of $\{1,..,, l\} \cup \{-\}$ + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +$$\forall j \in \{1, ..., m\}, i \in \{1, ..., l\} \exists \Delta_{j,i} \in \{1,..,, l\} \cup \{-\}, $$ + +columns are _compatible_ + +$$\ \Delta_{k,i} \in \{-\} \big | \forall i \in \{1,...,l\}, \forall j \in \{1,...,m\}, \forall k \ne j,\ \Delta_{j,i} \in \{1,...,l\} $$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, \Delta_{k,x} \in \{-\} \bigg| \Delta_{j,i} \in \{1,...,l\} \land \Delta_{j,x} \in \{-\}$$ + +where: + +- $\Delta_j$​ is called the $j$-th _congeneric intervals chain_ or $j$-th _row_. +- $\Delta_{j,i}$​ is called the $i$-th element of $j$-th _congeneric intervals chain_. +- $l$ is _length_, $l \in N$ +- $m$ is _power_, $m \in N$ + + +### from Congeneric Sequences + +Let $X_{-}$ is a [_Parial carrier set_](../partials_and_congenerics/carrier_set.md#mathematical-definition) + +Let $CS$ is [_Congeneric Sequences_](./sequences.md#mathematical-definition) - (m,l) matrix of $X_{-}$ + +Let $Binging_p$ is [_Partial Binding_](../partials_and_congenerics/intervals_chain/index.md#define-partial-bindings) + +Let $Intervals_p$ is [_Partial Intervals function_](../partials_and_congenerics/intervals_chain/index.md#define-partial-intervals-chain) described as function + +$$Intervals_p : \big\{Binding_p\big\} \times \big\{S_p\} \longrightarrow \big\{ IC_p \big\}$$ + +$$ +CS = +\begin{pmatrix} +cs_{1,1} & cs_{1,2} & \cdots & cs_{1,l} \\ +cs_{2,1} & cs_{2,2} & \cdots & cs_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cs_{m,1} & cs_{m,2} & \cdots & cs_{m,l} +\end{pmatrix} +$$ + +Define + +$$congenerics\_intervals\_chains : \{CS\} \longrightarrow \{CIC\}$$ + +$$congenerics\_intervals\_chains(CS)(j)(i) = Intervals_p(CS(j))(i) $$ + +$$\exists congenerics\_intervals\_chain^{-1} : \{CIC\} \longrightarrow \{CS\},$$ + +$$congenerics\_intervals\_chains^{-1}(CIC)(i) = \Bigg\{\begin{array}{l} + j, & \exists j \in \{1,...,m\}, CIC(j)(i) \notin \{-\} \\ + -, & otherwise +\end{array}$$ + + +### from Congeneric Orders + +Let $CO$ is [_Congeneric Orders_](./orders.md#mathematical-definition) - (m,l) matrix of $\{1,...,l\} \cup \{-\}$ + +Let $Binging_p$ is [_Partial Binding_](../partials_and_congenerics/intervals_chain/index.md#define-partial-bindings) + +Let $Intervals_p$ is [_Partial Intervals function_](../partials_and_congenerics/intervals_chain/index.md#define-partial-intervals-chain) described as function + +$$Intervals_p : \big\{Binding_p\big\} \times \big\{S_p\} \longrightarrow \big\{ IC_p \big\}$$ + +$$ +CO = +\begin{pmatrix} +co_{1,1} & co_{1,2} & \cdots & co_{1,l} \\ +co_{2,1} & co_{2,2} & \cdots & co_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +co_{m,1} & co_{m,2} & \cdots & co_{m,l} +\end{pmatrix} +$$ + +Define + +$$congenerics\_intervals\_chains : \{CO\} \longrightarrow \{CIC\}$$ + +$$congenerics\_intervals\_chains(CO)(j)(i) = Intervals_p(CO(j))(i) $$ + +$$\exists congenerics\_intervals\_chain^{-1} : \{CIC\} \longrightarrow \{CO\},$$ + +$$congenerics\_intervals\_chains^{-1}(CIC)(i) = \Bigg\{\begin{array}{l} + 1, & \exists j \in \{1,...,m\}, CIC(j)(i) \notin \{-\} \\ + -, & otherwise +\end{array}$$ diff --git a/docs/fundamentals/congeneric_decomposition/intervals_distribution.md b/docs/fundamentals/congeneric_decomposition/intervals_distribution.md new file mode 100644 index 00000000..f188b391 --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/intervals_distribution.md @@ -0,0 +1,184 @@ +# Congeneric Intervals Distributions + +_Congeneric Intervals Distributions_ is a stack of [_Partials Intervals Distribution_](../partials_and_congenerics/intervals_distribution.md) +that represents [_Intervals Distribution_](../order/intervals_distribution/index.md). + +``` mermaid +block-beta +columns 30 + +space i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +j1["1"] s1["0"] s2["0"] s3["0"] s4["0"] s5["0"] s6["1"] s7["0"] s8["0"] s9["0"] s10["0"] +s11["0"] s12["0"] s13["0"] s14["0"] s15["0"] s16["0"] s17["0"] s18["0"] s19["0"] s20["0"] +s21["0"] s22["0"] s23["1"] s24["0"] s25["0"] s26["0"] s27["0"] s28["0"] s29["0"] + +j2["2"] n1["0"] n2["0"] n3["0"] n4["0"] n5["0"] n6["0"] n7["0"] n8["1"] n9["0"] n10["0"] +n11["0"] n12["0"] n13["0"] n14["0"] n15["0"] n16["0"] n17["0"] n18["0"] n19["0"] n20["0"] +n21["1"] n22["0"] n23["0"] n24["0"] n25["0"] n26["0"] n27["0"] n28["0"] n29["0"] + +j3["3"] t1["0"] t2["0"] t3["2"] t4["0"] t5["0"] t6["0"] t7["0"] t8["0"] t9["1"] t10["0"] +t11["0"] t12["0"] t13["0"] t14["1"] t15["0"] t16["0"] t17["0"] t18["0"] t19["0"] t20["0"] +t21["0"] t22["0"] t23["0"] t24["0"] t25["0"] t26["0"] t27["0"] t28["0"] t29["0"] + +j4["4"] e1["0"] e2["0"] e3["1"] e4["0"] e5["1"] e6["0"] e7["0"] e8["0"] e9["0"] e10["0"] +e11["0"] e12["0"] e13["0"] e14["0"] e15["0"] e16["0"] e17["0"] e18["0"] e19["0"] e20["0"] +e21["1"] e22["0"] e23["0"] e24["0"] e25["0"] e26["0"] e27["0"] e28["0"] e29["0"] + +j5["5"] l1["1"] l2["0"] l3["0"] l4["0"] l5["0"] l6["0"] l7["0"] l8["0"] l9["0"] l10["1"] +l11["0"] l12["0"] l13["0"] l14["0"] l15["0"] l16["0"] l17["0"] l18["1"] l19["0"] l20["0"] +l21["0"] l22["0"] l23["0"] l24["0"] l25["0"] l26["0"] l27["0"] l28["0"] l29["0"] + +j6["6"] g1["0"] g2["0"] g3["0"] g4["0"] g5["0"] g6["0"] g7["0"] g8["0"] g9["0"] g10["0"] +g11["0"] g12["0"] g13["0"] g14["0"] g15["0"] g16["0"] g17["0"] g18["0"] g19["0"] g20["0"] +g21["0"] g22["0"] g23["0"] g24["0"] g25["0"] g26["0"] g27["0"] g28["0"] g29["1"] + +j7["7"] c1["0"] c2["0"] c3["0"] c4["0"] c5["0"] c6["0"] c7["0"] c8["0"] c9["0"] c10["0"] +c11["0"] c12["0"] c13["0"] c14["0"] c15["0"] c16["0"] c17["0"] c18["0"] c19["0"] c20["0"] +c21["0"] c22["0"] c23["0"] c24["0"] c25["0"] c26["0"] c27["0"] c28["0"] c29["1"] + +j8["8"] sp1["0"] sp2["0"] sp3["1"] sp4["1"] sp5["0"] sp6["0"] sp7["0"] sp8["0"] sp9["0"] sp10["0"] +sp11["0"] sp12["0"] sp13["0"] sp14["0"] sp15["0"] sp16["0"] sp17["0"] sp18["0"] sp19["0"] sp20["0"] +sp21["0"] sp22["1"] sp23["0"] sp24["0"] sp25["0"] sp26["0"] sp27["0"] sp28["0"] sp29["0"] + +j9["9"] b1["0"] b2["0"] b3["0"] b4["0"] b5["0"] b6["0"] b7["0"] b8["0"] b9["0"] b10["0"] +b11["0"] b12["0"] b13["0"] b14["0"] b15["0"] b16["0"] b17["0"] b18["0"] b19["0"] b20["0"] +b21["0"] b22["0"] b23["0"] b24["0"] b25["0"] b26["0"] b27["0"] b28["0"] b29["1"] + + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s1,s2,s3,s4,s5,s7,s8,s9,s10 index +class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index +class s21,s22,s24,s25,s26,s27,s28,s29 index + +class n1,n2,n3,n4,n5,n6,n7,n9,n10 index +class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index +class n22,n23,n24,n25,n26,n27,n28,n29 index + +class t1,t2,t4,t5,t6,t7,t8,t10 index +class t11,t12,t13,t15,t16,t17,t18,t19,t20 index +class t21,t22,t23,t24,t25,t26,t27,t28,t29 index + +class e1,e2,e4,e6,e7,e8,e9,e10 index +class e11,e12,e13,e14,e15,e16,e17,e18,e19,e20 index +class e22,e23,e24,e25,e26,e27,e28,e29 index + +class l2,l3,l4,l5,l6,l7,l8,l9 index +class l11,l12,l13,l14,l15,l16,l17,l19,l20 index +class l21,l22,l23,l24,l25,l26,l27,l28,l29 index + +class g1,g2,g3,g4,g5,g6,g7,g8,g9,g10 index +class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index +class g21,g22,g23,g24,g25,g26,g27,g28 index + +class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index +class c11,c12,c13,c14,c15,c16,c17,c18,c19,c20 index +class c21,c22,c23,c24,c25,c26,c27,c28 index + +class sp1,sp2,sp5,sp6,sp7,sp8,sp9,sp10 index +class sp11,sp12,sp13,sp14,sp15,sp16,sp17,sp18,sp19,sp20 index +class sp21,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + +class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index +class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index +class b21,b22,b23,b24,b25,b26,b27,b28 index + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + +class j1,j2,j3,j4,j5,j6,j7,j8,j9 index +``` + +## Mathematical Definition + +Let $ID_p$ is [_Partial Interval Distribution_](../partials_and_congenerics/intervals_distribution.md#mathematical-definition) + +Define a _Congeric intervals distributions_ + +### as m-tuple of congeneric intervals distributions + +$CID$ is m-tuple of $ID_c$ _intervals distributions_ + +$$CID = ,$$ + +$$\forall j \in \{1, ..., m\} \exists cid_j \in \{ID_c\}, $$ + +where: + +- $cid_j$​ is called the $j$-th _congeneric intervals distribution_. +- $l := |CID(1)|$ is _length_, $l \in N$ +- $m := |CID|$ is _power_, $m \in N$ + +### as matrix (m,l) + +$CID$ is (m,l) matrix of $\{0,..,, l\}$ + +$$ +CID = +\begin{pmatrix} +cid_{1,1} & cid_{1,2} & \cdots & cid_{1,l} \\ +cid_{2,1} & cid_{2,2} & \cdots & cid_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cid_{m,1} & cid_{m,2} & \cdots & cid_{m,l} +\end{pmatrix} +$$ + +$$\forall j \in \{1, ..., m\}, i \in \{1, ..., l\} \exists cid_{j,i} \in \{0,..,, l\}, $$ + +where: + +- $cid_j$​ is called the $j$-th _congeneric intervals distribution_ or $j$-th _row_. +- $cid_{j,i}$​ is called the $i$-th element of $j$-th _congeneric intervals distribution_. +- $l$ is _length_, $l \in N$ +- $m$ is _power_, $m \in N$ + + +### from Congeneric Intervals Chains + +Let $IC_{p}$ is [_Partial Interval Chain_](../partials_and_congenerics/intervals_chain/index.md#define-partial-intervals-chain) + +Let $ID_p$ is [_Partial Intervals distribution_](../partials_and_congenerics/intervals_distribution.md#mathematical-definition) described as function + +$$ID_p : \big\{ IC_p \big\} \longrightarrow \big\{ \{1,...,l\} \longrightarrow N_0 \big\},$$ + +Let $CIC$ is [_Congeneric Intervals Chains_](./intervals_chains.md#as-matrix-ml) - (m,l) matrix of $\{1,...,l\} \cup \{-\}$ + +$$ +CIC = +\begin{pmatrix} +\Delta_{1,1} & \Delta_{1,2} & \cdots & \Delta_{1,l} \\ +\Delta_{2,1} & \Delta_{2,2} & \cdots & \Delta_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +\Delta_{m,1} & \Delta_{m,2} & \cdots & \Delta_{m,l} +\end{pmatrix} +$$ + +Define + +$$congenerics\_intervals\_distributions : \{CIC\} \longrightarrow \{CID\}$$ + +$$congenerics\_intervals\_distributions(CIC)(j)(i) = ID_p(CIC(j))(i) $$ diff --git a/docs/fundamentals/congeneric_decomposition/orders.md b/docs/fundamentals/congeneric_decomposition/orders.md new file mode 100644 index 00000000..f0c980a6 --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/orders.md @@ -0,0 +1,262 @@ +# Congeneric Orders + +_Congeneric orders_ is a stack of a [_compatible_](../partials_and_congenerics/sequence/index.md#compatibility) [_congeric orders_](../partials_and_congenerics/order/congeneric.md) +that represents [_Order_](../order/order.md) or [_Partial Order_](../partials_and_congenerics/order/index.md). The _congeneric orders_ are sorted in the stack by the first position with a _non-empty_ element in it. + +``` mermaid +block-beta +columns 30 + +space i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +j1["1"] s1["1"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["1"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + +j2["2"] n1["-"] n2["1"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["1"] +n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] +n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + +j3["3"] t1["-"] t2["-"] t3["1"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] +t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["1"] t18["-"] t19["-"] t20["-"] +t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["1"] t27["-"] t28["-"] t29["1"] + +j4["4"] e1["-"] e2["-"] e3["-"] e4["1"] e5["-"] e6["-"] e7["-"] e8["-"] e9["1"] e10["-"] +e11["-"] e12["1"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] +e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + +j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["1"] l6["1"] l7["-"] l8["-"] l9["-"] l10["-"] +l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] +l21["-"] l22["-"] l23["-"] l24["1"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + +j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["1"] g9["-"] g10["-"] +g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] +g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + +j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] +c11["1"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] +c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + +j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] +sp11["-"] sp12["-"] sp13["1"] sp14["-"] sp15["-"] sp16["1"] sp17["-"] sp18["-"] sp19["-"] sp20["1"] +sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + +j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] +b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] +b21["-"] b22["1"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s2,s3,s4,s5,s6,s8,s9,s10 index +class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index +class s21,s22,s23,s24,s25,s26,s27,s28,s29 index + +class n1,n3,n4,n5,n6,n7,n8,n9 index +class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index +class n21,n22,n23,n24,n25,n26,n27,n28,n29 index + +class t1,t2,t4,t5,t6,t7,t8,t9,t10 index +class t11,t12,t13,t14,t15,t16,t18,t19,t20 index +class t21,t22,t23,t24,t25,t27,t28 index + +class e1,e2,e3,e5,e6,e7,e8,e10 index +class e11,e13,e14,e15,e16,e17,e18,e19,e20 index +class e21,e22,e23,e24,e25,e26,e27,e28,e29 index + +class l1,l2,l3,l4,l7,l8,l9,l10 index +class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 index +class l21,l22,l23,l25,l26,l27,l28,l29 index + +class g1,g2,g3,g4,g5,g6,g7,g9,g10 index +class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index +class g21,g22,g23,g24,g25,g26,g27,g28,g29 index + +class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index +class c12,c13,c14,c15,c16,c17,c18,c19,c20 index +class c21,c22,c23,c24,c25,c26,c27,c28,c29 index + +class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 index +class sp11,sp12,sp14,sp15,sp17,sp18,sp19 index +class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + +class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index +class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index +class b21,b23,b24,b25,b26,b27,b28,b29 index + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + +class j1,j2,j3,j4,j5,j6,j7,j8,j9 index +``` + +## Mathematical Definition + +Let $X_{-}$ is [_Partial Carrier set_](../partials_and_congenerics/carrier_set.md#mathematical-definition) + +Let $O_{c}$ is [_Congeneric Order_](../partials_and_congenerics/order/congeneric.md#mathematical-definition) + +Define a _Congeric orders_ + +### as m-tuple of congeneric order + +Let $compatible(O1_c, O2_c)$ is [_compatibility of Partial Sequences function_](../partials_and_congenerics/sequence/index.md#compatibility) + +$CO$ is m-tuple of $O_c$ orders + +$$CO = ,$$ + +$$\forall j \in \{1, ..., m\} \exists co_j \in \{O_c\}, $$ + +all _congeneric orders_ are _compatible_ + +$$compatible(CO(k), CO(j)) \bigg| \forall k,j \in \{1, ..., m\}, k \ne j,$$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, CO(k)(x) \ne 1 \bigg| CO(j)(i) = 1 \land CO(j)(x) \ne 1$$ + +where: + +- $co_j$​ is called the $j$-th _congeneric order_. +- $l := |CO(1)|$ is _length_, $l \in N$ +- $m := |CO|$ is _power_, $m \in N$ + +### as matrix (m,l) + +$CO$ is (m,l) matrix of $\{-, 1\}$ + +$$ +C0 = +\begin{pmatrix} +co_{1,1} & co_{1,2} & \cdots & co_{1,l} \\ +co_{2,1} & co_{2,2} & \cdots & co_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +co_{m,1} & co_{m,2} & \cdots & co_{m,l} +\end{pmatrix} +$$ + +$$\forall j \in \{1, ..., m\}, i \in \{1, ..., l\} \exists co_{j,i} \in \{-, 1\}, $$ + +columns are _compatible_ + +$$\ co_{k,i} \ne 1 \big | \forall i \in \{1,...,l\}, \forall j \in \{1,...,m\}, \forall k \ne j,\ co_{j,i} = 1 $$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, co_{k,x} \ne 1 \bigg| co_{j,i} = 1 \land co_{j,x} \ne 1$$ + +where: + +- $co_j$​ is called the $j$-th _congeneric order or $j$-th _row_. +- $co_{j,i}$​ is called the $i$-th element of $j$-th _congeneric order_. +- $l$ is _length_, $l \in N$ +- $m$ is _power_, $m \in N$ + +### from Order + +Let $O_p$ is [_Partial Order_](../partials_and_congenerics/order/index.md#mathematical-definition) defined as function + +$$O_p : \{1,...,l\} \longrightarrow \{1,...,l\} \cup \{-\}$$ + +$$alphabet_p : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +Define + +$$congenerics\_orders : \{O_p\} \longrightarrow \{CO\}$$ + +$$ +congenerics\_orders(O_p)(j)(i) = \Bigg\{\begin{array}{l} + 1 & O_p(i)=j \\ + -, & O_p(i) \in \{-\} \lor O_p(i) \ne j +\end{array} +$$ + +$$\exists congenerics\_orders^{-1} : \{CO\} \longrightarrow \{S_p\},$$ + +$$ +congenerics\_orders^{-1}(CO)(i) = \Bigg\{\begin{array}{l} + j, & \exists j \in \{1,...,m\}, CS(j)(i) = 1 \\ + -, & otherwise +\end{array} +$$ + +### from Congeneric Sequences + +Let $CS$ is [_Congeneric Sequences_](./sequences.md#mathematical-definition) - (m,l) matrix of $X_{-}$ + +$$ +CS = +\begin{pmatrix} +cs_{1,1} & cs_{1,2} & \cdots & cs_{1,l} \\ +cs_{2,1} & cs_{2,2} & \cdots & cs_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cs_{m,1} & cs_{m,2} & \cdots & cs_{m,l} +\end{pmatrix} +$$ + +Define + +$$congenerics\_orders : \{CS\} \longrightarrow \{CO\}$$ + +$$congenerics\_orders(CS)(j)(i) = \Bigg\{\begin{array}{l} + 1, & CS(i) \notin \{-\} \\ + -, & CS(i) \in \{-\} +\end{array}$$ + +$$\exists congenerics\_orders^{-1} : \{CO\} \longrightarrow \{CS\},$$ + +$$congenerics\_orders^{-1}(CO)(i) = \Bigg\{\begin{array}{l} + j, & \exists j \in \{1,...,m\}, CO(j)(i) = 1 \\ + -, & otherwise +\end{array}$$ + +### Congeneric Orders product Alphabet + +Let $X_{-}$ is a [_Parial carrier set_](../partials_and_congenerics/carrier_set.md#mathematical-definition) + +Let $A$ is a [_Aphabet_](./alphabet.md) $A : \{1, ..., m\} \longrightarrow X,$ + +Let $alphabet_p$ is [_Alphabet of Partial Sequence function_](../partials_and_congenerics/alphabet/index.md#mathematical-definition) + +$$alphabet_p : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +Let $CS$ is a [_Congeneric Sequeneces_](./sequences.md#mathematical-definition) + +the following equations are true + +$$CO = congenerics\_orders(CS),$$ + +$$A = alphabet_p(CS),$$ + +$$CS = ( CO \odot A ),$$ + +$$ +CS(j)(i) = \Bigg\{\begin{array}{l} + A(j), & \exists j \in \{1,...,m\}, CO(j)(i) = 1 \\ + -, & otherwise +\end{array} +$$ diff --git a/docs/fundamentals/congeneric_decomposition/sequences.md b/docs/fundamentals/congeneric_decomposition/sequences.md new file mode 100644 index 00000000..fe9f3a4e --- /dev/null +++ b/docs/fundamentals/congeneric_decomposition/sequences.md @@ -0,0 +1,199 @@ +# Congeneric Sequences + +_Congeneric sequences_ is a stack of a [_compatible_](../partials_and_congenerics/sequence/index.md#compatibility) [_congeric sequnces_](../partials_and_congenerics/sequence/congeneric.md) +that represents [_Sequence_](../order/sequence.md) or [_Partial Sequence_](../partials_and_congenerics/sequence/index.md). The _congeneric sequnces_ are ordered in the stack by the first position with a _non-empty_ element in it. + +``` mermaid +block-beta +columns 30 + +space i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +j1["1"] s1["I"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["I"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] + +j2["2"] n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] +n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] +n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] + +j3["3"] t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] +t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] +t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] + +j4["4"] e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] +e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["-"] e20["-"] +e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] + +j5["5"] l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] +l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] +l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] + +j6["6"] g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] +g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] +g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] + +j7["7"] c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] +c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] +c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] + +j8["8"] sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] +sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] +sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28["-"] sp29["-"] + +j9["9"] b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] +b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] +b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] + + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s2,s3,s4,s5,s6,s8,s9,s10 index +class s11,s12,s13,s14,s15,s16,s17,s18,s19,s20 index +class s21,s22,s23,s24,s25,s26,s27,s28,s29 index + +class n1,n3,n4,n5,n6,n7,n8,n9 index +class n11,n12,n13,n14,n15,n16,n17,n18,n19,n20 index +class n21,n22,n23,n24,n25,n26,n27,n28,n29 index + +class t1,t2,t4,t5,t6,t7,t8,t9,t10 index +class t11,t12,t13,t14,t15,t16,t18,t19,t20 index +class t21,t22,t23,t24,t25,t27,t28 index + +class e1,e2,e3,e5,e6,e7,e8,e10 index +class e11,e13,e14,e15,e16,e17,e18,e19,e20 index +class e21,e22,e23,e24,e25,e26,e27,e28,e29 index + +class l1,l2,l3,l4,l7,l8,l9,l10 index +class l11,l12,l13,l14,l15,l16,l17,l18,l19,l20 index +class l21,l22,l23,l25,l26,l27,l28,l29 index + +class g1,g2,g3,g4,g5,g6,g7,g9,g10 index +class g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 index +class g21,g22,g23,g24,g25,g26,g27,g28,g29 index + +class c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 index +class c12,c13,c14,c15,c16,c17,c18,c19,c20 index +class c21,c22,c23,c24,c25,c26,c27,c28,c29 index + +class sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9,sp10 index +class sp11,sp12,sp14,sp15,sp17,sp18,sp19 index +class sp21,sp22,sp23,sp24,sp25,sp26,sp27,sp28,sp29 index + +class b1,b2,b3,b4,b5,b6,b7,b8,b9,b10 index +class b11,b12,b13,b14,b15,b16,b17,b18,b19,b20 index +class b21,b23,b24,b25,b26,b27,b28,b29 index + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index + +class j1,j2,j3,j4,j5,j6,j7,j8,j9 index +``` + +## Mathematical Definition + +Let $X_{-}$ is [_Partial Carrier set_](../partials_and_congenerics/carrier_set.md#mathematical-definition) + +Let $S_{c}$ is [_Congeneric Sequence_](../partials_and_congenerics/sequence/congeneric.md#mathematical-definition) + +Define a _Congeric sequences_ + +### as m-tuple of congeneric sequences + +Let $compatible(S1_c, S2_c)$ is [_compatibility of Partial Sequences function_](../partials_and_congenerics/sequence/index.md#compatibility) + +$CS$ is m-tuple of $S_c$ sequences + +$$CS = ,$$ + +$$\forall j \in \{1, ..., m\} \exists cs_j \in \{S_c\}, $$ + +all _congeneric sequences_ are _compatible_ + +$$compatible(CS(k), CS(j)) \bigg| \forall k,j \in \{1, ..., m\}, k \ne j,$$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, CS(k)(x) \in \{-\} \bigg| CS(j)(i) \notin \{-\} \land CS(j)(x) \in \{-\}$$ + +where: + +- $cs_j$​ is called the $j$-th _congeneric sequence_. +- $l := |CS(1)|$ is _length_, $l \in N$ +- $m := |CS|$ is _power_, $m \in N$ + +### as matrix (m,l) + +$CS$ is (m,l) matrix of $X_{-}$ + +$$ +CS = +\begin{pmatrix} +cs_{1,1} & cs_{1,2} & \cdots & cs_{1,l} \\ +cs_{2,1} & cs_{2,2} & \cdots & cs_{2,l} \\ +\vdots & \vdots & \ddots & \vdots \\ +cs_{m,1} & cs_{m,2} & \cdots & cs_{m,l} +\end{pmatrix} +$$ + +$$\forall j \in \{1, ..., m\}, i \in \{1, ..., l\} \exists cs_{j,i} \in X_{-}, $$ + +columns are _compatible_ + +$$\ cs_{k,i} \in \{-\} \big | \forall i \in \{1,...,l\}, \forall j \in \{1,...,m\}, \forall k \ne j,\ cs_{j,i} \notin \{-\} $$ + +and sorted by first apperance of _non-empty_ element + +$$\forall k > j \in \{1,...,m\},\ x < i \in \{1,...,l\}, cs_{k,x} \in \{-\} \bigg| cs_{j,i} \notin \{-\} \land cs_{j,x} \in \{-\}$$ + +where: + +- $cs_j$​ is called the $j$-th _congeneric sequence_ or $j$-th _row_. +- $cs_{j,i}$​ is called the $i$-th element of $j$-th _congeneric sequence_. +- $l$ is _length_, $l \in N$ +- $m$ is _power_, $m \in N$ + +### from Sequence + +Let $alphabet_p$ is [_Alphabet of Partial Sequence function_](../partials_and_congenerics/alphabet/index.md#mathematical-definition) + +$$alphabet_p : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +Define + +$$congenerics : \{S_p\} \longrightarrow \{CS\}$$ + +$$congenerics(S_p)(j)(i) = \Bigg\{\begin{array}{l} + S_p(i), & S_p(i)=alphabet_p(S_p)(j) \\ + -, & S_p(i) \in \{-\} \lor S_p(i) \ne alphabet_p(S_p)(j) +\end{array}$$. + +$$\exists congenerics^{-1} : \{CS\} \longrightarrow \{S_p\},$$ + +$$congenerics^{-1}(CS)(i) = \Bigg\{\begin{array}{l} + CS(j)(i), & \exists j \in \{1,...,m\}, CS(j)(i) \notin \{-\} \\ + -, & otherwise +\end{array}$$ diff --git a/docs/fundamentals/ideas/congeneric_decomposition.md b/docs/fundamentals/ideas/congeneric_decomposition.md index 878292d3..4bc5b4cf 100644 --- a/docs/fundamentals/ideas/congeneric_decomposition.md +++ b/docs/fundamentals/ideas/congeneric_decomposition.md @@ -1,3 +1,156 @@ +--- +hide: + - toc +--- # Congeneric Decomposition -Coming soon +Cogeneric decomposition is a method for decomposing symbolic sequences from a systems thinking perspective, +emphasizing the importance of order. It decomposes a sequence into a tuple of cogeneric sequences, +each of which consists of equivalent elements at certain positions, while all other positions are empty. +This reversible process preserves the order of the sequence and allows the original sequence to be fully reconstructed. + +The concept of Cogeneric decomposition can be demonstrated using an example: + +Let's assume there is a symbolic sequence `INTELLIGENCE IS THE ABILITY TO ADAPT` congeneric decomposition +could be presented by the following table, where each row is a congeneric sequence and `-` is an empty position in a congeneric sequence. + +``` mermaid +block-beta + columns 36 + seq1["I"] seq2["N"] seq3["T"] seq4["E"] seq5["L"] seq6["L"] seq7["I"] seq8["G"] seq9["E"] seq10["N"] + seq11["C"] seq12["E"] seq13[" "] seq14["I"] seq15["S"] seq16[" "] seq17["T"] seq18["H"] seq19["E"] seq20[" "] + seq21["A"] seq22["B"] seq23["I"] seq24["L"] seq25["I"] seq26["T"] seq27["Y"] seq28[" "] seq29["T"] seq30["O"] + seq31[" "] seq32["A"] seq33["D"] seq34["A"] seq35["P"] seq36["T"] + space:36 + i1["I"] i2["-"] i3["-"] i4["-"] i5["-"] i6["-"] i7["I"] i8["-"] i9["-"] i10["-"] + i11["-"] i12["-"] i13["-"] i14["I"] i15["-"] i16["-"] i17["-"] i18["-"] i19["-"] i20["-"] + i21["-"] i22["-"] i23["I"] i24["-"] i25["I"] i26["-"] i27["-"] i28["-"] i29["-"] i30["-"] + i31["-"] i32["-"] i33["-"] i34["-"] i35["-"] i36["-"] + n1["-"] n2["N"] n3["-"] n4["-"] n5["-"] n6["-"] n7["-"] n8["-"] n9["-"] n10["N"] + n11["-"] n12["-"] n13["-"] n14["-"] n15["-"] n16["-"] n17["-"] n18["-"] n19["-"] n20["-"] + n21["-"] n22["-"] n23["-"] n24["-"] n25["-"] n26["-"] n27["-"] n28["-"] n29["-"] n30["-"] + n31["-"] n32["-"] n33["-"] n34["-"] n35["-"] n36["-"] + t1["-"] t2["-"] t3["T"] t4["-"] t5["-"] t6["-"] t7["-"] t8["-"] t9["-"] t10["-"] + t11["-"] t12["-"] t13["-"] t14["-"] t15["-"] t16["-"] t17["T"] t18["-"] t19["-"] t20["-"] + t21["-"] t22["-"] t23["-"] t24["-"] t25["-"] t26["T"] t27["-"] t28["-"] t29["T"] t30["-"] + t31["-"] t32["-"] t33["-"] t34["-"] t35["-"] t36["T"] + e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["E"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] e30["-"] + e31["-"] e32["-"] e33["-"] e34["-"] e35["-"] e36["-"] + l1["-"] l2["-"] l3["-"] l4["-"] l5["L"] l6["L"] l7["-"] l8["-"] l9["-"] l10["-"] + l11["-"] l12["-"] l13["-"] l14["-"] l15["-"] l16["-"] l17["-"] l18["-"] l19["-"] l20["-"] + l21["-"] l22["-"] l23["-"] l24["L"] l25["-"] l26["-"] l27["-"] l28["-"] l29["-"] l30["-"] + l31["-"] l32["-"] l33["-"] l34["-"] l35["-"] l36["-"] + g1["-"] g2["-"] g3["-"] g4["-"] g5["-"] g6["-"] g7["-"] g8["G"] g9["-"] g10["-"] + g11["-"] g12["-"] g13["-"] g14["-"] g15["-"] g16["-"] g17["-"] g18["-"] g19["-"] g20["-"] + g21["-"] g22["-"] g23["-"] g24["-"] g25["-"] g26["-"] g27["-"] g28["-"] g29["-"] g30["-"] + g31["-"] g32["-"] g33["-"] g34["-"] g35["-"] g36["-"] + c1["-"] c2["-"] c3["-"] c4["-"] c5["-"] c6["-"] c7["-"] c8["-"] c9["-"] c10["-"] + c11["C"] c12["-"] c13["-"] c14["-"] c15["-"] c16["-"] c17["-"] c18["-"] c19["-"] c20["-"] + c21["-"] c22["-"] c23["-"] c24["-"] c25["-"] c26["-"] c27["-"] c28["-"] c29["-"] c30["-"] + c31["-"] c32["-"] c33["-"] c34["-"] c35["-"] c36["-"] + sp1["-"] sp2["-"] sp3["-"] sp4["-"] sp5["-"] sp6["-"] sp7["-"] sp8["-"] sp9["-"] sp10["-"] + sp11["-"] sp12["-"] sp13[" "] sp14["-"] sp15["-"] sp16[" "] sp17["-"] sp18["-"] sp19["-"] sp20[" "] + sp21["-"] sp22["-"] sp23["-"] sp24["-"] sp25["-"] sp26["-"] sp27["-"] sp28[" "] sp29["-"] sp30["-"] + sp31[" "] sp32["-"] sp33["-"] sp34["-"] sp35["-"] sp36["-"] + s1["-"] s2["-"] s3["-"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["S"] s16["-"] s17["-"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["-"] s27["-"] s28["-"] s29["-"] s30["-"] + s31["-"] s32["-"] s33["-"] s34["-"] s35["-"] s36["-"] + h1["-"] h2["-"] h3["-"] h4["-"] h5["-"] h6["-"] h7["-"] h8["-"] h9["-"] h10["-"] + h11["-"] h12["-"] h13["-"] h14["-"] h15["-"] h16["-"] h17["-"] h18["H"] h19["-"] h20["-"] + h21["-"] h22["-"] h23["-"] h24["-"] h25["-"] h26["-"] h27["-"] h28["-"] h29["-"] h30["-"] + h31["-"] h32["-"] h33["-"] h34["-"] h35["-"] h36["-"] + a1["-"] a2["-"] a3["-"] a4["-"] a5["-"] a6["-"] a7["-"] a8["-"] a9["-"] a10["-"] + a11["-"] a12["-"] a13["-"] a14["-"] a15["-"] a16["-"] a17["-"] a18["-"] a19["-"] a20["-"] + a21["A"] a22["-"] a23["-"] a24["-"] a25["-"] a26["-"] a27["-"] a28["-"] a29["-"] a30["-"] + a31["-"] a32["A"] a33["-"] a34["A"] a35["-"] a36["-"] + b1["-"] b2["-"] b3["-"] b4["-"] b5["-"] b6["-"] b7["-"] b8["-"] b9["-"] b10["-"] + b11["-"] b12["-"] b13["-"] b14["-"] b15["-"] b16["-"] b17["-"] b18["-"] b19["-"] b20["-"] + b21["-"] b22["B"] b23["-"] b24["-"] b25["-"] b26["-"] b27["-"] b28["-"] b29["-"] b30["-"] + b31["-"] b32["-"] b33["-"] b34["-"] b35["-"] b36["-"] + y1["-"] y2["-"] y3["-"] y4["-"] y5["-"] y6["-"] y7["-"] y8["-"] y9["-"] y10["-"] + y11["-"] y12["-"] y13["-"] y14["-"] y15["-"] y16["-"] y17["-"] y18["-"] y19["-"] y20["-"] + y21["-"] y22["-"] y23["-"] y24["-"] y25["-"] y26["-"] y27["Y"] y28["-"] y29["-"] y30["-"] + y31["-"] y32["-"] y33["-"] y34["-"] y35["-"] y36["-"] + o1["-"] o2["-"] o3["-"] o4["-"] o5["-"] o6["-"] o7["-"] o8["-"] o9["-"] o10["-"] + o11["-"] o12["-"] o13["-"] o14["-"] o15["-"] o16["-"] o17["-"] o18["-"] o19["-"] o20["-"] + o21["-"] o22["-"] o23["-"] o24["-"] o25["-"] o26["-"] o27["-"] o28["-"] o29["-"] o30["O"] + o31["-"] o32["-"] o33["-"] o34["-"] o35["-"] o36["-"] + d1["-"] d2["-"] d3["-"] d4["-"] d5["-"] d6["-"] d7["-"] d8["-"] d9["-"] d10["-"] + d11["-"] d12["-"] d13["-"] d14["-"] d15["-"] d16["-"] d17["-"] d18["-"] d19["-"] d20["-"] + d21["-"] d22["-"] d23["-"] d24["-"] d25["-"] d26["-"] d27["-"] d28["-"] d29["-"] d30["-"] + d31["-"] d32["-"] d33["D"] d34["-"] d35["-"] d36["-"] + p1["-"] p2["-"] p3["-"] p4["-"] p5["-"] p6["-"] p7["-"] p8["-"] p9["-"] p10["-"] + p11["-"] p12["-"] p13["-"] p14["-"] p15["-"] p16["-"] p17["-"] p18["-"] p19["-"] p20["-"] + p21["-"] p22["-"] p23["-"] p24["-"] p25["-"] p26["-"] p27["-"] p28["-"] p29["-"] p30["-"] + p31["-"] p32["-"] p33["-"] p34["-"] p35["P"] p36["-"] + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + class seq1,seq7,seq14,seq23,seq25,i1,i7,i14,i23,i25 c1 + class seq2,seq10,n2,n10 c2 + class seq3,seq17,seq26,seq29,seq36,t3,t17,t26,t29,t36 c3 + class seq4,seq9,seq12,seq19,e4,e9,e12,e19 c4 + class seq5,seq6,seq24,l5,l6,l24 c5 + class seq8,g8 c6 + class seq11,c11 c7 + class seq13,seq16,seq20,seq28,seq31,sp13,sp16,sp20,sp28,sp31 c8 + class seq15,s15 c9 + class seq18,h18 c10 + class seq21,seq32,seq34,a21,a32,a34 c11 + class seq22,b22 c12 + class seq27,y27 c13 + class seq30,o30 c14 + class seq33,d33 c15 + class seq35,p35 c16 +``` + +Congeneric sequence for `E` +``` mermaid +block-beta + columns 36 + e1["-"] e2["-"] e3["-"] e4["E"] e5["-"] e6["-"] e7["-"] e8["-"] e9["E"] e10["-"] + e11["-"] e12["E"] e13["-"] e14["-"] e15["-"] e16["-"] e17["-"] e18["-"] e19["E"] e20["-"] + e21["-"] e22["-"] e23["-"] e24["-"] e25["-"] e26["-"] e27["-"] e28["-"] e29["-"] e30["-"] + e31["-"] e32["-"] e33["-"] e34["-"] e35["-"] e36["-"] +``` + + +could be a part of multiple symbol sequences that have the same order of `E` element. + +While keeping the main idea, the congeneric decomposition could be applied, with a flavor, to any type of special case symbolic sequences, such as Order. + + + + diff --git a/docs/fundamentals/ideas/geometric_mean_based_characteristics.md b/docs/fundamentals/ideas/geometric_mean_based_characteristics.md index 504d1552..86ba5fb5 100644 --- a/docs/fundamentals/ideas/geometric_mean_based_characteristics.md +++ b/docs/fundamentals/ideas/geometric_mean_based_characteristics.md @@ -1,3 +1,40 @@ +--- +hide: + - toc +--- # Geometric Mean as Alternative to Probability -Coming soon +At first glance, introducing the concept of [intervals](interval_as_a_basic_information_unit.md) may seem like an unnecessary complication. +After all, if the ultimate goal is to estimate the probability of a symbol, there are much simpler methods - counting the frequency of occurrence of a symbol relative to the total. + +However, this perspective begins to shift when we consider other types of aggregate functions beyond the arithmetic mean. +One particularly insightful example is the geometric mean of intervals. +While the arithmetic mean smooths out the "structure" of the data and bring us back to probability +(since the average interval between identical symbols is simply the inverse of their probability), +the geometric mean responds to the diversity of intervals in a fundamentally different way. + +If the intervals between repeated elements are uniform, the geometric mean and the arithmetic mean will be the same. +But as the intervals become more irregular — because symbols appear in bursts or clusters — [the geometric mean begins +to diverge from the arithmetic mean](https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality). +This makes it a sensitive indicator of the order within the sequence, not just the frequency. + +![AM-GM inequality visual proof](https://upload.wikimedia.org/wikipedia/commons/d/d9/AM_GM_inequality_visual_proof.svg) + +*Visual proof of the arithmetic mean - geometric mean inequality. Source: [wikipedia.org](https://en.wikipedia.org/wiki/File:AM_GM_inequality_visual_proof.svg)* + +Building on this idea, Former Order Analysis explored the potential of reinterpreting classical probabilistic and information-theoretic measures in terms of these intervals. +Instead of relying solely on symbol frequencies, it reformulated the measures using the geometric mean instead of probability (arithmetic mean). + +\begin{array}{|c|c|} +\hline +Entropy & Average \ remoteness \\ +\hline +H= - \sum_{j=1}^{m}{p_j \log_2{p_j}} = \frac {1} {n} * \sum_{j=1}^{m}{n_j \log_2 \Delta_{a_j}} & g = \frac{1}{n} * \sum_{j=1}^{m}{n_j \log_2{\Delta_{g_j}}} = \frac{1}{n} * \sum_{j=1}^{m}{\sum_{i=1}^{n_j} \log_2 \Delta_{ij}} \\ +\hline +\end{array} + +*Example of Shennon's Entropy analog - Average remoteness. Where $n$ - seqeunce length, $m$ - alphabet power, $n_j$ - count of element $j$-th, $\Delta_{a_j}$ - average mean of intervals for element $j$-th, $\Delta_{g_j}$ - geometric mean of intervals for element $j$-th, $\Delta_{ij}$ - $i$-th interval for element $j$-thg* + +These measures are fine-grained and sensitive to the temporal or spatial order of elements in a sequence. +Allows us to distinguish between sequences of symbols that may have identical probability distributions +but differ in the way those symbols are arranged - insight that traditional measures completely miss. diff --git a/docs/fundamentals/ideas/index.md b/docs/fundamentals/ideas/index.md index 8c15c86d..b7aecd8b 100644 --- a/docs/fundamentals/ideas/index.md +++ b/docs/fundamentals/ideas/index.md @@ -1,3 +1,20 @@ # Ideas -Coming soon +Formal Order Analsis is based on five main ideas: + +* [Sequence as a Whole Object](sequence_as_a_whole_object.md) - +Treat a symbolic sequence as a unique whole, focusing on its internal structure and emergent properties. + +* [Order as a Property](order_as_a_property.md) - +By replacing each symbol in a sequence with its index in a dynamic alphabet, we define an "Order" — a new property that separates the content of the sequence from its composition. + +* [Congeneric Decomposition](congeneric_decomposition.md) - +This method breaks a symbolic sequence into layered sub-sequences where each layer isolates a single symbol’s positions, +preserving the sequence’s internal order and making its structure more analyzable. + +* [Interval as a Basic Information Unit](interval_as_a_basic_information_unit.md) - +Intervals measure the distance between repeated elements, revealing hidden patterns in repetition and spacing. + +* [Geometric Mean as Alternative to Probability](geometric_mean_based_characteristics.md) - +Using measurements based on the geometric mean of intervals instead of the probability of symbols (the arithmetic mean of occurrence) +allows us to move from recording simple frequency to recording the underlying structure and regularity in the arrangement of symbols. diff --git a/docs/fundamentals/ideas/interval_as_a_basic_information_unit.md b/docs/fundamentals/ideas/interval_as_a_basic_information_unit.md index dba6d4fe..634e1606 100644 --- a/docs/fundamentals/ideas/interval_as_a_basic_information_unit.md +++ b/docs/fundamentals/ideas/interval_as_a_basic_information_unit.md @@ -1,3 +1,54 @@ +--- +hide: + - toc +--- # Interval as a Basic Information Unit -Coming soon +Intervals serve as a fundamental unit of information by measuring the number of different +items, events, or symbols that occur between reseated in a sequence. + +The intervals for symbol `A` in the following sequence would be `[3, 3, 1, 1, 2, 1, 1]` +``` mermaid +block-beta + columns 12 + s1["A"] s2["C"] s3["T"] s4["A"] s5["C"] s6["G"] s7["A"] s8["A"] s9["A"] s10["T"] s11["A"] s12["A"] + i1["3"]:3 i2["3"]:3 i3["1"]:1 i4["1"]:1 i5["2"]:2 i6["1"]:1 i7["1"]:1 + + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + class s1,s4,s7,s8,s9,s11,s12 c3 + class i1,i2,i3,i4,i5,i6,i7 c4 +``` + +In general, a sequence does not necessarily end with the same symbol it begins with. +To cover all cases, we consider the sequence as a looped sequence representing an infinite pattern with the same characteristics as the original data +This cyclic approach corresponds to the idea of ​​representativeness heuristic. + +The intervals for symbol `C` in the following cycled sequence would be `[3, 9]` +``` mermaid +block-beta + columns 15 + s1["A"] s2["C"] s3["T"] s4["A"] s5["C"] s6["G"] s7["A"] s8["A"] s9["A"] s10["T"] s11["A"] s12["A"] space s13["T"] s14["C"] + space i1["3"]:3 i2["9"]:10 + s12 --> s13 + + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + class s2,s5,s14 c3 + class i1,i2 c4 +``` + +The circular pattern preserves both the statistical properties and the order of elements. +Moreover, the average interval length is the inverse of the probability of an event, which directly relates intervals to probability. + +\begin{array}{|c|c|c|} +\hline + & \Delta_a & P \\ +\hline +A & \frac{3 + 3 + 1 + 1 + 2 + 1 + 1}{7} = \frac{12}{7} \approx 1.7142; & \frac{7}{12} = (\frac{12}{7})^{-1} = \Delta_a^{-1} \\ +\hline +C & \frac{3 + 9}{2} = \frac{12}{2} = 6 & \frac{2}{12} = \frac{1}{6} = 6^{-1} = \Delta_a^{-1} \\ +\hline +\end{array} + +This makes intervals a crucial informational unit that offers deeper insights into the sequence than individual occurrences alone. diff --git a/docs/fundamentals/ideas/order_as_a_property.md b/docs/fundamentals/ideas/order_as_a_property.md index 19deeea3..401d2928 100644 --- a/docs/fundamentals/ideas/order_as_a_property.md +++ b/docs/fundamentals/ideas/order_as_a_property.md @@ -1,3 +1,338 @@ +--- +hide: + - toc +--- # Order as a Property -Coming soon +Formal order analysis defines a special property of symbolic sequences - an Order. +The order is a sequence of natural numbers obtained from the original symbolic sequence by replacing each +of its elements with a natural number corresponding to the index of this element in the alphabet +sorted by the appearance of the elements in the original sequence [1, 2, 3]. + +The concept of an Order can be conveniently demonstrated using an example: + + +Let's assume there is a symbolic sequence + +``` mermaid +block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] +``` + + +Find and enumirate the first appearance of each element + +``` mermaid +block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] + + space:36 + + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] space:2 i6_1["6"] space:2 i7_1["7"] space + i8_1["8"] space i9_1["9"] space:2 i10_1["10"] space:2 + i11_1["11"] i12_1["12"] space:4 i13_1["13"] + space:2 i14_1["14"] space:2 + i15_1["15"] space i16_1["16"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,i1_1 c1 + class s2,i2_1 c2 + class s3,i3_1 c3 + class s4,i4_1 c4 + class s5,i5_1 c5 + class s8,i6_1 c6 + class s11,i7_1 c7 + class s13,i8_1 c8 + class s15,i9_1 c9 + class s18,i10_1 c10 + class s21,i11_1 c11 + class s22,i12_1 c12 + class s27,i13_1 c13 + class s30,i14_1 c14 + class s33,i15_1 c15 + class s35,i16_1 c16 + + s1 --> i1_1 + s2 --> i2_1 + s3 --> i3_1 + s4 --> i4_1 + s5 --> i5_1 + s8 --> i6_1 + s11 --> i7_1 + s13 --> i8_1 + s15 --> i9_1 + s18 --> i10_1 + s21 --> i11_1 + s22 --> i12_1 + s27 --> i13_1 + s30 --> i14_1 + s33 --> i15_1 + s35 --> i16_1 +``` + +The alphabet (with indexes) for the sequence would be sequence of unique elements: + + +``` mermaid +block-beta + columns 16 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s8["G"] + s11["C"] s13[" "] s15["S"] s18["H"] + s21["A"] s22["B"] s27["Y"] s30["O"] + s33["D"] s35["P"] + + space:16 + + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] i6_1["6"] i7_1["7"] + i8_1["8"] i9_1["9"] i10_1["10"] + i11_1["11"] i12_1["12"] i13_1["13"] + i14_1["14"] + i15_1["15"] i16_1["16"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,i1_1 c1 + class s2,i2_1 c2 + class s3,i3_1 c3 + class s4,i4_1 c4 + class s5,i5_1 c5 + class s8,i6_1 c6 + class s11,i7_1 c7 + class s13,i8_1 c8 + class s15,i9_1 c9 + class s18,i10_1 c10 + class s21,i11_1 c11 + class s22,i12_1 c12 + class s27,i13_1 c13 + class s30,i14_1 c14 + class s33,i15_1 c15 + class s35,i16_1 c16 + + s1 --> i1_1 + s2 --> i2_1 + s3 --> i3_1 + s4 --> i4_1 + s5 --> i5_1 + s8 --> i6_1 + s11 --> i7_1 + s13 --> i8_1 + s15 --> i9_1 + s18 --> i10_1 + s21 --> i11_1 + s22 --> i12_1 + s27 --> i13_1 + s30 --> i14_1 + s33 --> i15_1 + s35 --> i16_1 + + i1_1 --> s1 + i2_1 --> s2 + i3_1 --> s3 + i4_1 --> s4 + i5_1 --> s5 + i6_1 --> s8 + i7_1 --> s11 + i8_1 --> s13 + i9_1 --> s15 + i10_1 --> s18 + i11_1 --> s21 + i12_1 --> s22 + i13_1 --> s27 + i14_1 --> s30 + i15_1 --> s33 + i16_1 --> s35 +``` + + +Determine the order of the sequence by replacing each element of the sequence with its corresponding alphabet index + +``` mermaid +block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] + + space:36 + + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] i5_2["5"] i1_2["1"] i6_1["6"] i4_2["4"] i2_2["2"] i7_1["7"] i4_3["4"] + i8_1["8"] i1_3["1"] i9_1["9"] i8_2["8"] i3_2["3"] i10_1["10"] i4_4["4"] i8_3["8"] + i11_1["11"] i12_1["12"] i1_4["1"] i5_3["5"] i1_5["1"] i3_3["3"] i13_1["13"] + i8_4["8"] i3_4["3"] i14_1["14"] i8_5["8"] i11_2["11"] + i15_1["15"] i11_3["11"] i16_1["16"] i3_5["3"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s7,s14,s23,s25,i1_1,i1_2,i1_3,i1_4,i1_5 c1 + class s2,s10,i2_1,i2_2 c2 + class s3,s17,s26,s29,s36,i3_1,i3_2,i3_3,i3_4,i3_5 c3 + class s4,s9,s12,s19,i4_1,i4_2,i4_3,i4_4 c4 + class s5,s6,s24,i5_1,i5_2,i5_3 c5 + class s8,i6_1 c6 + class s11,i7_1 c7 + class s13,s16,s20,s28,s31,i8_1,i8_2,i8_3,i8_4,i8_5 c8 + class s15,i9_1 c9 + class s18,i10_1 c10 + class s21,s32,s34,i11_1,i11_2,i11_3 c11 + class s22,i12_1 c12 + class s27,i13_1 c13 + class s30,i14_1 c14 + class s33,i15_1 c15 + class s35,i16_1 c16 + + + s1 --> i1_1 + s7 --> i1_2 + s14 --> i1_3 + s23 --> i1_4 + s25 --> i1_5 + + s2 --> i2_1 + s10 --> i2_2 + + s3 --> i3_1 + s17 --> i3_2 + s26 --> i3_3 + s29 --> i3_4 + s36 --> i3_5 + + s4 --> i4_1 + s9 --> i4_2 + s12 --> i4_3 + s19--> i4_4 + + s5 --> i5_1 + s6 --> i5_2 + s24 --> i5_3 + + s8 --> i6_1 + + s11 --> i7_1 + + s13 --> i8_1 + s16 --> i8_2 + s20 --> i8_3 + s28 --> i8_4 + s31 --> i8_5 + + s15 --> i9_1 + s18 --> i10_1 + + s21 --> i11_1 + s32 --> i11_2 + s34 --> i11_3 + + s22 --> i12_1 + s27 --> i13_1 + s30 --> i14_1 + s33 --> i15_1 + s35 --> i16_1 +``` + + +The order of symbolic sequence `INTELLIGENCE IS THE ABILITY TO ADAPT` is + +``` mermaid +block-beta + columns 36 + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] i5_2["5"] i1_2["1"] i6_1["6"] i4_2["4"] i2_2["2"] i7_1["7"] i4_3["4"] + i8_1["8"] i1_3["1"] i9_1["9"] i8_2["8"] i3_2["3"] i10_1["10"] i4_4["4"] i8_3["8"] + i11_1["11"] i12_1["12"] i1_4["1"] i5_3["5"] i1_5["1"] i3_3["3"] i13_1["13"] + i8_4["8"] i3_4["3"] i14_1["14"] i8_5["8"] i11_2["11"] + i15_1["15"] i11_3["11"] i16_1["16"] i3_5["3"] +``` + +Despite the triviality of the concept Order, it allows us to separate the elements and composition of a sequence and to define the compositional equivalence of different sequences. + +Example of sequences with equals orders: + +```pyodide exec="on" install="foapy,numpy" +import foapy +import numpy as np + +seqA = list("INTELLIGENCE IS THE ABILITY TO ADAPT TO CHANGE") +seqB = list("1N73LL1G3NC321527H324B1L17Y27024D4P72702CH4NG3") +orderA = foapy.order(seqA) +orderB = foapy.order(seqB) +print("SeqA and SeqB orders are equals -", np.all(orderA == orderB)) +print("Order =", orderA) +``` + + + +# References: + +1. Curtis Cooper and Robert E. Kennedy. 1992. Patterns, automata, and Stirling numbers of the second kind. Math. Comput. Educ. 26, 2 (Spring 1992), 120–124. +2. Gumenjuk A., Kostyshin A., Simonova S. An approach to the research of the structure of linguistic and musical texts. Glottometrics. 2002. № 3. P. 61–89. +3. (In russian) V.I. Arnold, Complexity of finite sequences of zeros and ones and geometry of finite function spaces: el. print, 2005. http://mms.mathnet.ru/meetings/2005/arnold.pdf diff --git a/docs/fundamentals/ideas/sequence_as_a_whole_object.md b/docs/fundamentals/ideas/sequence_as_a_whole_object.md new file mode 100644 index 00000000..3f4b72dd --- /dev/null +++ b/docs/fundamentals/ideas/sequence_as_a_whole_object.md @@ -0,0 +1,26 @@ +# Sequence as a whole object + +Symbol sequences are a common model in theoretical and applied science. +This prevalence is since almost any object of study can be represented as a sequence of elements or events. + +However, if we set aside our knowledge of the essence of the elements in a specific case and +consider the sequence itself as a separate object of study, then it turns out that methods used +to study them are almost exclusively statistical. +With the only exception being methods for comparison / alignment of two or more sequences +(for example, the Levenshtein distance). + +None of these methods describe a sequence as a holistic object. +The Levenshtein distance requires another sequence to compare with the original one, which makes +the measures of this approach "relative". The probabilistic approach decomposes the sequence into +elements and calculates their probabilities (frequencies). Thus, the sequence is replaced, as an object of study, +by a probability distribution. In turn, a specific probability distribution corresponds to an infinite +number of sequences with a ratio of elements "close" to the one in the original sequence. +Moments, conditional probabilities, Shannon entropy, and Markov chains allow us to more accurately +model the object under study, but they still essentially rely on the idea of decomposing a sequence +into independent elements, ignoring the sequence as a holistic object. Practically all existing approaches +to the study and description of symbolic sequences originate from the set-theoretic approach. + +Formal order analysis is based on the belief that a symbolic sequence can be considered as a holistic object +with emergent properties, which corresponds to systems thinking. In addition to the distribution +of elements this method studies arrangement of its components - the internal structure (pattern) of the sequence, +which determines its uniqueness among others, including those consisting of the same set of elements. diff --git a/docs/fundamentals/ideas/sequence_as_an_system_object.md b/docs/fundamentals/ideas/sequence_as_an_system_object.md deleted file mode 100644 index c46c29ec..00000000 --- a/docs/fundamentals/ideas/sequence_as_an_system_object.md +++ /dev/null @@ -1,3 +0,0 @@ -# Sequence as a System Object - -Coming soon diff --git a/docs/fundamentals/index.md b/docs/fundamentals/index.md index 5b67ea5f..ab806b84 100644 --- a/docs/fundamentals/index.md +++ b/docs/fundamentals/index.md @@ -1,3 +1,13 @@ # Fundamentals -Coming soon +Welcome to the Fundamentals section. Here, we introduce the core concepts and mathematical tools that underpin the Formal Order Analysis of sequences and their structure. + +- [**Ideas**](./ideas/index.md): This section explores the foundational ideas, motivations, and principles behind Formal Order Analysis. + +- [**Order and its measures**](./order/index.md): Learn about the concept of an Order in sequences, including how to quantify and characterize order using measures such as arithmetic mean, geometric mean, and related _interval-based_ characteristics. + +- [**Partials and Congenerics**](./partials_and_congenerics/index.md): Discover conceptions of _Partial_ and _Congeneric_ sequences, its Order and other derivatives. + +- [**Congeneric Decomposition**](./congeneric_decomposition/index.md): This section details the process and significance of breaking down sequences into congeneric components, providing a framework and measures for deeper structural analysis. + +Each section builds on the previous, providing a comprehensive foundation for understanding and applying formal order analysis to a wide range of problems. diff --git a/docs/fundamentals/objects/alphabet.md b/docs/fundamentals/objects/alphabet.md deleted file mode 100644 index 0c06aac6..00000000 --- a/docs/fundamentals/objects/alphabet.md +++ /dev/null @@ -1,38 +0,0 @@ -# Alphabet - -An alphabet is an ordered set of unique elements of a sequence. -The order of elements in the alphabet is defined by the order of their appearance in the original sequence. - -## Mathematical Definition - -The alphabet $A$ is defined as an ordered set: -$$A = \{a_1, a_2, ..., a_m\}$$ - -Where: -- $m$ is called a power of the alphabet -- $a_i \neq a_j$ for all $i \neq j$ where $i,j \in [1..n]$ -- $a_i \in X$ for all $i \in \{1,2,...,m\}$ -- $X$ is an unordered set -- $=$ is the equivalence relation defined on $X$ - -## Examples - -### Binary Sequence -For sequence $S = <0,1,1,0,1,0,0,1,1,0>$ -The alphabet is $A = \{0,1\}$ - -### Musical Chorus -For sequence $S = $ -The alphabet is $A = \{D,Dmaj7,D6,D,D\#dim,Em,A7,A9\}$ - -### DNA Sequence -For sequence $S = $ -The alphabet is $A = \{A,T,G,C\}$ - -### Character Sequence -For sequence $S = $ -The alphabet is $A = \{t,h,e,\ ,q,u,i,c,k,b,r,o,w,n,f,x,j,m,p,s,v,l,a,z,y,d,g}$ - -### Word Sequence -For sequence $S = $ -The alphabet is $A = \{the,\ ,quick, brown, fox, , jumps, over, lazy, dog\}$ diff --git a/docs/fundamentals/objects/index.md b/docs/fundamentals/objects/index.md deleted file mode 100644 index a314562c..00000000 --- a/docs/fundamentals/objects/index.md +++ /dev/null @@ -1,3 +0,0 @@ -# Objects - -Coming soon diff --git a/docs/fundamentals/objects/interval.md b/docs/fundamentals/objects/interval.md deleted file mode 100644 index 473d9beb..00000000 --- a/docs/fundamentals/objects/interval.md +++ /dev/null @@ -1,3 +0,0 @@ -# Interval - -Coming soon diff --git a/docs/fundamentals/objects/intervals_distribution.md b/docs/fundamentals/objects/intervals_distribution.md deleted file mode 100644 index d2dd8178..00000000 --- a/docs/fundamentals/objects/intervals_distribution.md +++ /dev/null @@ -1,3 +0,0 @@ -# Intervals Distribution - -Coming soon diff --git a/docs/fundamentals/objects/intervals_order.md b/docs/fundamentals/objects/intervals_order.md deleted file mode 100644 index 49c2649a..00000000 --- a/docs/fundamentals/objects/intervals_order.md +++ /dev/null @@ -1,3 +0,0 @@ -# Intervals Order - -Coming soon diff --git a/docs/fundamentals/objects/intervals_tuple.md b/docs/fundamentals/objects/intervals_tuple.md deleted file mode 100644 index 7a219029..00000000 --- a/docs/fundamentals/objects/intervals_tuple.md +++ /dev/null @@ -1,3 +0,0 @@ -# Intervals Tuple - -Coming soon diff --git a/docs/fundamentals/objects/order.md b/docs/fundamentals/objects/order.md deleted file mode 100644 index 7abd7c2d..00000000 --- a/docs/fundamentals/objects/order.md +++ /dev/null @@ -1,3 +0,0 @@ -# Order - -Coming soon diff --git a/docs/fundamentals/order/alphabet.md b/docs/fundamentals/order/alphabet.md new file mode 100644 index 00000000..bdbeee67 --- /dev/null +++ b/docs/fundamentals/order/alphabet.md @@ -0,0 +1,85 @@ +# Alphabet + +An alphabet is a m-tuple of unique elements. + +## Mathematical Definition + +Let $X$ is [_Carrier set_](./carrier_set.md#mathematical-definition) + +The _alphabet_ $A$ is a m-tuple with a uniqueness constraint, can be defined: + +$$A = ,$$ + +$$\forall i,j \in \{1, ... ,m\}, i \neq j \implies a_i \neq a_j,$$ + +$$\forall i \in \{1, ... ,m\} \exists a_i \in X $$ + +Where: + +- $m := |A|$ is called _power_ of the alphabet, $m \in N$ +- $a_i$​ is called the $i$-th _element_ (or coordinate) of the alphabet. + +### Alphabet of Sequence + +Let $X$ is [_Carrier set_](./carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](./sequence.md#mathematical-definition) described as function $S : \{1,...,n\} \longrightarrow X$ + +$$alphabet(S) : \big\{\{1,...,n\} \longrightarrow X \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +$$alphabet(S) = \big$$ + + +Where: + +- $m \leq n$ - power of the alphabet is not greater than length of the sequence + +## Examples + +### Binary Sequence +A binary sequence `0110100110` + +represented as + +$X = \{0,1\}$ + +$A = <0,1>$ + +### Musical Chorus Sequence +A musical chorus for `Jingle bell rock` + +``` +D Dmaj7 D6 +Jingle-bell, Jingle-bell, Jingle-bell Rock. + D D#dim +Jingle-bell swing and + Em A7 Em A7 Em A7 +Jingle-bell ring. Snowin' and blowin' up bushels of fun. +Em A9 A7 +Now the jingle-hop has begun. +``` + +$X = \{A7, A9, D, D6, Dmaj7, D\#dim, Em\}$ + +$A = $ + +### DNA Sequence +A DNA sequence `ATGCTAGCATGCTAGCATGCTAGC` + +$X = \{A,C,T,G\}$ + +$A = $ + +### English Text Sequence as char sequence +An English text sentence `the quick brown fox jumps over the lazy dog` + +$X = \{\ ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\}$ + +$A = $ + +### English Text Sequence as word sequence +An English text sentence `the quick brown fox jumps over the lazy dog` + +$X = \{\ ,quick, fox, brown, the, over, dog, fox, lazy\}$ + +$A = $ diff --git a/docs/fundamentals/order/carrier_set.md b/docs/fundamentals/order/carrier_set.md new file mode 100644 index 00000000..7dfe8628 --- /dev/null +++ b/docs/fundamentals/order/carrier_set.md @@ -0,0 +1,52 @@ +# Carrier set + +A _carrier set_ $X$ is a _set_ of all possible elements of a sequence + +## Mathematical Definition + +Let $X$ be a (possibly infinite) [set](https://en.wikipedia.org/wiki/Set_(mathematics)). + +## Examples + +### Binary Sequence + +A binary sequence `0110100110` + +represented as + +$X = \{0,1\}$ + +### Musical Chorus Sequence + +A musical chorus for `Jingle bell rock` + +``` +D Dmaj7 D6 +Jingle-bell, Jingle-bell, Jingle-bell Rock. + D D#dim +Jingle-bell swing and + Em A7 Em A7 Em A7 +Jingle-bell ring. Snowin' and blowin' up bushels of fun. +Em A9 A7 +Now the jingle-hop has begun. +``` + +$X = \{A7, A9, D, D6, Dmaj7, D\#dim, Em\}$ + +### DNA Sequence + +A DNA sequence `ATGCTAGCATGCTAGCATGCTAGC` + +$X = \{A,C,G,T\}$ + +### English Text Sequence as char sequence + +An English text sentence `the quick brown fox jumps over the lazy dog` + +$X = \{\ ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z \}$ + +### English Text Sequence as word sequence + +An English text sentence `the quick brown fox jumps over the lazy dog` + +$X = \{\ , brown, dog, quick, fox, lazy, over, the\}$ diff --git a/docs/fundamentals/order/characteristics/arithmetic_mean.md b/docs/fundamentals/order/characteristics/arithmetic_mean.md new file mode 100644 index 00000000..b5fd3ec9 --- /dev/null +++ b/docs/fundamentals/order/characteristics/arithmetic_mean.md @@ -0,0 +1,45 @@ +# Arithmetic mean interval + +Arithmetic mean interval is an additive measure indifferent to interval ratios. +The arithmetic mean could be used as a reference for comparing with the geometric mean. +The geometric mean and the arithmetic mean are equal when all intervals are equal, +which is true only for the periodic appearance of the elements in the sequence. + +## Mathematical Definition + +The arithmetic mean interval can be calculated + +### from Intervals Chain + +Let $IC$ is [_Intervals Chain_](../intervals_chain/index.md#mathematical-definition) described as n-tuple + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\}$$ + +$$\Delta_a = \frac{1}{n} \times \sum_{i=1}^{n} \Delta_{i}$$ + +### from Intervals Distribution + +Let $ID$ is [_Intervals Distribution_](../intervals_distribution/index.md#mathematical-definition) described as function + +$$ID : \{1,...,n\} \longrightarrow \{1,...,n\}$$ + +$$\Delta_a(ID) = \frac{\sum_{i=1}^{n} \big(i \times ID(i)\big)}{\sum_{i=1}^{n} ID(i)}$$ + +### Properties + +__With Cycle Bindings, the arithmetic mean interval equals the cardinality of an alphabet__ + +=== "Intervals chain based" + $IC$ produced by [_Cycled Binding_](../intervals_chain/cycled.md#mathematical-definition) + + $\Delta_a = |alphabet(Intervals^{-1}(IC))|$ + +=== "Sequence based" + + Let [Sequence](../sequence.md#mathematical-definition) $S$ + + $A=alphabet(S)$ is [Alpabet](../alphabet.md#mathematical-definition) + + $IC = Intervals(S)$ produced by [_Cycled Binding_](../intervals_chain/cycled.md#mathematical-definition) + + then $\Delta_a = |A|$ diff --git a/docs/fundamentals/order/characteristics/average_remoteness.md b/docs/fundamentals/order/characteristics/average_remoteness.md new file mode 100644 index 00000000..e7dcb9a8 --- /dev/null +++ b/docs/fundamentals/order/characteristics/average_remoteness.md @@ -0,0 +1,30 @@ +# Average Remoteness + +The Average Remoteness is equivalent of the [geometric mean interval](./geometric_mean.md) on a logarithmic scale. +It is sensitive to interval ratios and is preferable from [computational point of view](https://en.wikipedia.org/wiki/Log_probability). + +## Mathematical Definition + +The Average Remoteness interval can be calculated + +### from Intervals Chain + +Let $IC$ is [_Intervals Chain_](../intervals_chain/index.md#mathematical-definition) described as n-tuple + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\}$$ + +$$g = \frac{1}{n} * \sum_{i=1}^{n} \log_2 \Delta_{i}$$ + +### from Intervals Distribution + +Let $ID$ is [_Intervals Distribution_](../intervals_distribution/index.md#mathematical-definition) described as function + +$$ID : \{1,...,n\} \longrightarrow \{1,...,n\}$$ + +$$g(ID) = \frac{\sum_{i=1}^{n} \big(i \times \log_2 ID(i)\big)}{\sum_{i=1}^{n} ID(i)}$$ + +### Properties + +__Geometric mean equals 2 power average remotness__ + +$$\Delta_g = 2^{g}$$ diff --git a/docs/fundamentals/order/characteristics/depth.md b/docs/fundamentals/order/characteristics/depth.md new file mode 100644 index 00000000..564f50a4 --- /dev/null +++ b/docs/fundamentals/order/characteristics/depth.md @@ -0,0 +1,33 @@ +# Depth + +The Depth is equivalent of [Volume](./volume.md) on on a logarithmic scale. +It is sensitive to interval ratios and their count (length of the sequence). +The Depth is better then Volume from [computational point of view](https://en.wikipedia.org/wiki/Log_probability) + +## Mathematical Definition + +The depth can be calculated + +### from Intervals Chain + +Let $IC$ is [_Intervals Chain_](../intervals_chain/index.md#mathematical-definition) described as n-tuple + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\}$$ + +$$G=\sum_{i=1}^{n} \log_2 \Delta_{i}$$ + +### from Intervals Distribution + +Let $ID$ is [_Intervals Distribution_](../intervals_distribution/index.md#mathematical-definition) described as function + +$$ID : \{1,...,n\} \longrightarrow \{1,...,n\}$$ + +$$V(ID)=\prod_{i=1}^{n} i^{ID(i)}$$ + +$$G(ID)=\sum_{i=1}^{n} \big(i \times \log_2 ID(i)\big)$$ + +### Properties + +__Volume equals 2 power depth__ + +$$V = 2^{G}$$ diff --git a/docs/fundamentals/order/characteristics/geometric_mean.md b/docs/fundamentals/order/characteristics/geometric_mean.md new file mode 100644 index 00000000..df89d5b5 --- /dev/null +++ b/docs/fundamentals/order/characteristics/geometric_mean.md @@ -0,0 +1,30 @@ +# Geometric mean interval + +The geometric mean interval is a multiplicative measure that is sensitive to interval ratios. +This property makes it a cornerstone in measuring [Order](../order.md). + +## Mathematical Definition + +The geometric mean interval can be calculated + +### from Intervals Chain + +Let $IC$ is [_Intervals Chain_](../intervals_chain/index.md#mathematical-definition) described as n-tuple + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\}$$ + +$$\Delta_g=\sqrt[n]{\prod_{i=1}^{n} \Delta_{i}}$$ + +### from Intervals Distribution + +Let $ID$ is [_Intervals Distribution_](../intervals_distribution/index.md#mathematical-definition) described as function + +$$ID : \{1,...,n\} \longrightarrow \{1,...,n\}$$ + +$$\Delta_g(ID)=\sqrt[l]{\prod_{i=1}^{n} i^{ID(i)}}, l = \sum_{i=1}^{n} ID(i)$$ + +### Properties + +__Geometric mean is less or equals arithmetic mean__ + +$$\Delta_g \le \Delta_a$$ diff --git a/docs/fundamentals/order/characteristics/index.md b/docs/fundamentals/order/characteristics/index.md new file mode 100644 index 00000000..0408d37d --- /dev/null +++ b/docs/fundamentals/order/characteristics/index.md @@ -0,0 +1,27 @@ +--- +hide: + - toc +--- +# Characteristics + +Formal Order Analysis defines several interval-based measures sensitive to the composition of elements in the original sequence. +All those characteristics are based on two main ideas. +The first one is - the geometric mean of two numbers depends on the ratio of them. +The arithmetic mean takes the same value `3` for `1, 5` and `2, 4` pairs, while the geometric mean will be different. + +The second is that the intervals we extract from the sequence depend on each other, +replacing two different neighboring elements in the original sequence will affect two intervals and affect the measure results. +We need to highlight that intervals, by definition, are measured between the same event appearances +implicitly encapsulate `information` about the event frequencies and the number of different event types. + +In practice, multiplication quickly leads to a stack overflow error. That makes using _linear-scaled_ measures really hard. +To address that problem, FOA uses _logarithmic-scaled_ measure that replaces multiplication of the intervals with the sum of their logarithms. + +All characteristics could be calculated based on [_Intervals Chain_](../intervals_chain/index.md) or [_Intervals Distribution_](../intervals_distribution/index.md). +The following table provides _Intervals Chain_ based formulas. + +| Linear scale | || Logarithmic scale | | +|------------- |-||-|-----------------| +| [Arithmetic Mean](arithmetic_mean.md) | $\Delta_a = \frac{1}{n} * \sum_{i=1}^{n} \Delta_{i}$ || | | +| [Geometric Mean](geometric_mean.md) | $\Delta_g=\sqrt[n]{\prod_{i=1}^{n} \Delta_{i}}$ || $g = \frac{1}{n} * \sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Average Remoteness](average_remoteness.md) | +| [Volume](volume.md) | $V=\prod_{i=1}^{n} \Delta_{i}$ || $G=\sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Depth](depth.md) | diff --git a/docs/fundamentals/order/characteristics/volume.md b/docs/fundamentals/order/characteristics/volume.md new file mode 100644 index 00000000..63243261 --- /dev/null +++ b/docs/fundamentals/order/characteristics/volume.md @@ -0,0 +1,32 @@ +# Volume + +The Volume is a product of all intervals, which is sensitive to interval ratios and their count. +The volume value has exponential grow by increasing the interval count (length of the sequence). +This fact makes it useless in computational models due to overflow error. +Use [_Depth_](./depth.md) as an equivalent measure on a logarithmic scale. + +## Mathematical Definition + +The volume can be calculated + +### from Intervals Chain + +Let $IC$ is [_Intervals Chain_](../intervals_chain/index.md#mathematical-definition) described as n-tuple + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\}$$ + +$$V=\prod_{i=1}^{n} \Delta_{i}$$ + +### from Intervals Distribution + +Let $ID$ is [_Intervals Distribution_](../intervals_distribution/index.md#mathematical-definition) described as function + +$$ID : \{1,...,n\} \longrightarrow \{1,...,n\}$$ + +$$V(ID)=\prod_{i=1}^{n} i^{ID(i)}$$ + +### Properties + +__Volume can be calculated base of geometric mean__ + +$$V = (\Delta_{g})^{n}$$ diff --git a/docs/fundamentals/order/index.md b/docs/fundamentals/order/index.md new file mode 100644 index 00000000..812e28bc --- /dev/null +++ b/docs/fundamentals/order/index.md @@ -0,0 +1,253 @@ +# Order and its measures + +Formal Order Analysis identifies [Order](./order.md) as a sequence's property that could be extracted by replacing elements with their indexes in an [Alphabet](./alphabet.md). + +A pair of Alphabet and Order determines a [Sequence](./sequence.md). + +=== "Alphabet" + + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] + + space:36 + + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] space:2 i6_1["6"] space:2 i7_1["7"] space + i8_1["8"] space i9_1["9"] space:2 i10_1["10"] space:2 + i11_1["11"] i12_1["12"] space:4 i13_1["13"] + space:2 i14_1["14"] space:2 + i15_1["15"] space i16_1["16"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,i1_1 c1 + class s2,i2_1 c2 + class s3,i3_1 c3 + class s4,i4_1 c4 + class s5,i5_1 c5 + class s8,i6_1 c6 + class s11,i7_1 c7 + class s13,i8_1 c8 + class s15,i9_1 c9 + class s18,i10_1 c10 + class s21,i11_1 c11 + class s22,i12_1 c12 + class s27,i13_1 c13 + class s30,i14_1 c14 + class s33,i15_1 c15 + class s35,i16_1 c16 + + s1 --> i1_1 + s2 --> i2_1 + s3 --> i3_1 + s4 --> i4_1 + s5 --> i5_1 + s8 --> i6_1 + s11 --> i7_1 + s13 --> i8_1 + s15 --> i9_1 + s18 --> i10_1 + s21 --> i11_1 + s22 --> i12_1 + s27 --> i13_1 + s30 --> i14_1 + s33 --> i15_1 + s35 --> i16_1 + + i1_1 --> s1 + i2_1 --> s2 + i3_1 --> s3 + i4_1 --> s4 + i5_1 --> s5 + i6_1 --> s8 + i7_1 --> s11 + i8_1 --> s13 + i9_1 --> s15 + i10_1 --> s18 + i11_1 --> s21 + i12_1 --> s22 + i13_1 --> s27 + i14_1 --> s30 + i15_1 --> s33 + i16_1 --> s35 + + ``` + +=== "Order" + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] + + space:36 + + i1_1["1"] i2_1["2"] i3_1["3"] i4_1["4"] i5_1["5"] i5_2["5"] i1_2["1"] i6_1["6"] i4_2["4"] i2_2["2"] i7_1["7"] i4_3["4"] + i8_1["8"] i1_3["1"] i9_1["9"] i8_2["8"] i3_2["3"] i10_1["10"] i4_4["4"] i8_3["8"] + i11_1["11"] i12_1["12"] i1_4["1"] i5_3["5"] i1_5["1"] i3_3["3"] i13_1["13"] + i8_4["8"] i3_4["3"] i14_1["14"] i8_5["8"] i11_2["11"] + i15_1["15"] i11_3["11"] i16_1["16"] i3_5["3"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s7,s14,s23,s25,i1_1,i1_2,i1_3,i1_4,i1_5 c1 + class s2,s10,i2_1,i2_2 c2 + class s3,s17,s26,s29,s36,i3_1,i3_2,i3_3,i3_4,i3_5 c3 + class s4,s9,s12,s19,i4_1,i4_2,i4_3,i4_4 c4 + class s5,s6,s24,i5_1,i5_2,i5_3 c5 + class s8,i6_1 c6 + class s11,i7_1 c7 + class s13,s16,s20,s28,s31,i8_1,i8_2,i8_3,i8_4,i8_5 c8 + class s15,i9_1 c9 + class s18,i10_1 c10 + class s21,s32,s34,i11_1,i11_2,i11_3 c11 + class s22,i12_1 c12 + class s27,i13_1 c13 + class s30,i14_1 c14 + class s33,i15_1 c15 + class s35,i16_1 c16 + + + s1 --> i1_1 + s7 --> i1_2 + s14 --> i1_3 + s23 --> i1_4 + s25 --> i1_5 + + s2 --> i2_1 + s10 --> i2_2 + + s3 --> i3_1 + s17 --> i3_2 + s26 --> i3_3 + s29 --> i3_4 + s36 --> i3_5 + + s4 --> i4_1 + s9 --> i4_2 + s12 --> i4_3 + s19--> i4_4 + + s5 --> i5_1 + s6 --> i5_2 + s24 --> i5_3 + + s8 --> i6_1 + + s11 --> i7_1 + + s13 --> i8_1 + s16 --> i8_2 + s20 --> i8_3 + s28 --> i8_4 + s31 --> i8_5 + + s15 --> i9_1 + s18 --> i10_1 + + s21 --> i11_1 + s32 --> i11_2 + s34 --> i11_3 + + s22 --> i12_1 + s27 --> i13_1 + s30 --> i14_1 + s33 --> i15_1 + s35 --> i16_1 + ``` + +--- + +Studying the Order FOA developed methods of measuring the Order that are very sensitive to the composition of the elements in a sequence. + +The following diagrams give a hand in understanding how the Objects and Methods defined in FOA relates to each other. + +=== "Order as a property" + ```mermaid + flowchart TB + Start@{ shape: sm-circ, label: "" }-- Sequence -->fork1@{ shape: sm-circ, label: "" } + fork1-- Sequence -->alphabet + alphabet-- Alphabet -->OA@{ shape: sm-circ } + fork1-- Sequence -->order + order-- Order -->OA + OA-- Sequence -->End@{ shape: sm-circ } + + click alphabet "./alphabet" "Alphabet" + click order "./order" "Order" + ``` + +=== "Interval-based characteristics" + ```mermaid + flowchart TB + Start@{ shape: sm-circ, label: "" }-- Sequence -->fork1@{ shape: sm-circ, label: "" } + fork1-- Sequence -->alphabet + alphabet-- Alphabet -->OA@{ shape: cross-circ } + order-- Order -->OA@{ shape: sm-circ } + OA-- Sequence -->End@{ shape: sm-circ } + + fork1@{ shape: sm-circ, label: "" }-- Sequence -->intervals + intervals-- Intervals Chain -->fork@{ shape: sm-circ, label: "" } + fork@{ shape: sm-circ, label: "" }-- Intervals Chain -->inverseIntervals@{ label: "intervals⁻¹" } + fork@{ shape: sm-circ, label: "" }-- Intervals Chain -->distribution + inverseIntervals@{ label: "intervals⁻¹" }-- Reconstructed Sequence --> order + distribution-- Intervals Distribution --> M@{ shape: sm-circ, label: "order + alphabet" } + M --> da@{ label: "Δa" } + M --> dg@{ label: "Δg" } + M --> g@{ label: "g" } + M --> V@{ label: "V" } + M --> G@{ label: "G" } + da -- float --> EndMeasureda@{ shape: sm-circ } + dg -- float --> EndMeasuredg@{ shape: sm-circ } + g -- float --> EndMeasureg@{ shape: sm-circ } + V -- int --> EndMeasureV@{ shape: sm-circ } + G -- float --> EndMeasureG@{ shape: sm-circ } + + + click alphabet "./alphabet" "Alphabet" + click order "./order" "Order" + click intervals "./intervals_chain/#define-intervals-chain" "Intervals" + click inverseIntervals "./intervals_chain/#define-intervals-chain" "Intervals⁻" + click distribution "./intervals_distribution" "Distribution" + click distribution "./intervals_distribution" "Distribution" + click dg "./characteristics/geometric_mean" "Geomteric mean" + click da "./characteristics/arithmetic_mean" "Arithmetic mean" + click g "./characteristics/average_remoteness" "Average remoteness" + click G "./characteristics/depth" "Depth" + click V "./characteristics/volume" "Volume" + ``` diff --git a/docs/fundamentals/order/intervals_chain/bounded.md b/docs/fundamentals/order/intervals_chain/bounded.md new file mode 100644 index 00000000..60ea4cb8 --- /dev/null +++ b/docs/fundamentals/order/intervals_chain/bounded.md @@ -0,0 +1,247 @@ +# Bounded Intervals Chain + +A _bounded intervals chain_ is an [_intervals chain_](index.md) produced with _Bounded Binding_. +_Bounded Binding_ treats a sequence as a finite and uses $0$ and $n+1$ positions (depedns of _Iterator_ direction) +as _corresponding position_ anytime there is no `next` matching element. +The approach simplifies implementation functions and enables obtaining _binding direction_ based on a given _bounded intervals chain_ due to its specific properties. +This comes with a cost of the intervals' consistency that depends on _binding direction_ and leads to different measure values. +_Bounded Binding_ identifies _Start_ and _End_ directions. + + +=== "$Start$ binding" + + ``` mermaid + block-beta + columns 8 + p0["0"] p1["1"] space:3 p5["5"] p6["n"] space + inf["⊥"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] space + e0["0 = Iterator(1)"]:2 space:6 + space t1["1 = Iterator(5)"]:5 space:2 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class inf,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + +=== "$End$ binding" + + ``` mermaid + block-beta + columns 8 + space p1["1"] space:3 p5["5"] p6["n"] p7["n + 1"] + space s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] sup["⊥"] + space t1["Iterator(1) = 5"]:5 space:2 + space:5 e0["Iterator(5) = n+1"]:3 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class sup,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + + +## Mathematical Definition + +Let $X$ is [_Carrier set_](../carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](../sequence.md#mathematical-definition) length of $n$ described as function $S : \{1,...,n\} \longrightarrow X$ + +Let $Binding$ is [Binding](./index.md#define-bindings) + +### Define Bindings + +=== "$Start$ binding" + Define a set of terminal values - $\bot = \{0\}$ + + Let $R : \{1,...,n\} \longrightarrow \{1,...,n\} \cup \bot,$ is a corresponding _references_ + + Define + + $$Iterator : \big\{ S \big\} \longrightarrow \big\{ R \big\},$$ + + $$Iterator(S)(i) = \Bigg\{\begin{array}{l} max \big\{j \in \{1,...,i\}\big|S(j) = S(i) \land j \ne i \big\} & if \ exists \\ 0 & otherwise \end{array}$$ + + $$Start = \in \{Binding\}$$ + + $$\exists Start^{-1} = \in \{Binding^{-1}\},$$ + + $$Iterator^{-1} : \big\{ R \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\}$$ + + $$Iterator^{-1}(R)(i) = \Bigg\{\begin{array}{l} \Big|\Big|, & \ R(i) \in \bot \\ Iterator^{-1}(R, R(i)), & R(i) \in \{1,...,n\} \end{array}$$ + + $$Iterator(S) = Iterator(Iterator^{-1}(Iterator(S)))$$ + + +=== "$End$ binding" + Define a set of terminal values - $\bot = \{n+1\}$ + + Let $R : \{1,...,n\} \longrightarrow \{1,...,n\} \cup \bot,$ is a corresponding _references_ + + Define + + $$Iterator : \big\{ S \big\} \longrightarrow \big\{ R \big\},$$ + + $$Iterator(S)(i) = \Bigg\{\begin{array}{l} min \big\{j \in \{i,...,n\}\big|S(j) = S(i) \land j \ne i \big\} & if \ exists \\ n+1 & otherwise \end{array}$$ + + $$End = \in \{Binding\}$$ + + $$\exists End^{-1} = \in \{Binding^{-1}\},$$ + + $$Iterator^{-1} : \big\{ R \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\}$$ + + $$Iterator^{-1}(R)(i) = \Bigg\{\begin{array}{l} \Big|\Big|, & \ R(i) \in \bot \\ Iterator^{-1}(R, R(i)), & R(i) \in \{1,...,n\} \end{array}$$ + + $$Iterator(S) = Iterator(Iterator^{-1}(Iterator(S)))$$ + +--- + +### Define Intervals Chain + +=== "$Start$ binding" + + Define + + $$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\},$$ + + $$\exists \ Intervals : \big\{S\} \longrightarrow \big\{ IC \big\},$$ + + $$Intervals(S)(i) = | i - Iterator(S)(i)|,$$ + + $$\exists \ Follow : \big\{ IC \big\} \longrightarrow \big\{ R \big\},$$ + + $$Follow(IC)(i) = i - IC(i),$$ + + $$\exists Intervals^{-1} : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\},$$ + + $$Intervals^{-1}(IC)(i) = Iterator^{-1}(Follow(IC))(i),$$ + + $$Intervals(S) = Intervals(Intervals^{-1}(Intervals(S)))$$ + + $$\exists Trace : \big\{ IC \big\} \longrightarrow \big\{ R \big\}$$ + + $$Trace(IC)(i) = \Bigg\{\begin{array}{l} i, & \ i \in \bot \\ Trace\big(IC\big)\big(Follow(IC, i)\big) & i \in \{1,...,n\} \end{array}$$ + + + Where: + + - $n := |IC|$ is called _length_ of the _intervals chained_, $n \in N$ + - $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _intervals chained_ + + +=== "$End$ binding" + + Define + + $$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\},$$ + + $$\exists \ Intervals : \big\{S\} \longrightarrow \big\{ IC \big\},$$ + + $$Intervals(S)(i) = | i - Iterator(S)(i)|,$$ + + $$\exists \ Follow : \big\{ IC \big\} \longrightarrow \big\{ R \big\},$$ + + $$Follow(IC)(i) = i + IC(i),$$ + + $$\exists Intervals^{-1} : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\},$$ + + $$Intervals^{-1}(IC)(i) = Iterator^{-1}(Follow(IC))(i),$$ + + $$Intervals(S) = Intervals(Intervals^{-1}(Intervals(S)))$$ + + $$\exists Trace : \big\{ IC \big\} \longrightarrow \big\{ R \big\}$$ + + $$Trace(IC)(i) = \Bigg\{\begin{array}{l} i, & \ i \in \bot \\ Trace\big(IC\big)\big(Follow(IC, i)\big) & i \in \{1,...,n\} \end{array}$$ + + + Where: + + - $n := |IC|$ is called _length_ of the _intervals chained_, $n \in N$ + - $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _intervals chained_ + + +--- + +#### Special properties + +_Intervals chain_ $IC$ have been calculated with _Bounded binding_ have a special properties + +=== "$Start$ binding" + + $$IC(1) = 1$$ + + $$IC(i) \le i | \forall i \in \{1,...,n\}$$ + + $$Follow(IC)(i) <> Follow(IC)(j) \lor Follow(IC)(i) \in \bot | \forall i != j$$ + + $$Trace(IC)(i) = 0 | \forall i \in \{1,...,n\}$$ + +=== "$End$ binding" + + $$IC(n) = 1$$ + + $$IC(i) \le n - i | \forall i \in \{1,...,n\}$$ + + $$Follow(IC)(i) <> Follow(IC)(j) \lor Follow(IC)(i) \in \bot | \forall i != j$$ + + $$Trace(IC)(i) = n + 1 | \forall i \in \{1,...,n\}$$ + + +--- + +Let $B = \{Start, End\} \subset \{Binding\}$ is set of _Bounded Binding_ diff --git a/docs/fundamentals/order/intervals_chain/cycled.md b/docs/fundamentals/order/intervals_chain/cycled.md new file mode 100644 index 00000000..64b56c74 --- /dev/null +++ b/docs/fundamentals/order/intervals_chain/cycled.md @@ -0,0 +1,264 @@ +# Cycled Intervals Chain + +A _cycled intervals chain_ is an [_intervals chain_](index.md) produced with _Cycled Binding_. +_Cycled Binding_ treats a sequence as a subsequence representing an infinite sequence. + +The approach alignged with [Representativeness heuristic](https://en.wikipedia.org/wiki/Representativeness_heuristic) idea, +connects FOA with [Necklace](https://en.wikipedia.org/wiki/Necklace_(combinatorics)) problem and +makes intervals based measures indeferent to _binding direction_. + +_Cycled Binding_ identifies _Start_ and _End_ directions. + +_Cycled Binding_ extends the sequence by copying itself as a prefix and suffix. +This is enough to mock it as a cycled sequence (also known as a periodic sequence or an orbit) and +use the prefix and suffix to find the corresponding position for the element in edge cases. + + +=== "$Start$ binding" + + ``` mermaid + block-beta + columns 18 + pomn["-n+1"] space:4 p00["0"] p01["1"] space:4 p06["n"] p07["n + 1"] space:4 p02n["n + n"] + p1["A"] p2["C"] p3["T"] p4["C"] p5["A"] p6["G"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] f1["A"] f2["C"] f3["T"] f4["C"] f5["A"] f6["G"] + space:5 ia1["2"]:2 space:11 + space:4 ic1["4"]:4 space:10 + space:3 it1["6"]:6 space:9 + space:6 ig1["6"]:6 space:6 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,ia1 c2 + class p5 c2a + class s2,ic1 c4 + class p4 c4a + class s3,it1 c6 + class p3 c6a + class s6,ig1 c14 + class p6 c14a + class p1,p2,p3,p4,p5,p6,p7,p8,p9,f1,f2,f3,f4,f5,f6,f7,f8,f9 imaginary + class pomn,p00,p01,p06,p07,p02n position + + ``` + +=== "$End$ binding" + + ``` mermaid + block-beta + columns 18 + pomn["-n+1"] space:4 p00["0"] p01["1"] space:4 p06["n"] p07["n + 1"] space:4 p02n["n + n"] + p1["A"] p2["C"] p3["T"] p4["C"] p5["A"] p6["G"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] f1["A"] f2["C"] f3["T"] f4["C"] f5["A"] f6["G"] + space:10 ia1["2"]:2 space:6 + space:9 ic1["4"]:4 space:5 + space:8 it1["6"]:6 space:5 + space:10 ig1["6"]:6 space:1 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s5,ia1 c2 + class f1 c2a + class s4,ic1 c4 + class f2 c4a + class s3,it1 c6 + class f3 c6a + class s6,ig1 c14 + class f6 c14a + class p1,p2,p3,p4,p5,p6,p7,p8,p9,f1,f2,f3,f4,f5,f6,f7,f8,f9 imaginary + class pomn,p00,p01,p06,p07,p02n position + + ``` + +## Mathematical Definition + +Let $X$ is [_Carrier set_](../carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](../sequence.md#mathematical-definition) length of $n$ described as function $S : \{1,...,n\} \longrightarrow X$ + +Let $Binding$ is [Binding](./index.md#define-bindings) + +Let $S_{cycled} : \big\{ \{1,...,n\} \longrightarrow X \big\} \longrightarrow \big\{ Z \longrightarrow X \big\}$ is a cycled sequence + +$$S_{cycled}(S)(i) = S\big( i - n \times \lfloor ( i - 1) \div n \rfloor \big)$$ + + +### Define Bindings + +=== "$Start$ binding" + Define a set of terminal values - $\bot = \{-n+1,...,0\}$ + + Let $R : \{1,...,n\} \longrightarrow \{1,...,n\} \cup \bot,$ is a corresponding _references_ + + Define + + $$Iterator : \big\{ S \big\} \longrightarrow \big\{ R \big\},$$ + + $$Iterator(S)(i) = max \big\{j \in \{-n+1,...,i\}\big|S_{cycled}(j) = S(i) \land j \ne i \big\} $$ + + $$Start = \in \{Binding\}$$ + + $$\exists Start^{-1} = \in \{Binding^{-1}\},$$ + + $$Iterator^{-1} : \big\{ R \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\}$$ + + $$Iterator^{-1}(R)(i) = \Bigg\{\begin{array}{l} \Big|\Big|, & \ R(i) \in \bot \\ Iterator^{-1}(R, R(i)), & R(i) \in \{1,...,n\} \end{array}$$ + + $$Iterator(S) = Iterator(Iterator^{-1}(Iterator(S)))$$ + + +=== "$End$ binding" + Define a set of terminal values - $\bot = \{n+1,...,2n\}$ + + Let $R : \{1,...,n\} \longrightarrow \{1,...,n\} \cup \bot,$ is a corresponding _references_ + + Define + + $$Iterator : \big\{ S \big\} \longrightarrow \big\{ R \big\},$$ + + $$Iterator(S)(i) = min \big\{j \in \{i,...,2n\}\big|S_{cycled}(j) = S(i) \land j \ne i \big\}$$ + + $$End = \in \{Binding\}$$ + + $$\exists End^{-1} = \in \{Binding^{-1}\},$$ + + $$Iterator^{-1} : \big\{ R \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\}$$ + + $$Iterator^{-1}(R)(i) = \Bigg\{\begin{array}{l} \Big|\Big|, & \ R(i) \in \bot \\ Iterator^{-1}(R, R(i)), & R(i) \in \{1,...,n\} \end{array}$$ + + $$Iterator(S) = Iterator(Iterator^{-1}(Iterator(S)))$$ + +--- + +### Define Intervals Chain + +=== "$Start$ binding" + + Define + + $$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\},$$ + + $$\exists \ Intervals : \big\{S\} \longrightarrow \big\{ IC \big\},$$ + + $$Intervals(S)(i) = | i - Iterator(S)(i)|,$$ + + $$\exists \ Follow : \big\{ IC \big\} \longrightarrow \big\{ R \big\},$$ + + $$Follow(IC)(i) = i - IC(i),$$ + + $$\exists Intervals^{-1} : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\},$$ + + $$Intervals^{-1}(IC)(i) = Iterator^{-1}(Follow(IC))(i),$$ + + $$Intervals(S) = Intervals(Intervals^{-1}(Intervals(S)))$$ + + $$\exists Trace : \big\{ IC \big\} \longrightarrow \big\{ R \big\}$$ + + $$Trace(IC)(i) = \Bigg\{\begin{array}{l} i, & \ i \in \bot \\ Trace\big(IC\big)\big(Follow(IC, i)\big) & i \in \{1,...,n\} \end{array}$$ + + + Where: + + - $n := |IC|$ is called _length_ of the _intervals chained_, $n \in N$ + - $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _intervals chained_ + + +=== "$End$ binding" + + Define + + $$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\},$$ + + $$\exists \ Intervals : \big\{S\} \longrightarrow \big\{ IC \big\},$$ + + $$Intervals(S)(i) = | i - Iterator(S)(i)|,$$ + + $$\exists \ Follow : \big\{ IC \big\} \longrightarrow \big\{ R \big\},$$ + + $$Follow(IC)(i) = i + IC(i),$$ + + $$\exists Intervals^{-1} : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\},$$ + + $$Intervals^{-1}(IC)(i) = Iterator^{-1}(Follow(IC))(i),$$ + + $$Intervals(S) = Intervals(Intervals^{-1}(Intervals(S)))$$ + + $$\exists Trace : \big\{ IC \big\} \longrightarrow \big\{ R \big\}$$ + + $$Trace(IC)(i) = \Bigg\{\begin{array}{l} i, & \ i \in \bot \\ Trace\big(IC\big)\big(Follow(IC, i)\big) & i \in \{1,...,n\} \end{array}$$ + + + Where: + + - $n := |IC|$ is called _length_ of the _intervals chained_, $n \in N$ + - $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _intervals chained_ + + +--- + +#### Special properties + +_Intervals chain_ $IC$ have been calculated with _Bounded binding_ have a special properties + +=== "$Start$ binding" + + $$IC(i) \le n | \forall i \in \{1,...,n\}$$ + + $$Follow(IC)(i) <> Follow(IC)(j) | \forall i != j$$ + + $$j < 1 \land j = Trace(IC)(n + j) | \forall i \in \{1,...,n\} \exists j = Trace(IC)(i)$$ + +=== "$End$ binding" + + $$IC(i) \le n | \forall i \in \{1,...,n\}$$ + + $$Follow(IC)(i) <> Follow(IC)(j) | \forall i != j$$ + + $$j > n+1 \land j = Trace(IC)(j - n) | \forall i \in \{1,...,n\} \exists j = Trace(IC)(i)$$ + + +--- + +Let $B = \{Start, End\} \subset \{Binding\}$ is set of _Cycled Binding_ diff --git a/docs/fundamentals/order/intervals_chain/index.md b/docs/fundamentals/order/intervals_chain/index.md new file mode 100644 index 00000000..32ec0ee4 --- /dev/null +++ b/docs/fundamentals/order/intervals_chain/index.md @@ -0,0 +1,483 @@ +# Intervals Chain + +An _intervals chain_ is an n-tuple of natural numbers that represents the distance between equal elements in a sequence, +if and only if there is an operation that takes as an input _current_ $(index, interval)$ and returns the next _index_. +The operation makes the intervals chained to each other, which is a required condition for the existence reverse function +that restores by _intervals chain_ a sequence with the same with the original sequence [order](../order.md). + +The idea of _intervals chain_ is easy to explain by a concrete example: + + +=== "From a sequence" + + ``` mermaid + block-beta + columns 8 + space p1["1"] space:3 p5["5"] p6["n"] space + space s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + ``` + + Let there be a sequence length of $n=6$ (indexed from 1 to n=6) + +=== "with a binding" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] space:3 p5["5"] p6["6"] + inf["⊥"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] + e0["0 = Iterator(1)"]:2 space:5 + space t1["1 = Iterator(5)"]:5 space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class inf,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Define _Binding_ as a pair of an _Iterator_ function, that seeks a corresponding referenced element, and + set of _terminate states_, to determine the interval when there is no matching element in the sequence. + + In the example, _Iterator_ seeks a position of a previous equivalent element as a matching reference. + If there is no such element, it returns $0$. That means _terminate states_ set is $\bot = {0}$. + This particular method is called - _Start binding_. + +=== "get correspoding indexes" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + inf["⊥"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] + space i1["0"] i2["0"] i3["0"] i4["2"] i5["1"] i6["0"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 c4 + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + With _Binding_ we can get a sequence of corresponding indexes. + For all first appearances of the elements it would be $0$, + and for `C` at position `4` corresponding index would be `2`, for `A` at position `5` - `1`. + +=== "and calculate intervals chain" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space i1["0"] i2["0"] i3["0"] i4["2"] i5["1"] i6["0"] + space s1["1"] s2["2"] s3["3"] s4["2"] s5["4"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 c4 + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Calculated interval by $Intervals$ function is the [absolute value](https://en.wikipedia.org/wiki/Absolute_value) + of difference the _corresponding index_ and the _index_. For example, for index `5` interval would be $|5-1|=4$ + + +--- + +There should exists an inverse function that restores by _interval chain_ a sequence with the original [order](../order.md) + +=== "From an interval chain" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["1"] s2["2"] s3["3"] s4["2"] s5["4"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Let there be an _interval chain_. + +=== "calculate correspoding indexes" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["1"] s2["2"] s3["3"] s4["2"] s5["4"] s6["6"] + space i1["0"] i2["0"] i3["0"] i4["2"] i5["1"] i6["0"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + The $Intervals^{-1}$ function for calculating _corresponding index_ based on the current _index_ and _interval_ is closly coupled + with direction in selected _Binding_. The function has to be defined for each particular _Binding_ method. + Whether it is possible to obtain direction of _Binding_ given an _interval chain_, and whether there are two equivalent _interval chains_ + obtained by different _Binding_ methods, are open questions that need to be investigated. + + In the example $Intervals^{-1}(IC)(i) = IC(i)-i$ + +=== "and use binding⁻¹" + + ``` mermaid + block-beta + columns 6 + p1["1"] space:3 p5["5"] p6["6"] + s1["0"] s2["0"] s3["0"] s4["2"] s5["1"] s6["0"] + e0["Iterator⁻¹(1) = 1"] space:5 + t1["Iterator⁻¹(5) = 1"]:5 space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class inf,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + For each _Binding_ should exists $Binding^{-1}$ with an $Iterator^{-1}$ that allows + to relabel elements of _interval chain_ with a unique number of the traversed path that it belongs to. + + $$Iterator^{-1}(P)(i) = \Bigg\{\begin{array}{l} \big|\big| & if \ P(i)=0 \\ Iterator^{-1}(P, P(i)) & otherwise \end{array}$$ + +=== "to reconstruct sequence" + + ``` mermaid + block-beta + columns 6 + p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + i1["0"] i2["0"] i3["0"] i4["2"] i5["1"] i6["0"] + s1["1"] s2["2"] s3["3"] s4["2"] s5["1"] s6["4"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 c4 + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + The reconstructed sequence is not equal to the original one, but it preserves the same [order](../order.md) of elements + and its _intervals chain_ would be equal to the _interval chain_ of the original sequence. + + ``` mermaid + block-beta + columns 6 + p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + s1["1"] s2["2"] s3["3"] s4["2"] s5["1"] s6["4"] + i1["A"] i2["C"] i3["T"] i4["C"] i5["A"] i6["G"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 c4 + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + +--- + +Formal order analysis identifies two groups of _Bindings_: + +- [Bounded](./bounded.md) - consider a sequence to be finite and bounded. Operates with the minimum data required to determine _intervals chains_ and _sequence_. +- [Cycled](./cycled.md) - treats a sequence as a subsequence representing an infinite sequence. Connects FOA with the fundamental ideas underlying statistics and probability theory. + +## Mathematical Definition + +Let $X$ is [_Carrier set_](../carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](../sequence.md#mathematical-definition) length of $n$ described as function $S : \{1,...,n\} \longrightarrow X$ + +### Define Bindings + +Define a set of terminal values - $\bot \subset N \setminus \{1,..,n\}$ + +Let $R : \{1,...,n\} \longrightarrow \{1,...,n\} \cup \bot,$ is a corresponding _references_ + +Define + +$$Iterator : \big\{ S \big\} \longrightarrow \big\{ R \big\},$$ + +$$Binding = $$ + +$$\exists Binding^{-1} = ,$$ + +$$Iterator^{-1} : \big\{ R \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\}$$ + +$$Iterator(S) = Iterator(Iterator^{-1}(Iterator(S)))$$ + +### Define Intervals Chain + +as n-tuple of natural numbers + +$$IC = <\Delta_1, \Delta_2, ..., \Delta_n> | \forall j \in \{1,...,n\} \exists \Delta_j \in \{1,...,n\},$$ + +if and only if + +$$\exists \ Intervals : \big\{Binding\big\} \times \big\{S\} \longrightarrow \big\{ IC \big\},$$ + +$$Intervals(, S)(i) = | i - iterator(S)(i)|,$$ + +$$\exists \ Intervals^{-1} : \big\{Binding^{-1}\big\} \times \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow \{1,...,m\} | m \leq n \big\},$$ + +$$Intervals(b, S) = Intervals(b, Intervals^{-1}(b^{-1}, Intervals(b, S)))$$ + +$$\exists \ Follow : \big\{Binding\big\} \times \big\{ IC \big\} \longrightarrow \big\{ R \big\},$$ + +$$Follow(b, IC)(i) <> Follow(b, IC)(j) \lor Follow(b, IC)(i) \in \bot | \forall i != j $$ + +$$\exists \ Trace : \big\{Binding\big\} \times \big\{ IC \big\} \longrightarrow \big\{ R \big\}$$ + +$$Trace(, IC)(i) = \Bigg\{\begin{array}{l} i, & \ i \in \bot \\ Trace\big(Follow(IC, i)\big) & i \in \{1,...,n\} \end{array}$$ + +$$Trace(IC)(i) \in \bot | \forall i \in \{1,...,n\}$$ + +Where: + +- $n := |IC|$ is called _length_ of the _intervals chained_, $n \in N$ +- $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _intervals chained_ diff --git a/docs/fundamentals/order/intervals_distribution/index.md b/docs/fundamentals/order/intervals_distribution/index.md new file mode 100644 index 00000000..105a978a --- /dev/null +++ b/docs/fundamentals/order/intervals_distribution/index.md @@ -0,0 +1,119 @@ +# Intervals Distribution + +An _intervals distribution_ is an n-tuple of natural numbers where the index represents the interval length and the value is a count of its appearances in the _interval chain_. + + +=== "From an interval chain" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["1"] s2["2"] s3["3"] s4["2"] s5["4"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Let there be an _interval chain_. + +=== "calculate intervals distribution" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["1"] s2["2"] s3["3"] s4["2"] s5["4"] s6["6"] + space:7 + space i1["1"] i2["2"] i3["1"] i4["1"] i5["0"] i6["1"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + s1 --> i1 + s2 --> i2 + s3 --> i3 + s4 --> i2 + s5 --> i4 + s6 --> i6 + + + ``` + +--- + +_Intervals distribution_ used as an input data in calculating [characteristics](../characteristics/index.md). +While characteristics could be calculated based on the _itervals chain_ _intervals distribution_ highlights that intervals themselves are enough to measure the [order](../order.md) of a sequence +and intervals connectivity in _intervals chain_ does not affect measure values. +Whether it is possible in general to reconstruct distinctly an _interval chain_ by the given _interval distribution_ is an open question. + + + +_Interval distribution_ is useful in comparing intervals produced from the same sequence with different [_Binding_](../intervals_chain/index.md#define-bindings). +In the interest of studying how _intervals_ depend on _Binding direction_ for [_Bounded Binding_](../intervals_chain/bounded.md) FOA introduce two operations on distributions: + +- [Lossy](./lossy.md) - takes two _intervals distribution_ and produce new one only with _intervals_ exists in both distributions. +- [Redundant](./redundant.md) - extends _intervals distribution_ `A` with _intervals_ that appears only in _intervals distrubution_ `B`. + +## Mathematical Definition + +Let $IC$ is [_Interval Chain_](../intervals_chain/index.md#define-intervals-chain) length of $n$ described as function $IC : \{1,...,n\} \longrightarrow \{1,...,n\}$ + +Define + +$$ID : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,n\} \longrightarrow N_0 \big\},$$ + +$$ID(IC)(i) = \Big| \big\{ j \in \{1,...,n\} | IC(j) = i \big\} \Big|$$ diff --git a/docs/fundamentals/order/intervals_distribution/lossy.md b/docs/fundamentals/order/intervals_distribution/lossy.md new file mode 100644 index 00000000..caa6c6f7 --- /dev/null +++ b/docs/fundamentals/order/intervals_distribution/lossy.md @@ -0,0 +1,64 @@ +# Lossy Intervals Distribution + +A _lossy intervals distribution_ is an aggregation of two _interval distributions_ having only intervals existing in both. + +_Lossy Interval Distribution_ is an intersection of two distributions. + +Mostly, this distribution is used to solve measure dependence on _Binding direction_ with [_Bounded binding_](../intervals_chain/bounded.md). +In that case, this would be equivalent to excluding the first/last intervals from the distribution. + +For example, there are 2 distributions for _Bounded Binding_ - one uses _Start binding direction_ and the other _End binding direction_. + +``` mermaid +block-beta + columns 8 + p0["0"] p1["1"] space:3 p5["5"] p6["6"] p7["7"] + inf["⊥"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] sup["⊥"] + space es0["Start(1) = 1"]:1 ts1["Start(5)=4"]:5 space + space te1["End(1) = 4"]:4 ee0["End(5) = 2"]:2 space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class inf,sup,te1,ee0,ts1,es0 c4a + class pomn,p00,p01,p06,p07,p02n position +``` + +_Lossy Interval Distribution_ will contain only interval `4` as it exists in both distributions. + + + + +## Mathematical Definition + +Let $ID$ is [_Intervals distribution_](../intervals_distribution/index.md#mathematical-definition) + +Define _Lossy Interval Distribution_ + +$$LID: \{ID\} \times \{ID\} \longrightarrow \{ID\}$$ + +$$LID(ID_1, ID_2)(i) = min \{ID_1(i), ID_2(i) \}$$ diff --git a/docs/fundamentals/order/intervals_distribution/redundant.md b/docs/fundamentals/order/intervals_distribution/redundant.md new file mode 100644 index 00000000..3f45a07c --- /dev/null +++ b/docs/fundamentals/order/intervals_distribution/redundant.md @@ -0,0 +1,62 @@ +# Redundant Intervals Distribution + +A _redundant intervals distribution_ is an aggregation of two _interval distributions_ having all intervals from the first one and intervals existing only the second. + +_Redundant Interval Distribution_ is a union of two distributions. + + +Mostly, this distribution is used to solve measure dependence on _Binding direction_ with [_Bounded binding_](../intervals_chain/bounded.md). +In that case, this would be equivalent to counting both intervals - first for _Start binding direction_ and _End binding direction_. + +For example, there are 2 distributions for _Bounded Binding_ - one uses _Start binding direction_ and the other _End binding direction_. + +``` mermaid +block-beta + columns 8 + p0["0"] p1["1"] space:3 p5["5"] p6["6"] p7["7"] + inf["⊥"] s1["A"] s2["C"] s3["T"] s4["C"] s5["A"] s6["G"] sup["⊥"] + space es0["Start(1) = 1"]:1 ts1["Start(5)=4"]:5 space + space te1["End(1) = 4"]:4 ee0["End(5) = 2"]:2 space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5 c4 + class inf,sup,te1,ee0,ts1,es0 c4a + class pomn,p00,p01,p06,p07,p02n position +``` + +_Redundant Interval Distribution_ will include all intervals `[1, 4, 2]`. + +## Mathematical Definition + +Let $ID$ is [_Intervals distribution_](../intervals_distribution/index.md#mathematical-definition) + +Define _Redundunt Interval Distribution_ + +$$RID: \{ID\} \times \{ID\} \longrightarrow \{ID\}$$ + +$$RID(ID_1, ID_2)(i) = max \{ID_1(i), ID_2(i) \}$$ diff --git a/docs/fundamentals/order/order.md b/docs/fundamentals/order/order.md new file mode 100644 index 00000000..dbd558a6 --- /dev/null +++ b/docs/fundamentals/order/order.md @@ -0,0 +1,150 @@ +# Order + +An _order_ is a n-tuple of natural numbers starting from `1` with `max+1` constraint. + +## Mathematical Definition + +The _order_ $O$ is defined as a n-tuple with additional constraints: + +$$O = ,$$ + +$$\forall i \in \{1, ..., n\} \exists o_i \in N $$ + +$$ o_1 = 1, $$ + +$$\forall i \in \{1, ..., n\}, o_i \leq max(o_1, ..., o_{i-1}) + 1$$ + +Where: + +- $n := |O|$ is called _length_ of the order, $n \in N$ +- $o_i$​ is called the $i$-th _element_ (or coordinate) of the order + +### Order of Sequence + +Let $X$ is [_Carrier set_](./carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](./sequence.md#mathematical-definition) described as function $S : \{1,...,n\} \longrightarrow X$ + +Let $alphabet$ is [_Alphabet function_](./alphabet.md#alphabet-of-sequence) + +$$alphabet : \big\{\{1,...,n\} \longrightarrow X \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +Define + +$$ordert(S) : \big\{\{1,...,n\} \longrightarrow X \big\} \longrightarrow \big\{\{1,...,n\} \longrightarrow \{1,...,n\} \big\}$$ + +$$A = alphabet(S)$$ + +$$order(S)(i) = j \big| j \in \{1,...,n\}, S(i)=A(j)$$ + +### Order product Alphabet + +Let $X$ is a [_Carrier set_](./carrier_set.md) + +Let $A$ is a [_Aphabet_](./alphabet.md) $A : \{1, ..., m\} \longrightarrow X,$ + +Let $S$ is a [_Sequenece_](./sequence.md) $S : \{1, ..., n\} \longrightarrow X,$ + +the following equations are true + +$$O = order(S),$$ + +$$A = alphabet(S),$$ + +$$S = ( O \odot A),$$ + +$$S(i) = A(O(i))$$ + + + + +## Examples + +### Valid order + +``` mermaid +block-beta + columns 36 + i1["1"] i2["2"] i3["3"] i4["2"] i5["4"] i6["2"] + i7["5"] i8["2"] i9["6"] i10["2"] i11["7"] i12["2"] + i13["1"] i14["2"] i15["8"] i16["2"] i17["9"] + + classDef red fill:#d62728,color:#000; + +``` + +### Invalid order - Start different from `1` + + +``` mermaid +block-beta + columns 36 + i1["2"] i2["2"] i3["3"] i4["2"] i5["4"] i6["2"] + i7["5"] i8["2"] i9["6"] i10["2"] i11["7"] i12["2"] + i13["1"] i14["2"] i15["8"] i16["2"] i17["9"] + + classDef red fill:#d62728,color:#000; + + class i1 red +``` + +### Invalid order - Contains elements not in `N` + +``` mermaid +block-beta + columns 36 + i1["1"] i2["2"] i3["3"] i4["2"] i5["4"] i6["2"] + i7["5"] i8["2"] i9["6"] i10["T"] i11["7"] i12["2"] + i13["1"] i14["-2"] i15["8"] i16["2"] i17["9"] + + classDef red fill:#d62728,color:#000; + + class i10,i14 red +``` + +### Invalid order - Violates `max + 1` contstraint + +``` mermaid +block-beta + columns 36 + i1["1"] i2["2"] i3["3"] i4["2"] i5["4"] i6["2"] + i7["5"] i8["2"] i9["6"] i10["2"] i11["7"] i12["2"] + i13["1"] i14["9"] i15["8"] i16["2"] i17["9"] + + classDef red fill:#d62728,color:#000; + + class i14 red +``` + +### Binary Sequence +A binary sequence `0110100110` + +represented as + +$O = <1, 2, 2, 1, 2, 1, 1, 2, 2, 1>$ + +### Musical Chorus Sequence +A musical chorus for `Jingle bell rock` + +``` +D Dmaj7 D6 +Jingle-bell, Jingle-bell, Jingle-bell Rock. + D D#dim +Jingle-bell swing and + Em A7 Em A7 Em A7 +Jingle-bell ring. Snowin' and blowin' up bushels of fun. +Em A9 A7 +Now the jingle-hop has begun. +``` + +$O = <1, 2, 3, 1, 4, 5, 6, 5, 6, 7, 5, 8, 6>$ + +### DNA Sequence +A DNA sequence `ATGCTAGCATGCTAGCATGCTAGC` + +$O = <1, 2, 3, 4, 2, 1, 3, 4, 1, 2, 3, 4, 2, 1, 3, 4, 1, 2, 3, 4, 2, 1, 3, 4>$ + +### English Text Sequence as word sequence +An English text sentence `the quick brown fox jumps over the lazy dog` + +$O = <1, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 1, 2, 8, 2, 9>$ diff --git a/docs/fundamentals/objects/sequence.md b/docs/fundamentals/order/sequence.md similarity index 71% rename from docs/fundamentals/objects/sequence.md rename to docs/fundamentals/order/sequence.md index 9724cc74..7203ee78 100644 --- a/docs/fundamentals/objects/sequence.md +++ b/docs/fundamentals/order/sequence.md @@ -1,20 +1,28 @@ # Sequence A sequence is a fundamental concept in formal order analysis that is defined as a finite, enumerated collection of objects in which repetitions are allowed and order matters. -It is the basic object for analyzing patterns, relationships, and structural properties in ordered data. +This is the basic object for analyzing patterns, relationships, and structural properties in ordered data. ## Mathematical Definition -A sequence $S$ is as tuple: +Let $X$ is [_Carrier set_](./carrier_set.md#mathematical-definition) -$$S = $$ +A _sequence_ $S$ is a n-tuple defined as + +$$S = ,$$ + +$$\forall i \in \{1, ..., n\} \exists s_i \in X$$ where: -- $n$ is the length of the sequence -- $s_i \in X$ for all $i \in \{1,2,...,n\}$ -- $X$ is an unordered set -- $=$ is the equivalence relation defined on $X$ +- $s_i$​ is called the $i$-th _element_ (or coordinate) of the sequence. +- $n := |S|$ is _length_, $n \in N$ + +The _sequence_ $S$ can be also defined as a function + +$$S : \{1, ..., n\} \longrightarrow X,$$ + +$$S(i)=s_i | i \in \{1, ..., n\}$$ ## Examples @@ -41,23 +49,27 @@ Em A9 A7 Now the jingle-hop has begun. ``` -$X = \{D, D6, D\#dim, A7, A9, Dmaj7, Em\}$ +$X = \{A7, A9, D, D6, Dmaj7, D\#dim, Em\}$ + $S = $ ### DNA Sequence A DNA sequence `ATGCTAGCATGCTAGCATGCTAGC` $X = \{A,C,T,G\}$ + $S = $ ### English Text Sequence as char sequence An English text sentence `the quick brown fox jumps over the lazy dog` $X = \{\ ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\}$ + $S = $ ### English Text Sequence as word sequence An English text sentence `the quick brown fox jumps over the lazy dog` $X = \{\ ,quick, fox, brown, the, over, dog, fox, lazy\}$ + $S = $ diff --git a/docs/fundamentals/partials_and_congenerics/alphabet/congeneric.md b/docs/fundamentals/partials_and_congenerics/alphabet/congeneric.md new file mode 100644 index 00000000..2b87cbd6 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/alphabet/congeneric.md @@ -0,0 +1,17 @@ +# Alphabet of Congeneric Sequence + +[_Congenric sequence_](../sequence/congeneric.md#mathematical-definition) is defined on _Partial carrier set_ having only one _non-empty_ element. +That means that _Alphabet of Congeneric sequence_ is a tuple of one element. The alphabet power is 1. + +## Mathematical Definition + + +Let $S_{c|e}$ is [_Congeneric Sequence of e element_](../sequence/congeneric.md#mathematical-definition) + +Let $alphabet_p$ is [_Alphabet of Partial sequence_](../alphabet/index.md#mathematical-definition) + +Then [_Alphabet_](../../order/alphabet.md#mathematical-definition) + +$$A=alphabet_p(S_{c|e}) = ,$$ + +$$|A| = 1$$ diff --git a/docs/fundamentals/partials_and_congenerics/alphabet/index.md b/docs/fundamentals/partials_and_congenerics/alphabet/index.md new file mode 100644 index 00000000..3d03add1 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/alphabet/index.md @@ -0,0 +1,22 @@ +# Alphabet of Partial Sequence + +_Alphabet_ of [_Partial sequence_](../sequence/index.md#mathematical-definition) is just an [_Alphabet_](../../order/alphabet.md#mathematical-definition). +The `-` _empty element_ is not counted as a unique element and is not included in the alphabet. + +## Mathematical Definition + +Let $X$ is [_Carrier Set_](../../order/carrier_set.md#mathematical-definition) + +Let $X_{-}$ is [_Partial Carrier Set_](../carrier_set.md#mathematical-definition) + +$$X \subset X_{-}$$ + +Let $-$ is [_Empty element_](../carrier_set.md#mathematical-definition) of _Partial Carrier Set_ + +Let $S_p$ is [_Partial Sequence_](../sequence/index.md#mathematical-definition) described as function $S : \{1,...,l\} \longrightarrow X_{-}$ + +Define _Alphabet of partial sequence_ function + +$$alphabet_p : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +$$alphabet_p(S_p) = \big$$ diff --git a/docs/fundamentals/partials_and_congenerics/carrier_set.md b/docs/fundamentals/partials_and_congenerics/carrier_set.md new file mode 100644 index 00000000..7c6856ee --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/carrier_set.md @@ -0,0 +1,13 @@ +# Partial carrier set + +A _Partial carrier set_ $X_{-}$ is a [_carrier set_](../order/carrier_set.md) extended with special `-` empty element. + +## Mathematical Definition + +Let $X$ is [_Carrier set_](../order/carrier_set.md#mathematical-definition) + +Let $- \notin X$ + +Define _Partial carrier set_ + +$$X_{-} = X \cup \{-\}$$ diff --git a/docs/fundamentals/partials_and_congenerics/characteristics.md b/docs/fundamentals/partials_and_congenerics/characteristics.md new file mode 100644 index 00000000..6189d4d7 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/characteristics.md @@ -0,0 +1,10 @@ +--- +hide: + - toc +--- +# Characteristics for Partials + +All [interval-based characteristics](../order/characteristics/index.md) are valid of _partials_ and _congenerics_. +The measures could be calculated based on [_Partial Intervals Chain_](./intervals_chain/index.md) or [_Partial Intervals Distribution_](./intervals_distribution.md) using the +relevant formulas for the characteristic. In case of using _Partial Intervals Chain_ pay attention that for partial $n$ is the number of _non-empty_ elements and differs from +tuple length $l$, while for _full_ sequences and their derivatives $n$ and $l$ are the same. diff --git a/docs/fundamentals/partials_and_congenerics/index.md b/docs/fundamentals/partials_and_congenerics/index.md new file mode 100644 index 00000000..5d983516 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/index.md @@ -0,0 +1,105 @@ +# Partials and congenerics + +_Partial sequence_ is a sequence with skips (empty positions, spaces). FOA uses the special symbol `-` as _empty_ element. +_Partial sequence_ where all _non-empty_ elements are equals _Congeneric sequence_. + +=== "Sequence" + + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["I"] s15["S"] s16[" "] s17["T"] s18["H"] s19["E"] s20[" "] + s21["A"] s22["B"] s23["I"] s24["L"] s25["I"] s26["T"] s27["Y"] s28[" "] s29["T"] s30["O"] + s31[" "] s32["A"] s33["D"] s34["A"] s35["P"] s36["T"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + + ``` + +=== "Partial" + + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["-"] s15["-"] s16[" "] s17["T"] s18["-"] s19["-"] s20[" "] + s21["-"] s22["B"] s23["-"] s24["L"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] s30["-"] + s31["-"] s32["-"] s33["D"] s34["-"] s35["P"] s36["T"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + + class s14,s15,s18,s19,s21,s23,s25,s27,s28,s30,s31,s32,s34 skip + ``` + +=== "Congeneric" + + ``` mermaid + block-beta + columns 36 + s1["-"] s2["-"] s3["T"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] + s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["T"] s18["-"] s19["-"] s20["-"] + s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] s30["-"] + s31["-"] s32["-"] s33["-"] s34["-"] s35["-"] s36["T"] + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + + class s1,s2,s4,s5,s6,s7,s8,s9,s10 skip + class s11,s12,s13,s14,s15,s16,s18,s19,s20 skip + class s21,s22,s23,s24,s25,s27,s28,s30 skip + class s31,s32,s33,s34,s35 skip + ``` + +Every operation and statement described in [_Order and its measures_](../order/index.md) that can be applied to _Sequence_ are also valid for Partial sequence, keeping in mind that only non-empty elements are involved. +Read the following documentation to clarify the differences that appear for Partial [_Sequence_](./sequence/index.md), [_Order_](./order/index.md), and [_Intervals Chain_](./intervals_chain/index.md). diff --git a/docs/fundamentals/partials_and_congenerics/intervals_chain/congeneric.md b/docs/fundamentals/partials_and_congenerics/intervals_chain/congeneric.md new file mode 100644 index 00000000..20dd17eb --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/intervals_chain/congeneric.md @@ -0,0 +1,63 @@ +# Congeneric Intervals Chain + +A _Congeneric intervals chain_ is an [_Partial Interval Chain_](./index.md) where all _non-empty_ elements are part of the one trace path (trace to the same [terminal value](../../order/intervals_chain/index.md)). + +``` mermaid +block-beta +columns 29 + +i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +s1["-"] s2["-"] s3["3"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["14"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["9"] s27["-"] s28["-"] s29["3"] + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s1,s2,s4,s5,s6,s7,s8,s9,s10 skip +class s11,s12,s13,s14,s15,s16,s18,s19,s20 skip +class s21,s22,s23,s24,s25,s27,s28,s30 skip +class s31,s32,s33,s34,s35 skip + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index +``` + +## Mathematical Definition + +Let $-$ is [_empty value_](../carrier_set.md#mathematical-definition) + +Let $IC_p$ is [_Partial interval chain_](index.md#define-partial-intervals-chain) $IC_p : \{1, ..., l\} \longrightarrow \{1,...,l\} \cup \{-\},$ + +Let $Trace_p$ is [_trace function of partial interval chain_](index.md#define-partial-intervals-chain) + +$$Trace_p : \big\{Binding_p\big\} \times \big\{ IC_p \big\} \longrightarrow \big\{ R_p \big\},$$ + +$IC_p$ is called $IC_c$ _Congeneric interval chain_ if + +$$trace = Trace_p(b_p, IC_P)$$ + +$$trace(i) = trace(j) \bigg| \forall i \ne j, IC_{p}(i) \notin \{-\} \land IC_{p}(j) \notin \{-\}$$ diff --git a/docs/fundamentals/partials_and_congenerics/intervals_chain/index.md b/docs/fundamentals/partials_and_congenerics/intervals_chain/index.md new file mode 100644 index 00000000..e8e1615e --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/intervals_chain/index.md @@ -0,0 +1,579 @@ +# Partial Intervals Chain + +_Partial Intervals Chain_ is an [_Intervals chain_](../../order/intervals_chain/index.md#mathematical-definition) that could contains `-` [_empty_](../carrier_set.md#mathematical-definition) elements. All statements valid for an _intervals chain elements_ should be valid for _non-empty_ elements of _partial intervals chain_ + +The idea of _partial intervals chain_ is easy to explain by a concrete example: + + +=== "From a partial sequence" + + ``` mermaid + block-beta + columns 8 + space p1["1"] space:3 p5["5"] p6["l"] space + space s1["-"] s2["C"] s3["T"] s4["C"] s5["-"] s6["G"] space + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p5,p6,p7 position + + classDef skip fill:#ffffff + + class s1,s5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + ``` + + Let there be a partial sequence length of $l=6$ (indexed from 1 to l=6) + +=== "with a binding" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] space p4["4"] p5["5"] p6["6"] + inf["⊥"] s1["-"] s2["C"] s3["T"] s4["C"] s5["-"] s6["G"] + e0["0 = Iteratorₚ(2)"]:3 space:4 + space:2 t1["2 = Iteratorₚ(4)"]:3 space:2 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s2,s4 c4 + class inf,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Define $Binding_p$ as a pair of an $Iterator_p$ function, that seeks a corresponding referenced element, and + set of _terminate states_, to determine the interval when there is no matching element in the sequence. + For `-` _empty_ elements, we do not search for matching elements - just put `-` instead of matching value. + +=== "get correspoding indexes" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + inf["⊥"] s1["-"] s2["C"] s3["T"] s4["C"] s5["-"] s6["G"] + space i1["-"] i2["0"] i3["0"] i4["2"] i5["-"] i6["0"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 skip + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + With $Binding_p$ we can get a sequence of corresponding indexes. + For all first appearances of the elements it would be $0$, + and for `C` at position `4` corresponding index would be `2`. + +=== "and calculate partial intervals chain" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space i1["-"] i2["0"] i3["0"] i4["2"] i5["-"] i6["0"] + space s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 skip + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Calculated interval by $Intervals_p$ function is the [absolute value](https://en.wikipedia.org/wiki/Absolute_value) + of difference the _corresponding index_ and the _index_. For example, for index `4` interval would be $|4-2|=2$ + + +--- + +There should exists an inverse function that restores by _interval chain_ a sequence with the original [order](../order/index.md) + +=== "From a partial interval chain" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Let there be a _partial interval chain_. + +=== "calculate correspoding indexes" + + ``` mermaid + block-beta + columns 7 + p0["0"] p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["6"] + space i1["-"] i2["0"] i3["0"] i4["2"] i5["-"] i6["0"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5,i1,i5 skip + + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + The $Intervals_p^{-1}$ function for calculating _corresponding index_ based on the current _index_ and _interval_ is closly coupled + with direction in selected _Binding_. For `-` _empty_ element it just put `-` instead of calculating the index + +=== "and use binding⁻¹" + + ``` mermaid + block-beta + columns 6 + p1["1"] p2["2"] space p4["4"] p5["5"] p6["6"] + s1["-"] s2["0"] s3["0"] s4["2"] s5["-"] s6["0"] + e0["Iteratorₚ⁻¹(2) = 2"]:2 space:4 + space t1["Iteratorₚ⁻¹(4) = 2"]:3 space:2 + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5,i1,i5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s2,s4 c4 + class inf,t1,e0 c4a + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + For each $Binding_p$ should exists $Binding_p^{-1}$ with an $Iterator_p^{-1}$ that allows + to relabel elements of _interval chain_ with a unique number of the traversed path that it belongs to. + +=== "to partial sequence" + + ``` mermaid + block-beta + columns 6 + p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + i1["-"] i2["0"] i3["0"] i4["2"] i5["-"] i6["0"] + s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["4"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + class s1,s5,i1,i5 skip + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + The reconstructed partial sequence is not equal to the original one, but it preserves the same [partial order](../order/index.md) of elements + and its _partial intervals chain_ would be equal to the _partial interval chain_ of the original sequence. + + ``` mermaid + block-beta + columns 6 + p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["4"] + i1["-"] i2["C"] i3["T"] i4["C"] i5["-"] i6["G"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef skip fill:#ffffff + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class s1,s5,i1,i5 skip + class s2,s4,i2,i4 c1 + class s3,i3 c5 + class s6,i6 c7 + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + +--- + +$Bindings_p$, $Intervals_p$ and its inverse functions could be produced from functions defined for regular [_Bindings_, _Intervals chains_](../../order/intervals_chain/index.md#mathematical-definition) by adding condition that returns `-` for input `-` elements. + +## Mathematical Definition + +Let $X$ is [_Carrier set_](../../order/carrier_set.md#mathematical-definition) + +Let $X_{-}$ is [_Partial Carrier set_](../carrier_set.md#mathematical-definition) + +Let $-$ is [_Empty element_](../carrier_set.md#mathematical-definition) + +Let $S$ is [_Sequence_](../../order/sequence.md#mathematical-definition) length of $l$ described as function $S : \{1,...,l\} \longrightarrow X$ + +Let $S_p$ is [_Partial Sequence_](../sequence/index.md#mathematical-definition) length of $l$ described as function $S_p : \{1,...,l\} \longrightarrow X_{-}$ + +Let $IC = <\Delta_1, \Delta_2, ..., \Delta_l> | \forall j \in \{1,...,l\} \exists \Delta_j \in \{1,...,l\}$ is [_Interval chain_](../../order/intervals_chain/index.md#define-intervals-chain) + +Let $Binding = $ is [_Binding_](../../order/intervals_chain/index.md#define-bindings) + +Let $R : \{1,...,l\} \longrightarrow \{1,...,l\} \cup \bot,$ is a corresponding [_references_](../../order/intervals_chain/index.md#define-bindings) + +Let $Intervals$ is [_Intervals function_](../../order/intervals_chain/index.md#define-intervals-chain) described as function + +$$Intervals : \big\{Binding\big\} \times \big\{S\} \longrightarrow \big\{ IC \big\}$$ + +Then _Iterator_ defined as $Iterator \big\{ S \big\} \longrightarrow \big\{ R \big\},$ + +### Define Partial Bindings + +Let $R_p : \{1,...,l\} \longrightarrow \{1,...,l\} \cup \bot \cup \{-\},$ is a corresponding _partial references_ + +Then + +$$X \subset X_{-},$$ + +$$\{S\} \subset \{S_p\},$$ + +$$\{R\} \subset \{R_p\},$$ + +Define + +$$Iterator_p : \big\{ S_p \big\} \longrightarrow \big\{ R_p \big\},$$ + +$$\{Iterator_p\} \supset \{Iterator\},$$ + +$$Iterator_p(S_p)(i) = \Bigg \{ \begin{array}{l} Intertor(S_p)(i) , & S_p(i) \notin \{-\} \\ -, & S_p(i) \in \{-\} \end{array},$$ + +and + +$$Binding_p = ,$$ + +$$\{Binding_p\} \supset \{Binding\}$$ + +the same way + +$$\exists Binding_p^{-1} = ,$$ + +$$\{Binding_p^{-1}\} \supset \{Binding^{-1}\},$$ + +where + +$$Iterator_p^{-1} : \big\{ R_p \big\} \longrightarrow \big\{ \{1,...,l\} \longrightarrow \{1,...,m\} \cup \{-\} | m \leq l \big\},$$ + +$$\{Iterator_p^{-1}\} \supset \{Iterator^{-1}\},$$ + +$$Iterator_p^{-1}(R_p)(i) = \Bigg \{ \begin{array}{l} Intertor^{-1}(R_p)(i) , & R_p(i) \notin \{-\} \\ -, & R_p(i) \in \{-\} \end{array}$$ + +The condition $Iterator_p(S_p) = Iterator_p(Iterator_p^{-1}(Iterator_p(S_p)))$ is valid. + +### Define Partial Intervals Chain + +as l-tuple of natural numbers and `-` empty elements + +$$IC_p = <\Delta_1, \Delta_2, ..., \Delta_l> | \forall j \in \{1,...,l\} \exists \Delta_j \in \{1,...,l\} \cup \{-\},$$ + +Then + +$$\{IC_p\} \supset \{IC\},$$ + +$$\exists \ Intervals_p : \big\{Binding_p\big\} \times \big\{S_p\} \longrightarrow \big\{ IC_p \big\},$$ + +$$\{Intervals_p\} \supset \{Intervals\},$$ + +$$Intervals_p(b_p, S_p)(i) = \Bigg \{ \begin{array}{l} Intervals(b_p, S_p)(i) , & S_p(i) \notin \{-\} \\ -, & S_p(i) \in \{-\} \end{array},$$ + +$$\exists \ Intervals_p^{-1} : \big\{Binding_p^{-1}\big\} \times \big\{ IC_p \big\} \longrightarrow \big\{ \{1,...,l\} \longrightarrow \{1,...,m\} \cup \{-\} | m \leq l \big\},$$ + +$$\{Intervals_p^{-1}\} \supset \{Intervals^{-1}\},$$ + +$$Intervals_p^{-1}(b_p^{-1}, IC_p)(i) = \Bigg \{ \begin{array}{l} Intervals^{-1}(b_p^{-1}, IC_p)(i) , & IC_p(i) \notin \{-\} \\ -, & IC_p(i) \in \{-\} \end{array},$$ + +The condition would be true + +$$Intervals_p(b_p, S_p) = Intervals_p(b_p, Intervals_p^{-1}(b_p^{-1}, Intervals_p(b_p, S_p)))$$ + +Let $Follow$ is the [_follow function of interval chain_](../../order/intervals_chain/index.md#define-intervals-chain) described as function $Follow : \big\{Binding\big\} \times \big\{ IC \big\} \longrightarrow \big\{ R \big\},$ + +$$\exists \ Follow_p : \big\{Binding_p\big\} \times \big\{ IC_p \big\} \longrightarrow \big\{ R_p \big\},$$ + +$$\{Binding\} \subset \{Binding_p\},$$ + +$$\{IC\} \subset \{IC_p\},$$ + +$$\{R\} \subset \{R_p\},$$ + +then + +$$\{Follow_p\} \supset \{Follow\}.$$ + +$$Follow_p(b_p, IC_p)(i) = \Bigg \{ \begin{array}{l} Follow(b_p, IC_p)(i) , & IC_p(i) \notin \{-\} \\ -, & IC_p(i) \in \{-\} \end{array},$$ + +The condition would be true + +$$f = Follow_p(b_p, IC_p),$$ + +$$f(i) <> f(j) \lor f(i) \in \bot | \forall i != j \land IC_p(i) \notin \{-\}.$$ + +Let $Trace$ is the [_trace function of interval chain_](../../order/intervals_chain/index.md#define-intervals-chain) described as function $Trace : \big\{Binding\big\} \times \big\{ IC \big\} \longrightarrow \big\{ R \big\},$ + +$$\exists \ Trace_p : \big\{Binding_p\big\} \times \big\{ IC_p \big\} \longrightarrow \big\{ R_p \big\},$$ + +$$\{Binding\} \subset \{Binding_p\},$$ + +$$\{IC\} \subset \{IC_p\},$$ + +$$\{R\} \subset \{R_p\},$$ + +then + +$$\{Trace_p\} \supset \{Trace\}.$$ + +$$Trace_p(b_p, IC_p)(i) = \Bigg \{ \begin{array}{l} Trace_p(b_p, IC_p)(i) , & IC_p(i) \notin \{-\} \\ -, & IC_p(i) \in \{-\} \end{array}.$$ + +The condition would be true + +$$Trace_p(IC_p)(i) \in \bot | \forall i \in \{1,...,n\} \land IC_p(i) \notin \{-\}$$ + +Where: + +- $l := |IC_p|$ is called _length_ of the _partial intervals chained_, $l \in N$ +- $n := |\{ IC_p(i) | IC_p(i) \ne - \}|$ is _non-empty elements count_, $n \in N$ +- $\Delta_i$​ is called the $i$-th _element_ (or interval) of the _partial intervals chained_ diff --git a/docs/fundamentals/partials_and_congenerics/intervals_distribution.md b/docs/fundamentals/partials_and_congenerics/intervals_distribution.md new file mode 100644 index 00000000..94031a29 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/intervals_distribution.md @@ -0,0 +1,110 @@ +# Partial Intervals Distribution + +A _Partial intervals distribution_ is an [_Interval distribution_](../order/intervals_distribution/index.md) produced from [_Partial intervals chain_](./intervals_chain/index.md) by counting all _non-empty_ elements (intervals) in distribution + + +=== "From a partial interval chain" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["6"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + ``` + + Let there be a _partial interval chain_. + +=== "calculate intervals distribution" + + ``` mermaid + block-beta + columns 7 + space p1["1"] p2["2"] p3["3"] p4["4"] p5["5"] p6["6"] + space s1["-"] s2["2"] s3["3"] s4["2"] s5["-"] s6["6"] + space:7 + space i1["0"] i2["2"] i3["1"] i4["0"] i5["0"] i6["1"] + + classDef imaginary fill:#526cfe09,color:#000,stroke-dasharray: 10 5; + classDef position fill:#fff,color:#000,stroke-width:0px; + class inf,sup imaginary + class p0,p1,p2,p3,p4,p5,p6,p7 position + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c2a fill:#ffbb788a,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c4a fill:#98df8a8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c6a fill:#ff98968a,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c14a fill:#dbdb8d8a,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + class pomn,p00,p01,p06,p07,p02n position + class t1,t2,t5,e0,e1 position + + s2 --> i2 + s3 --> i3 + s4 --> i2 + s6 --> i6 + + + ``` + +--- + +_Partial Intervals distribution_, as any _Intervals distribution_, used as an input data in calculating [characteristics](../order/characteristics/index.md). + +## Mathematical Definition + +Let $-$ is [_empty element_](./carrier_set.md#mathematical-definition). + +Let $IC_p$ is [_Partial Interval Chain_](./intervals_chain/index.md#define-intervals-chain) length of $l$ described as function $IC_p : \{1,...,l\} \longrightarrow \{1,...,l\} \cup \{-\}$ + +Let $ID$ is [_Interval Distribution_](../order/intervals_distribution/index.md) length of $l$ described as function $ID : \big\{ IC \big\} \longrightarrow \big\{ \{1,...,l\} \longrightarrow N_0 \big\},$ + +Define + +$$ID_p : \big\{ IC_p \big\} \longrightarrow \big\{ \{1,...,l\} \longrightarrow N_0 \big\},$$ + +$$ID_p(IC_p)(i) = ID(IC_p)(i) \bigg| IC_p(i) \notin \{-\}$$ diff --git a/docs/fundamentals/partials_and_congenerics/order/congeneric.md b/docs/fundamentals/partials_and_congenerics/order/congeneric.md new file mode 100644 index 00000000..cd808b87 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/order/congeneric.md @@ -0,0 +1,60 @@ +# Congeneric Order + +A _Congeneric order_ is an [_Partial Order_](./index.md) where all _non-empty_ elements equals $1$. + + +``` mermaid +block-beta +columns 29 + +i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +s1["-"] s2["-"] s3["1"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["1"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["1"] s27["-"] s28["-"] s29["1"] + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s1,s2,s4,s5,s6,s7,s8,s9,s10 skip +class s11,s12,s13,s14,s15,s16,s18,s19,s20 skip +class s21,s22,s23,s24,s25,s27,s28,s30 skip +class s31,s32,s33,s34,s35 skip + + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index +``` + +## Mathematical Definition + +Let $- \notin N$ + +Let $N_{-} = N \cup \{-\}$ + +Let $O_p$ is [_Partial order](index.md#mathematical-definition) $O_p : \{1, ..., n\} \longrightarrow N_{-},$ + +$O_p$ is called $O_c$ _Congeneric order_ if + +$$\forall i O_{p}(i) \in \{-, 1\}$$ diff --git a/docs/fundamentals/partials_and_congenerics/order/index.md b/docs/fundamentals/partials_and_congenerics/order/index.md new file mode 100644 index 00000000..fa591d58 --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/order/index.md @@ -0,0 +1,111 @@ +# Partial Order + +A _Partial order_ is an [_Order_](../../order/order.md) having _empty_ elements. + + +``` mermaid +block-beta +columns 29 + +i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +s1["1"] s2["2"] s3["3"] s4["4"] s5["5"] s6["5"] s7["1"] s8["6"] s9["4"] s10["2"] +s11["7"] s12["4"] s13["8"] s14["-"] s15["-"] s16["8"] s17["3"] s18["-"] s19["-"] s20["8"] +s21["-"] s22["9"] s23["-"] s24["5"] s25["-"] s26["3"] s27["-"] s28["-"] s29["3"] + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s14,s15,s18,s19,s21,s23,s25,s27,s28 skip + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index +``` + +## Mathematical Definition + +Let $-$ is [_Empty element_](../carrier_set.md#mathematical-definition) + +Let $- \notin N$ + +Define $N_{-} = N \cup \{-\}$ + +The _Partial order_ $O_p$ is defined as an l-tuple with additional constraints: + +$$O_p = ,$$ + +$$\forall i \in \{1, ..., l\} \exists o_i \in N_{-} $$ + +$$ \exists j \in \{1, ..., l\}, \forall i < j | O_p(i) \in \{ -\} \land O_p(j) = 1 $$ + +$$\forall i \in \{1, ..., l\}, O_p(i) \in \{-\} \lor O_p(i) \leq max(o_1, ..., o_{i-1}) + 1 \big| max(\{-\})=0$$ + +Where: + +- $o_i$​ is called the $i$-th _element_ (or coordinate) of the partial order +- $l := |O_p|$ is called _length_ of the partial order, $l \in N$ +- $n := |\{ O_p(i) | O_p(i) \ne - \}|$ is _non-empty elements count_, $n \in N$ + +### Order of Partial Sequence + +Let $X$ is [_Carrier Set_](../../order/carrier_set.md#mathematical-definition) + +Let $X_{-}$ is [_Partial Carrier Set_](../carrier_set.md#mathematical-definition) + +$$X \subset X_{-}$$ + +Let $-$ is [_Empty element_](../carrier_set.md#mathematical-definition) of _Partial Carrier Set_ + +Let $S_p$ is [_Partial Sequence_](../sequence/index.md#mathematical-definition) described as function $S_p : \{1,...,l\} \longrightarrow X_{-}$ + +Let $alphabet_p$ is [_Alphabet of Partial Sequence function_](../alphabet/index.md#mathematical-definition) + +$$alphabet_p : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,m\} \longrightarrow X \big\}$$ + +Define + +$$order_p(S_p) : \big\{\{1,...,l\} \longrightarrow X_{-} \big\} \longrightarrow \big\{\{1,...,l\} \longrightarrow \{1,...,l\} \big\},$$ + +$$A = alphabet_p(S_p),$$ + +$$order_p(S_p)(i) = \Bigg\{\begin{array}{l} j \ \big| j \in \{1,...,l\}, S_p(i)=A(j), & S_p(i) \notin \{-\} \\ -, & S_p(i) \in \{-\} \end{array}$$ + + +### Order product Alphabet + +Let $X$ is a [_Carrier set_](../../order/carrier_set.md) + +Let $A$ is a [_Aphabet_](../../order/alphabet.md) $A : \{1, ..., m\} \longrightarrow X,$ + +Let $S_p$ is a [_Partial sequenece_](../sequence/index.md) $S : \{1, ..., l\} \longrightarrow X_{-},$ + +the following equations are true + +$$O_p = order_p(S_p),$$ + +$$A = alphabet_p(S_p),$$ + +$$S_p = ( O_p \odot A),$$ + +$$S_p(i) = \Bigg\{\begin{array}{l} A(O_p(i)) , & O_p(i) \notin \{-\} \\ -, & O_p(i) \in \{-\} \end{array}$$ diff --git a/docs/fundamentals/partials_and_congenerics/sequence/congeneric.md b/docs/fundamentals/partials_and_congenerics/sequence/congeneric.md new file mode 100644 index 00000000..5b15982f --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/sequence/congeneric.md @@ -0,0 +1,60 @@ +# Congeneric Sequence + +_Congeneric sequence_ is an extreme case of [_Parial sequence_](./index.md) where all _non-empty_ elements are equals. + + $S_{c|T}$ is _Congeneric sequence_ for `T` + +``` mermaid +block-beta +columns 29 + +i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +s1["-"] s2["-"] s3["T"] s4["-"] s5["-"] s6["-"] s7["-"] s8["-"] s9["-"] s10["-"] +s11["-"] s12["-"] s13["-"] s14["-"] s15["-"] s16["-"] s17["T"] s18["-"] s19["-"] s20["-"] +s21["-"] s22["-"] s23["-"] s24["-"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s1,s2,s4,s5,s6,s7,s8,s9,s10 skip +class s11,s12,s13,s14,s15,s16,s18,s19,s20 skip +class s21,s22,s23,s24,s25,s27,s28,s30 skip +class s31,s32,s33,s34,s35 skip + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index +``` + +## Mathematical Definition + +Let $X$ is [_Carrier Set_](../../order/carrier_set.md#mathematical-definition) + +Let $X_{-}$ is [_Partial Carrier Set_](../carrier_set.md#mathematical-definition) + +$$X \subset X_{-}$$ + +Let $S_p$ is [_Partial sequence_](index.md#mathematical-definition) $S_p : \{1, ..., l\} \longrightarrow X_{-},$ + +$S_p$ is called $S_{c|e}$ - _Congeneric sequence_ of $e$ element - if $\exists e \in X\Big|\forall i, S_{p}(i) \in \{-, e\}$ diff --git a/docs/fundamentals/partials_and_congenerics/sequence/index.md b/docs/fundamentals/partials_and_congenerics/sequence/index.md new file mode 100644 index 00000000..ce53f9ac --- /dev/null +++ b/docs/fundamentals/partials_and_congenerics/sequence/index.md @@ -0,0 +1,171 @@ +# Partial Sequence + +_Partial sequence_ is a [_sequence_](../../order/sequence.md) where some elements are skipped. +The concept can be treated as equivalent to the _masked sequence_ that is used in bioinformatics and data science. +In FOA `-` symbol used as `empty` element. + +``` mermaid +block-beta +columns 29 + +i1["1"] i2["2"] i3["3"] i4["4"] i5["5"] i6["6"] i7["7"] i8["8"] i9["9"] i10["10"] i11["11"] i12["12"] +i13["13"] i14["14"] i15["15"] i16["16"] i17["17"] i18["18"] i19["19"] i20["20"] +i21["21"] i22["22"] i23["23"] i24["24"] i25["25"] i26["26"] i27["27"] +i28["28"] i29["29"] + +s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] +s11["C"] s12["E"] s13[" "] s14["-"] s15["-"] s16[" "] s17["T"] s18["-"] s19["-"] s20[" "] +s21["-"] s22["B"] s23["-"] s24["L"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] + +classDef c1 fill:#ff7f0e,color:#fff; +classDef c2 fill:#ffbb78,color:#000; +classDef c3 fill:#2ca02c,color:#fff; +classDef c4 fill:#98df8a,color:#000; +classDef c5 fill:#d62728,color:#fff; +classDef c6 fill:#ff9896,color:#000; +classDef c7 fill:#9467bd,color:#fff; +classDef c8 fill:#c5b0d5,color:#000; +classDef c9 fill:#8c564b,color:#fff; +classDef c10 fill:#c49c94,color:#000; +classDef c11 fill:#e377c2,color:#fff; +classDef c12 fill:#f7b6d2,color:#000; +classDef c13 fill:#bcbd22,color:#fff; +classDef c14 fill:#dbdb8d,color:#000; +classDef c15 fill:#17becf,color:#fff; +classDef c16 fill:#9edae5,color:#000; + +classDef skip fill:#ffffff +classDef index fill:#ffffff,stroke-width:0px + +class s14,s15,s18,s19,s21,s23,s25,s27,s28 skip + +class i1,i2,i3,i4,i5,i6,i7,i8,i9,i10 index +class i11,i12,i13,i14,i15,i16,i17,i18,i19,i20 index +class i21,i22,i23,i24,i25,i26,i27,i28,i29 index +``` + +## Mathematical Definition + +Let $X_{-}$ is [_Partial Carrier set_](../carrier_set.md#mathematical-definition) + +A _Partial sequence_ $S_{p}$ is a l-tuple defined as + +$$S_{p} = ,$$ + +$$\forall i \in \{1, ..., l\} \exists s_i \in X_{-}$$ + +where: + +- $s_i$​ is called the $i$-th _element_ (or coordinate) of the sequence. +- $l := |S_p|$ is _length_, $l \in N$ +- $n := |\{ S_p(i) | S_p(i) \ne - \}|$ is _non-empty elements count_, $n \in N$ + +The _sequence_ $S$ can be also defined as a function + +$$S_p : \{1, ..., l\} \longrightarrow X_{-},$$ + +$$S_p(i)=s_i | i \in \{1, ..., l\}$$ + + +### Compatibility + +Two _Partial Sequences_ are called compatible if there are no _non-empty_ elements in the same position in both sequences. + +=== "Сompatible" + + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["-"] s15["-"] s16[" "] s17["T"] s18["-"] s19["-"] s20[" "] + s21["-"] s22["B"] s23["-"] s24["L"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] s30["-"] + s31["-"] s32["-"] s33["D"] s34["-"] s35["P"] s36["T"] + + q1["-"] q2["-"] q3["-"] q4["-"] q5["-"] q6["-"] q7["-"] q8["-"] q9["-"] q10["-"] + q11["-"] q12["-"] q13["-"] q14["I"] q15["S"] q16["-"] q17["-"] q18["H"] q19["E"] q20["-"] + q21["A"] q22["-"] q23["I"] q24["-"] q25["I"] q26["-"] q27["I"] q28[" "] q29["-"] q30["O"] + q31[" "] q32["A"] q33["-"] q34["A"] q35["-"] q36["-"] + + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + + class s14,s15,s18,s19,s21,s23,s25,s27,s28,s30,s31,s32,s34 skip + + class q1,q2,q3,q4,q5,q6,q7,q8,q9,q10 skip + class q11,q12,q13,q16,q17,q20 skip + class q22,q24,q26,q29 skip + class q33,q35,q36 skip + + ``` + +=== "Incompatible" + + ``` mermaid + block-beta + columns 36 + s1["I"] s2["N"] s3["T"] s4["E"] s5["L"] s6["L"] s7["I"] s8["G"] s9["E"] s10["N"] + s11["C"] s12["E"] s13[" "] s14["-"] s15["-"] s16[" "] s17["T"] s18["-"] s19["-"] s20[" "] + s21["-"] s22["B"] s23["-"] s24["L"] s25["-"] s26["T"] s27["-"] s28["-"] s29["T"] s30["-"] + s31["-"] s32["-"] s33["D"] s34["-"] s35["P"] s36["T"] + + q1["I"] q2["-"] q3["-"] q4["-"] q5["-"] q6["-"] q7["I"] q8["-"] q9["-"] q10["-"] + q11["-"] q12["-"] q13[" "] q14["I"] q15["S"] q16["-"] q17["-"] q18["H"] q19["E"] q20["-"] + q21["A"] q22["-"] q23["I"] q24["-"] q25["I"] q26["-"] q27["I"] q28[" "] q29["-"] q30["O"] + q31[" "] q32["A"] q33["-"] q34["A"] q35["-"] q36["-"] + + + classDef c1 fill:#ff7f0e,color:#fff; + classDef c2 fill:#ffbb78,color:#000; + classDef c3 fill:#2ca02c,color:#fff; + classDef c4 fill:#98df8a,color:#000; + classDef c5 fill:#d62728,color:#fff; + classDef c6 fill:#ff9896,color:#000; + classDef c7 fill:#9467bd,color:#fff; + classDef c8 fill:#c5b0d5,color:#000; + classDef c9 fill:#8c564b,color:#fff; + classDef c10 fill:#c49c94,color:#000; + classDef c11 fill:#e377c2,color:#fff; + classDef c12 fill:#f7b6d2,color:#000; + classDef c13 fill:#bcbd22,color:#fff; + classDef c14 fill:#dbdb8d,color:#000; + classDef c15 fill:#17becf,color:#fff; + classDef c16 fill:#9edae5,color:#000; + + classDef skip fill:#ffffff + + classDef conflict fill:#ff0000,color:#fff + + class s14,s15,s18,s19,s21,s23,s25,s27,s28,s30,s31,s32,s34 skip + + class q2,q3,q4,q5,q6,q8,q9,q10 skip + class q11,q12,q13,q16,q17,q20 skip + class q22,q24,q26,q29 skip + class q33,q35,q36 skip + + class s1,q1,s7,q7 conflict + ``` + + +Let $S1_p$ and $S2_p$ are _Partial sequences_ + +Define + + +$$compatible(S1_p, S2_p) = \forall i \in \{1,...,l\}\ S1_p(i) \notin \{-\} \lor S2_p(i) \notin \{-\} $$ diff --git a/docs/references/characteristics/index.md b/docs/references/characteristics/index.md index 347e0abd..a5afdbeb 100644 --- a/docs/references/characteristics/index.md +++ b/docs/references/characteristics/index.md @@ -9,21 +9,21 @@ The package provides a comprehensive set of characteristics for measuring the pr The table below summarizes the available characteristics that depend only on intervals: -| Linear scale | || Logarifmic scale | | +| Linear scale | || Logarithmic scale | | |------------- |-||-|-----------------| -| [Arithmetic Mean](/references/characteristics/arithmetic_mean/) | $\Delta_a = \frac{1}{n} * \sum_{i=1}^{n} \Delta_{i}$ || | | -| [Geometric Mean](/references/characteristics/geometric_mean/) | $\Delta_g=\sqrt[n]{\prod_{i=1}^{n} \Delta_{i}}$ || $g = \frac{1}{n} * \sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Average Remoteness](/references/characteristics/average_remoteness/) | -| [Volume](/references/characteristics/volume/) | $V=\prod_{i=1}^{n} \Delta_{i}$ || $G=\sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Depth](/references/characteristics/depth/) | +| [Arithmetic Mean](arithmetic_mean.md) | $\Delta_a = \frac{1}{n} * \sum_{i=1}^{n} \Delta_{i}$ || | | +| [Geometric Mean](geometric_mean.md) | $\Delta_g=\sqrt[n]{\prod_{i=1}^{n} \Delta_{i}}$ || $g = \frac{1}{n} * \sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Average Remoteness](average_remoteness.md) | +| [Volume](volume.md) | $V=\prod_{i=1}^{n} \Delta_{i}$ || $G=\sum_{i=1}^{n} \log_2 \Delta_{i}$ | [Depth](depth.md) | The table below summarizes the available characteristics that depend on cogeneric intervals ( grouped by element of the alphabet): | Characteristics | | |-------------------------------|---------------------------------------------------------------------------------------------------------| -| [Descriptive Information](/references/characteristics/descriptive_information/) | $D=\prod_{j=1}^{m}{\left(\sum_{i=1}^{n_j}{\frac{\Delta_{ij}}{n_j}}\right)^{\frac{n_j}{n}}}$ | -| [Identifying Information](/references/characteristics/identifying_information/) | $H=\frac {1} {n} * \sum_{j=1}^{m}{(n_j * \log_2 \sum_{i=1}^{n_j} \frac{\Delta_{ij}}{n_j})}$ | -| [Regularity](/references/characteristics/regularity/) | $r= \sqrt[n]{\prod_{j=1}^{m} \frac{\prod_{j=1}^{n_j} \Delta_{ij}}{{\left(\frac{1}{n_j}\sum_{i=1}^{n_j}{\Delta_{ij}}\right)^{n_j}}}}$ | -| [Uniformity](/references/characteristics/uniformity/) | $u = \frac {1} {n} * \sum_{j=1}^{m}{\log_2 \frac{ (\sum_{i=1}^{n_j} \frac{\Delta_{ij}}{n_j})^{n_j} } { \prod_{i=1}^{n_j} \Delta_{ij}}}$ | +| [Descriptive Information](descriptive_information.md) | $D=\prod_{j=1}^{m}{\left(\sum_{i=1}^{n_j}{\frac{\Delta_{ij}}{n_j}}\right)^{\frac{n_j}{n}}}$ | +| [Identifying Information](identifying_information.md) | $H=\frac {1} {n} * \sum_{j=1}^{m}{(n_j * \log_2 \sum_{i=1}^{n_j} \frac{\Delta_{ij}}{n_j})}$ | +| [Regularity](regularity.md) | $r= \sqrt[n]{\prod_{j=1}^{m} \frac{\prod_{j=1}^{n_j} \Delta_{ij}}{{\left(\frac{1}{n_j}\sum_{i=1}^{n_j}{\Delta_{ij}}\right)^{n_j}}}}$ | +| [Uniformity](uniformity.md) | $u = \frac {1} {n} * \sum_{j=1}^{m}{\log_2 \frac{ (\sum_{i=1}^{n_j} \frac{\Delta_{ij}}{n_j})^{n_j} } { \prod_{i=1}^{n_j} \Delta_{ij}}}$ | -[ma](/references/characteristics/ma/) subpackage provides characteristics for cogeneric intervals ( grouped by element). +[ma](ma/index.md) subpackage provides characteristics for cogeneric intervals ( grouped by element). diff --git a/docs/references/characteristics/ma/index.md b/docs/references/characteristics/ma/index.md index 8d84d7e4..4f168a67 100644 --- a/docs/references/characteristics/ma/index.md +++ b/docs/references/characteristics/ma/index.md @@ -8,17 +8,17 @@ The package provides a comprehensive set of vector characteristics for measuring The table below summarizes vector representation of the characteristics that depend only on intervals: -| Linear scale | |Logarifmic scale | | +| Linear scale | |Logarithmic scale | | |------------- |-||-----------------| -| [Arithmetic Mean](/references/characteristics/ma/arithmetic_mean/) | $\left[ \Delta_{a_j} \right]_{1 \le j \le m} = \left[ \frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right]_{1 \le j \le m}$ || | -| [Geometric Mean](/references/characteristics/ma/geometric_mean/) | $\left[ \Delta_{g_j} \right]_{1 \le j \le m} = \left[ \left( \prod_{i=1}^{n_j} \Delta_{ij} \right)^{1/n_j} \right]_{1 \le j \le m}$ | $\left[ g_j \right]_{1 \le j \le m} = \left[ \frac{1}{n_j} * \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$ | [Average Remoteness](/references/characteristics/ma/average_remoteness/) | -| [Volume](/references/characteristics/ma/volume/) | $\left[ V_j \right]_{1 \le j \le m} = \left[ \prod_{i=1}^{n_j} \Delta_{ij} \right]_{1 \le j \le m}$ |$\left[ G_j \right]_{1 \le j \le m} = \left[ \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$| [Depth](/references/characteristics/ma/depth/) | +| [Arithmetic Mean](arithmetic_mean.md) | $\left[ \Delta_{a_j} \right]_{1 \le j \le m} = \left[ \frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right]_{1 \le j \le m}$ || | +| [Geometric Mean](geometric_mean.md) | $\left[ \Delta_{g_j} \right]_{1 \le j \le m} = \left[ \left( \prod_{i=1}^{n_j} \Delta_{ij} \right)^{1/n_j} \right]_{1 \le j \le m}$ | $\left[ g_j \right]_{1 \le j \le m} = \left[ \frac{1}{n_j} * \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$ | [Average Remoteness](average_remoteness.md) | +| [Volume](volume.md) | $\left[ V_j \right]_{1 \le j \le m} = \left[ \prod_{i=1}^{n_j} \Delta_{ij} \right]_{1 \le j \le m}$ |$\left[ G_j \right]_{1 \le j \le m} = \left[ \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$| [Depth](depth.md) | The table below summarizes the advanced characteristics of cogeneric intervals: | Characteristics | | |-------------------------------|---------------------------------------------------------------------------------------------------------| -| [Identifying Information](/references/characteristics/ma/identifying_information/) | $\left[ H_j \right]_{1 \le j \le m} = \left[ \log_2 { \left(\frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right) } \right]_{1 \le j \le m}$ | -| [Periodicity](/references/characteristics/ma/periodicity/) | $\left[ \tau_j \right]_{1 \le j \le m} = \left[ \left( \prod_{i=1}^{n_j} \Delta_{ij} \right)^{1/n_j} * \frac{ n_j }{ \sum_{i=1}^{n_j} \Delta_{ij} } \right]_{1 \le j \le m}$ | -| [Uniformity](/references/characteristics/ma/uniformity/) | $\left[ u_j \right]_{1 \le j \le m} = \left[ \log_2 { \left(\frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right) } - \frac{1}{n_j} * \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$ | +| [Identifying Information](identifying_information.md) | $\left[ H_j \right]_{1 \le j \le m} = \left[ \log_2 { \left(\frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right) } \right]_{1 \le j \le m}$ | +| [Periodicity](periodicity.md) | $\left[ \tau_j \right]_{1 \le j \le m} = \left[ \left( \prod_{i=1}^{n_j} \Delta_{ij} \right)^{1/n_j} * \frac{ n_j }{ \sum_{i=1}^{n_j} \Delta_{ij} } \right]_{1 \le j \le m}$ | +| [Uniformity](uniformity.md) | $\left[ u_j \right]_{1 \le j \le m} = \left[ \log_2 { \left(\frac{1}{n_j} * \sum_{i=1}^{n_j} \Delta_{ij} \right) } - \frac{1}{n_j} * \sum_{i=1}^{n_j} \log_2 \Delta_{ij} \right]_{1 \le j \le m}$ | diff --git a/docs/references/exceptions/index.md b/docs/references/exceptions/index.md index 7007095f..f527da66 100644 --- a/docs/references/exceptions/index.md +++ b/docs/references/exceptions/index.md @@ -10,5 +10,5 @@ The table below summarizes the available exceptions: | Exception | Description | |-----------|-------------| -| [Not1DArrayException](/references/exceptions/not_1d_array/) | Raised when function receives not 1D array as input. | -| [InconsistentOrderException](/references/exceptions/inconsistent_order/) | Raised when function receives inconsistent order. | +| [Not1DArrayException](not_1d_array.md) | Raised when function receives not 1D array as input. | +| [InconsistentOrderException](inconsistent_order.md) | Raised when function receives inconsistent order. | diff --git a/docs/references/ma/index.md b/docs/references/ma/index.md index 82f88ea7..4eef273a 100644 --- a/docs/references/ma/index.md +++ b/docs/references/ma/index.md @@ -6,4 +6,4 @@ hide: The package provides a comprehensive set of functions that decompose sequence into cogeneric order and congeneric intervals. -The functions required by [vector representation of characteristics](/references/characteristics/ma) and [characteristics of order that depends on congeneric intervals distribution](/references/characteristics) are: +The functions required by vector representation of characteristics and [characteristics of order that depends on congeneric intervals distribution](../characteristics/index.md) are: diff --git a/mkdocs.yml b/mkdocs.yml index 8975d29b..6608f606 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,50 +6,74 @@ nav: - fundamentals/index.md - "Ideas": - fundamentals/ideas/index.md - - "Sequence as a whole object": fundamentals/ideas/sequence_as_an_system_object.md - - "Order as a sequence property": fundamentals/ideas/order_as_a_sequence_property.md + - "Sequence as a whole object": fundamentals/ideas/sequence_as_a_whole_object.md + - "Order as a property": fundamentals/ideas/order_as_a_property.md - "Congeneric decomposition": fundamentals/ideas/congeneric_decomposition.md - "Interval as a basic information unit": fundamentals/ideas/interval_as_a_basic_information_unit.md - "Geomteric mean as alternative to probability": fundamentals/ideas/geometric_mean_based_characteristics.md - - "Objects": - - fundamentals/objects/index.md - - "Sequence": fundamentals/objects/sequence.md - - "Alphabet": fundamentals/objects/alphabet.md - - "Order": fundamentals/objects/order.md - - "Interval": fundamentals/objects/interval.md - - "Intervals Order": fundamentals/objects/intervals_order.md - - "Intervals Tuple": fundamentals/objects/intervals_tuple.md - - "Intervals Distribution": fundamentals/objects/intervals_distribution.md + - "Order and its measures": + - fundamentals/order/index.md + - "Carrier set": fundamentals/order/carrier_set.md + - "Sequence": fundamentals/order/sequence.md + - "Alphabet": fundamentals/order/alphabet.md + - "Order": fundamentals/order/order.md + - "Intervals Chain": + - fundamentals/order/intervals_chain/index.md + - "Bounded": fundamentals/order/intervals_chain/bounded.md + - "Cycled": fundamentals/order/intervals_chain/cycled.md + - "Intervals Distribution": + - fundamentals/order/intervals_distribution/index.md + - "Lossy": fundamentals/order/intervals_distribution/lossy.md + - "Redundant": fundamentals/order/intervals_distribution/redundant.md + - "Characteristics": + - fundamentals/order/characteristics/index.md + - "Arithmetic mean": fundamentals/order/characteristics/arithmetic_mean.md + - "Geometric mean": fundamentals/order/characteristics/geometric_mean.md + - "Volume": fundamentals/order/characteristics/volume.md + - "Average remoteness": fundamentals/order/characteristics/average_remoteness.md + - "Depth": fundamentals/order/characteristics/depth.md + - "Partials and congenerics": + - fundamentals/partials_and_congenerics/index.md + - "Carrier set": fundamentals/partials_and_congenerics/carrier_set.md + - "Sequence": + - fundamentals/partials_and_congenerics/sequence/index.md + - "Congeneric": fundamentals/partials_and_congenerics/sequence/congeneric.md + - "Alphabet": + - fundamentals/partials_and_congenerics/alphabet/index.md + - "Congeneric": fundamentals/partials_and_congenerics/alphabet/congeneric.md + - "Order": + - fundamentals/partials_and_congenerics/order/index.md + - "Congeneric": fundamentals/partials_and_congenerics/order/congeneric.md + - "Intervals chain": + - fundamentals/partials_and_congenerics/intervals_chain/index.md + - "Congeneric": fundamentals/partials_and_congenerics/intervals_chain/congeneric.md + - "Intervals distribution": fundamentals/partials_and_congenerics/intervals_distribution.md + - "Characteristics": fundamentals/partials_and_congenerics/characteristics.md - "Congeneric decomposition": - fundamentals/congeneric_decomposition/index.md - - "Congeneric sequences": fundamentals/congeneric_decomposition/congeneric_sequences.md - - "Congeneric orders": fundamentals/congeneric_decomposition/congeneric_orders.md - - "Congeneric intervals order": fundamentals/congeneric_decomposition/congeneric_intervals_order.md - - "Congeneric intervals tuple": fundamentals/congeneric_decomposition/congeneric_intervals_tuple.md - - "Congeneric intervals distribution": fundamentals/congeneric_decomposition/congeneric_intervals_distribution.md - - "Characteristics": - - fundamentals/characteristics/index.md - - "Arithmetic mean": fundamentals/characteristics/arithmetic_mean.md - - "Average remoteness": fundamentals/characteristics/average_remoteness.md - - "Depth": fundamentals/characteristics/depth.md - - "Descriptive information": fundamentals/characteristics/descriptive_information.md - - "Geometric mean": fundamentals/characteristics/geometric_mean.md - - "Identifying information": fundamentals/characteristics/identifying_information.md - - "Periodicity": fundamentals/characteristics/periodicity.md - - "Uniformity": fundamentals/characteristics/uniformity.md - - "Volume": fundamentals/characteristics/volume.md - - "Connections to other mathfields": - - fundamentals/connections_to_other_mathfields/index.md - - "Information theory": fundamentals/connections_to_other_mathfields/information_theory.md - - "Probability theory": fundamentals/connections_to_other_mathfields/probability_theory.md - - "Statistics": fundamentals/connections_to_other_mathfields/statistics.md - - "Combinatorics": fundamentals/connections_to_other_mathfields/combinatorics.md - - "Applications": - - fundamentals/applications/index.md - - "Text mining": fundamentals/applications/text_mining.md - - "Bioinformatics": fundamentals/applications/bioinformatics.md - - "Music analysis": fundamentals/applications/music_analysis.md - - "Other applications": fundamentals/applications/other_applications.md + - "Sequences": fundamentals/congeneric_decomposition/sequences.md + - "Alphabet": fundamentals/congeneric_decomposition/alphabet.md + - "Orders": fundamentals/congeneric_decomposition/orders.md + - "Intervals chains": fundamentals/congeneric_decomposition/intervals_chains.md + - "Intervals distribution": fundamentals/congeneric_decomposition/intervals_distribution.md + - "Characteristics": + - fundamentals/congeneric_decomposition/characteristics/index.md + - "Descriptive informations": fundamentals/congeneric_decomposition/characteristics/descriptive_information.md + - "Identifying information": fundamentals/congeneric_decomposition/characteristics/identifying_information.md + - "Regularity": fundamentals/congeneric_decomposition/characteristics/regularity.md + - "Uniformity": fundamentals/congeneric_decomposition/characteristics/uniformity.md + # - "Connections to other mathfields": + # - fundamentals/connections_to_other_mathfields/index.md + # - "Information theory": fundamentals/connections_to_other_mathfields/information_theory.md + # - "Probability theory": fundamentals/connections_to_other_mathfields/probability_theory.md + # - "Statistics": fundamentals/connections_to_other_mathfields/statistics.md + # - "Combinatorics": fundamentals/connections_to_other_mathfields/combinatorics.md + # - "Applications": + # - fundamentals/applications/index.md + # - "Text mining": fundamentals/applications/text_mining.md + # - "Bioinformatics": fundamentals/applications/bioinformatics.md + # - "Music analysis": fundamentals/applications/music_analysis.md + # - "Other applications": fundamentals/applications/other_applications.md - "References": - "foapy.alphabet": references/alphabet.md - "foapy.order": references/order.md @@ -138,12 +162,16 @@ markdown_extensions: pygments_lang_class: true - pymdownx.inlinehilite - pymdownx.snippets - - pymdownx.superfences - tables - pymdownx.tabbed: alternate_style: true - pymdownx.arithmatex: generic: true + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format plugins: - autorefs diff --git a/src/foapy/characteristics/_regularity.py b/src/foapy/characteristics/_regularity.py index 17768cc3..b41a8ce0 100644 --- a/src/foapy/characteristics/_regularity.py +++ b/src/foapy/characteristics/_regularity.py @@ -1,7 +1,7 @@ import numpy as np -def regularity(intervals, dtype=None): +def regularity(intervals_grouped, dtype=None): """ Calculates regularity of intervals grouped by element of the alphabet. @@ -75,7 +75,7 @@ def regularity(intervals, dtype=None): """ # noqa: E501 from foapy.characteristics import descriptive_information, geometric_mean - total_elements = np.concatenate(intervals) + total_elements = np.concatenate(intervals_grouped) g = geometric_mean(total_elements, dtype=dtype) - D = descriptive_information(intervals, dtype=dtype) + D = descriptive_information(intervals_grouped, dtype=dtype) return g / D diff --git a/src/foapy/characteristics/_uniformity.py b/src/foapy/characteristics/_uniformity.py index a9078ae3..31e6eb8e 100644 --- a/src/foapy/characteristics/_uniformity.py +++ b/src/foapy/characteristics/_uniformity.py @@ -1,7 +1,7 @@ import numpy as np -def uniformity(intervals, dtype=None): +def uniformity(intervals_grouped, dtype=None): """ Calculates uniformity of intervals grouped by element of the alphabet. @@ -71,9 +71,9 @@ def uniformity(intervals, dtype=None): """ # noqa: E501 from foapy.characteristics import average_remoteness, identifying_information - total_elements = np.concatenate(intervals) + total_elements = np.concatenate(intervals_grouped) - H = identifying_information(intervals, dtype=dtype) + H = identifying_information(intervals_grouped, dtype=dtype) g = average_remoteness(total_elements, dtype=dtype) return H - g diff --git a/src/foapy/ma/_intervals.py b/src/foapy/ma/_intervals.py index 8c001ef0..26b652c8 100644 --- a/src/foapy/ma/_intervals.py +++ b/src/foapy/ma/_intervals.py @@ -1,11 +1,12 @@ import numpy as np from numpy import ma -from foapy import binding, mode +from foapy import binding as binding_enum +from foapy import mode as mode_enum from foapy.exceptions import InconsistentOrderException, Not1DArrayException -def intervals(X, bind, mod): +def intervals(X, binding, mode): """ Finding array of array of intervals of the uniform sequences in the given input sequence @@ -157,13 +158,19 @@ def intervals(X, bind, mod): """ # Validate binding - if bind not in {binding.start, binding.end}: + if binding not in {binding_enum.start, binding_enum.end}: raise ValueError( {"message": "Invalid binding value. Use binding.start or binding.end."} ) # Validate mode - if mod not in {mode.lossy, mode.normal, mode.cycle, mode.redundant}: + valid_modes = { + mode_enum.lossy, + mode_enum.normal, + mode_enum.cycle, + mode_enum.redundant, + } + if mode not in valid_modes: raise ValueError( {"message": "Invalid mode value. Use mode.lossy,normal,cycle or redundant."} ) @@ -199,7 +206,7 @@ def intervals(X, bind, mod): ) extended_mask = np.empty((power, length + 1), dtype=bool) - if bind == binding.end: + if binding == binding_enum.end: extended_mask[:, :-1] = ~mask[::-1, ::-1] else: extended_mask[:, :-1] = ~mask @@ -217,33 +224,33 @@ def intervals(X, bind, mod): indecies = np.zeros(positions.shape[1], dtype=int) indecies[1:] = positions[1, 1:] - positions[1, :-1] - delta = indecies[last_indexes] if mod == mode.cycle else 1 + delta = indecies[last_indexes] if mode == mode_enum.cycle else 1 indecies[first_indexes] = positions[1][first_indexes] + delta split_boarders = np.zeros(power * 2, dtype=int) - if mod == mode.lossy: + if mode == mode_enum.lossy: split_boarders[positions[0][last_indexes[:1]] * 2] = first_indexes[:1] + 1 split_boarders[positions[0][last_indexes[1:]] * 2] = ( np.fmax(last_indexes[:-1], first_indexes[1:]) + 1 ) split_boarders[positions[0][last_indexes] * 2 + 1] = last_indexes - elif mod == mode.normal: + elif mode == mode_enum.normal: split_boarders[positions[0][last_indexes[:1]] * 2] = 0 split_boarders[positions[0][last_indexes[1:]] * 2] = last_indexes[:-1] + 1 split_boarders[positions[0][last_indexes] * 2 + 1] = last_indexes - elif mod == mode.cycle: + elif mode == mode_enum.cycle: split_boarders[positions[0][last_indexes[:1]] * 2] = 0 split_boarders[positions[0][last_indexes[1:]] * 2] = last_indexes[:-1] + 1 split_boarders[positions[0][last_indexes] * 2 + 1] = last_indexes - elif mod == mode.redundant: + elif mode == mode_enum.redundant: split_boarders[positions[0][last_indexes[:1]] * 2] = 0 split_boarders[positions[0][last_indexes[1:]] * 2] = 0 split_boarders[positions[0][last_indexes] * 2 + 1] = last_indexes + 1 preserve_previous = np.frompyfunc(lambda x, y: x if y == 0 else y, 2, 1) split_boarders = preserve_previous.accumulate(split_boarders) - if bind == binding.end: + if binding == binding_enum.end: split_boarders[:-1] = np.diff(split_boarders) split_boarders[-1:] = len(indecies) - split_boarders[-1] split_boarders = np.cumsum(split_boarders[::-1])