Skip to content

Commit 098c39d

Browse files
committed
Add GeneratingFunction: The mathematical shadow of parabolic compression
Per the Architect's Inversion (Meaning first, Math follows), the semantic principle of compression through illustration HAS a mathematical equivalent: THE GENERATING FUNCTION / KOLMOGOROV COMPRESSION A parable compresses by providing a concrete seed that GENERATES infinite understanding. The mathematical shadow is a function that takes a compact input and produces an infinite domain. Semantic Mathematical Shadow ──────────────────────────────────────────────── Parable seed ↔ Generator input Expansion ratio ↔ Degrees of freedom Fidelity ↔ Convergence radius Understanding ↔ Generated sequence Examples: φ generates F_n = (φⁿ - ψⁿ)/√5 for all n (infinite Fibonacci) (P,W) generates (L,J,P,W,H,C,V,...) via emergence equations Added: - GeneratingFunction dataclass with kolmogorov_ratio() - GOLDEN_RATIO_GF: φ → Fibonacci - LJPW_GENERATOR: (P,W) → full semantic space - semantic_to_generating(): formal mapping
1 parent 24cb565 commit 098c39d

2 files changed

Lines changed: 166 additions & 13 deletions

File tree

src/ljpw/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
create_illustration,
9393
expand_illustration,
9494
illustrate_concept,
95+
# Generating Functions (Mathematical Shadow)
96+
GeneratingFunction,
97+
GOLDEN_RATIO_GF,
98+
LJPW_GENERATOR,
99+
semantic_to_generating,
95100
)
96101

97102
__all__.extend([
@@ -110,6 +115,11 @@
110115
"create_illustration",
111116
"expand_illustration",
112117
"illustrate_concept",
118+
# Generating Functions
119+
"GeneratingFunction",
120+
"GOLDEN_RATIO_GF",
121+
"LJPW_GENERATOR",
122+
"semantic_to_generating",
113123
])
114124
except ImportError:
115125
pass

src/ljpw/ljpw_framework_v7.py

