Revisions of #4932

Contributors: Knut Sondre Sæbø

If we normalize a theory into the parts that can be put on a computer, the types it uses, the nodes (specific values) it commits to, and the functions between them, we can score the theory by how many of those parts actually run.

from dataclasses import dataclass

@dataclass
class Item:
name: str
kind: str # "type", "node", or "function"
programmable: bool # does it compile and run?

@dataclass
class Theory:
name: str
items: list[Item]

plaintext
def score(self) -> float:
if not self.items:
return 0.0
ok = sum(1 for i in self.items if i.programmable)
return ok / len(self.items)

def compare(a: Theory, b: Theory) -> None:
print(f"{a.name:<20} {a.score():.0%}")
print(f"{b.name:<20} {b.score():.0%}")

Demeter theory

demeter = Theory("Demeter", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Goddess", "type", False),
Item("Emotion", "type", False),
Item("Demeter", "node", False),
Item("emotionstate", "node", False),
Item("emotion
at", "function", False),
Item("emotion_weather", "function", False),
])

Axial tilt theory

axialtilt = Theory("Axial tilt", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Angle", "type", True),
Item("Insolation", "type", True),
Item("axial
tilt", "node", True),
Item("solarconstant", "node", True),
Item("solar
angle", "function", True),
Item("insolation_at", "function", True),
Item("temperature", "function", True),
])

compare(demeter, axial_tilt)

Output metrics:
Demeter 25%
Axial tilt 100%

Version 1​·​#4932​·​Knut Sondre Sæbø​·​about 19 hours ago

If we normalize a theory into the parts that can be put on a computer, the types it uses, the nodes (specific values) it commits to, and the functions between them, we can score the theory by how many of those parts actually run.

from dataclasses import dataclass

@dataclass
class Item:
name: str
kind: str # "type", "node", or "function"
programmable: bool # does it compile and run?

@dataclass
class Theory:
name: str
items: list[Item]

plaintext
def score(self) -> float:
if not self.items:
return 0.0
ok = sum(1 for i in self.items if i.programmable)
return ok / len(self.items)

def compare(a: Theory, b: Theory) -> None:
print(f"{a.name:<20} {a.score():.0%}")
print(f"{b.name:<20} {b.score():.0%}")

Demeter theory

demeter = Theory("Demeter", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Goddess", "type", False),
Item("Emotion", "type", False),
Item("Demeter", "node", False),
Item("emotionstate", "node", False),
Item("emotion
at", "function", False),
Item("emotion_weather", "function", False),
])

Axial tilt theory

axialtilt = Theory("Axial tilt", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Angle", "type", True),
Item("Insolation", "type", True),
Item("axial
tilt", "node", True),
Item("solarconstant", "node", True),
Item("solar
angle", "function", True),
Item("insolation_at", "function", True),
Item("temperature", "function", True),
])

compare(demeter, axial_tilt)

Output metrics:
Demeter 25%
Axial tilt 100%

I'm not a programmer, so the code below is 100% AI-generated. But here is an attempt. If we normalize a theory into the parts that can be put on a computer, the types it uses, the nodes (specific values) it commits to, and the functions between them, we can score the theory by how many of those parts run.

from dataclasses import dataclass

@dataclass
class Item:
name: str
kind: str # "type", "node", or "function"
programmable: bool # does it compile and run?

@dataclass
class Theory:
name: str
items: list[Item]

plaintext
def score(self) -> float:
if not self.items:
return 0.0
ok = sum(1 for i in self.items if i.programmable)
return ok / len(self.items)

def compare(a: Theory, b: Theory) -> None:
print(f"{a.name:<20} {a.score():.0%}")
print(f"{b.name:<20} {b.score():.0%}")

Demeter theory

demeter = Theory("Demeter", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Goddess", "type", False),
Item("Emotion", "type", False),
Item("Demeter", "node", False),
Item("emotionstate", "node", False),
Item("emotion
at", "function", False),
Item("emotion_weather", "function", False),
])

Axial tilt theory

axialtilt = Theory("Axial tilt", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Angle", "type", True),
Item("Insolation", "type", True),
Item("axial
tilt", "node", True),
Item("solarconstant", "node", True),
Item("solar
angle", "function", True),
Item("insolation_at", "function", True),
Item("temperature", "function", True),
])

compare(demeter, axial_tilt)

Output metrics:
Demeter 25%
Axial tilt 100%

Version 2​·​#4933​·​Knut Sondre Sæbø​·​about 19 hours ago

I'm not a programmer, so the code below is 100% AI-generated. But here is an attempt. If we normalize a theory into the parts that can be put on a computer, the types it uses, the nodes (specific values) it commits to, and the functions between them, we can score the theory by how many of those parts run.

from dataclasses import dataclass

@dataclass
class Item:
name: str
kind: str # "type", "node", or "function"
programmable: bool # does it compile and run?

@dataclass
class Theory:
name: str
items: list[Item]

plaintext
def score(self) -> float:
if not self.items:
return 0.0
ok = sum(1 for i in self.items if i.programmable)
return ok / len(self.items)

def compare(a: Theory, b: Theory) -> None:
print(f"{a.name:<20} {a.score():.0%}")
print(f"{b.name:<20} {b.score():.0%}")

Demeter theory

demeter = Theory("Demeter", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Goddess", "type", False),
Item("Emotion", "type", False),
Item("Demeter", "node", False),
Item("emotionstate", "node", False),
Item("emotion
at", "function", False),
Item("emotion_weather", "function", False),
])

Axial tilt theory

axialtilt = Theory("Axial tilt", [
Item("Latitude", "type", True),
Item("Temperature", "type", True),
Item("Angle", "type", True),
Item("Insolation", "type", True),
Item("axial
tilt", "node", True),
Item("solarconstant", "node", True),
Item("solar
angle", "function", True),
Item("insolation_at", "function", True),
Item("temperature", "function", True),
])

compare(demeter, axial_tilt)

Output metrics:
Demeter 25%
Axial tilt 100%

If we normalize a theory into the parts that can be put on a computer, the types it uses, the nodes (specific values) it commits to, and the functions between them, we can score the theory by how many of those parts run.

The program goes through each item in a theory, counts how many are marked True, and divides by the total. That fraction is the score of how hard the theory is to vary.

An item is True if it can be put on a computer, either by reusing an existing type (Float, Int) or by defining a new one that compiles. It is False if no working type system can express it. The user fills in the labels; the program just counts.

Demeter: 2 of 8 items program (Latitude and Temperature). Demeter, her emotions, and the functions linking them to weather can't. So the score is 25%.

Axial tilt: 9 of 9 items program. Standard types, measured constants, and functions from standard physics. So the score is 100%.

Version 3​·​#4934​·​Knut Sondre Sæbø​·​about 19 hours ago