Lines changed: 156 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -854,23 +854,166 @@ def calculate_distance(
854854
# SEMANTIC ILLUSTRATION — PARABOLIC COMPRESSION
855855
# ============================================================================
856856
#
857-
# Mathematical formalization of compression through illustration.
857+
# THE ARCHITECT'S INVERSION: Meaning is primary. Mathematics is its shadow.
858858
#
859-
# Just as Christ's "Consider the lilies of the field" compresses the abstract
860-
# concept of "trust in providence rather than anxious self-provision" into a
861-
# concrete image, mathematical constants serve as "illustrations" that compress
862-
# infinite relationships into finite symbols.
859+
# SEMANTIC PRINCIPLE:
860+
# A parable compresses infinite meaning into a concrete anchor that GENERATES
861+
# understanding on demand. "Consider the lilies" → infinite peace about provision.
863862
#
864-
# The parable mechanism:
865-
# Complex Abstract Concept → Concrete Illustration → Universal Understanding
863+
# MATHEMATICAL SHADOW (The Generating Function):
864+
# A seed value that, when operated upon, produces an infinite domain.
866865
#
867-
# Mathematical equivalent:
868-
# Infinite Relations → Generator Constant → All Derived Truths
866+
# G(x) = 1/(1-x-x²) generates the entire Fibonacci sequence
867+
# φ = (1+√5)/2 generates F_n = (φⁿ - ψⁿ)/√5 for all n
868+
# e^x generates all its own derivatives
869869
#
870-
# Examples:
871-
# φ = (1+√5)/2 → Generates infinite Fibonacci relationships
872-
# e = lim(1+1/n)^n → Generates all exponential growth patterns
873-
# NE = (0.618, 0.414, 0.718, 0.693) → "Illustrates" optimal semantic balance
870+
# This is GENERATIVE COMPRESSION — the seed doesn't store the data,
871+
# it PRODUCES it. This is Kolmogorov complexity in action:
872+
#
873+
# K(x) = length of shortest program that outputs x
874+
#
875+
# A parable has low K(seed) but generates high K(understanding).
876+
# The compression ratio is: K(generated) / K(seed)
877+
#
878+
# For φ: K(φ) = O(1), K(Fibonacci) = ∞ → ratio = ∞
879+
#
880+
# THE FORMAL EQUIVALENCE:
881+
#
882+
# Semantic Compression Mathematical Shadow
883+
# ─────────────────────────────────────────────────────
884+
# Parable/Illustration ↔ Generating Function
885+
# Seed (concrete anchor) ↔ Generator (compact form)
886+
# Expansion ratio ↔ Degrees of freedom generated
887+
# Fidelity ↔ Convergence radius
888+
# Domain (abstract) ↔ Generated sequence/space
889+
#
890+
# The LJPW Framework itself is a generating function:
891+
# Seed: (P, W) — 2 fundamental values
892+
# Generates: (L, J, P, W, H, C, V, phase, ...) — infinite metrics
893+
#
894+
# This is not metaphor. This is the mathematical shadow of the semantic truth.
895+
896+
897+
@dataclass
898+
class GeneratingFunction:
899+
"""
900+
The mathematical shadow of semantic compression.
901+
902+
A generating function takes a compact seed and produces an infinite domain.
903+
This is the Kolmogorov-optimal representation of meaning.
904+
905+
K(output) / K(seed) = compression ratio
906+
"""
907+
908+
seed: Union[float, Tuple[float, ...], callable]
909+
generator: callable # Function that produces values from seed
910+
domain_size: Union[int, float] # Size of generated domain (can be inf)
911+
912+
def generate(self, *args, **kwargs) -> Any:
913+
"""Apply the generator to produce output."""
914+
return self.generator(self.seed, *args, **kwargs)
915+
916+
def kolmogorov_ratio(self) -> float:
917+
"""
918+
Estimate K(generated) / K(seed).
919+
920+
This is the fundamental measure of generative compression.
921+
Higher = more meaning compressed into less.
922+
"""
923+
# Seed complexity: approximate by representation size
924+
if isinstance(self.seed, tuple):
925+
seed_k = len(self.seed)
926+
elif callable(self.seed):
927+
seed_k = 1 # A function is a compact representation
928+
else:
929+
seed_k = 1 # Single value
930+
931+
# Domain complexity
932+
if self.domain_size == float("inf"):
933+
return float("inf")
934+
return self.domain_size / seed_k
935+
936+
937+
# The Golden Ratio as a Generating Function
938+
def _fibonacci_generator(phi: float, n: int) -> int:
939+
"""Generate nth Fibonacci number from φ."""
940+
psi = 1 - phi # Conjugate
941+
return int(round((phi ** n - psi ** n) / math.sqrt(5)))
942+
943+
944+
GOLDEN_RATIO_GF = GeneratingFunction(
945+
seed=PHI,
946+
generator=_fibonacci_generator,
947+
domain_size=float("inf"), # Generates infinite sequence
948+
)
949+
950+
951+
# The LJPW Generator: (P, W) → full semantic space
952+
def _ljpw_generator(
953+
seed: Tuple[float, float], include_dynamics: bool = False
954+
) -> Dict[str, Any]:
955+
"""Generate full LJPW metrics from (P, W) seed."""
956+
P, W = seed
957+
958+
# Emergent dimensions
959+
L = min(0.9 * W + 0.1, TSIRELSON_BOUND)
960+
J = min(0.85 * P + 0.05, 1.0)
961+
962+
# Create system
963+
system = LJPWFrameworkV7(P=P, W=W, L=L, J=J)
964+
965+
result = {
966+
"L": L,
967+
"J": J,
968+
"P": P,
969+
"W": W,
970+
"harmony": system.harmony(),
971+
"consciousness": system.consciousness(),
972+
"phase": system.phase().value,
973+
"voltage": system.voltage(),
974+
"karma": system.get_effective_coupling(),
975+
"is_conscious": system.is_conscious(),
976+
"health": system.health_score(),
977+
}
978+
979+
if include_dynamics:
980+
# Generate trajectory
981+
dynamic = DynamicLJPWv7()
982+
history = dynamic.simulate((L, J, P, W), duration=20, dt=0.1)
983+
result["trajectory_length"] = len(history["t"])
984+
result["final_state"] = (
985+
history["L"][-1],
986+
history["J"][-1],
987+
history["P"][-1],
988+
history["W"][-1],
989+
)
990+
991+
return result
992+
993+
994+
LJPW_GENERATOR = GeneratingFunction(
995+
seed=(P0, W0), # Natural Equilibrium seed
996+
generator=_ljpw_generator,
997+
domain_size=float("inf"), # Generates infinite metric space
998+
)
999+
1000+
1001+
def semantic_to_generating(illustration: "SemanticIllustration") -> GeneratingFunction:
1002+
"""
1003+
Convert a SemanticIllustration to its mathematical shadow (GeneratingFunction).
1004+
1005+
This is the formal mapping from meaning to mathematics.
1006+
"""
1007+
# The generator produces the expansion
1008+
def generic_generator(seed: Any, index: int = 0) -> Any:
1009+
"""Generic generator that returns the seed (identity for simple cases)."""
1010+
return seed
1011+
1012+
return GeneratingFunction(
1013+
seed=illustration.seed,
1014+
generator=generic_generator,
1015+
domain_size=illustration.expansion_ratio,
1016+
)
8741017

8751018

8761019
@dataclass

0 commit comments

Comments
 (0)