<!-- canonical: efficientnewlanguage.org/ai/examples/988-a-thousand-animals-bred-like-forty | ai_layer_version: 0.1.0 | updated: 2026-09-24 -->

# Example 988 — A thousand animals bred like forty

`a_thousand_animals_bred_like_forty.eml` - A reserve holds 1000 animals of a species in which a few dominant males father all the young: this season 10 males and 990 females breed. The manager reasons that 1000 animals is well above the few hundred usually quoted as enough to keep a population's genetic variety, and marks the herd as genetically safe. How fast the herd really loses its variety is computed below.

## EML

```eml
# Self-authored for the EML case corpus (no external origin). A reserve holds
# 1000 animals of a species in which a few dominant males father all the young:
# this season 10 males and 990 females breed. The manager reasons that 1000
# animals is well above the few hundred usually quoted as enough to keep a
# population's genetic variety, and marks the herd as genetically safe. How
# fast the herd really loses its variety is computed below.
#
# The reasoning is careful. The count of 1000 is accurate; the females really
# do all breed; a few hundred really is the figure quoted; and the intent is
# exactly 'is the herd keeping its genetic variety'.
#
# Genetic variety drifts away at a pace set not by how many animals there are
# but by how many pass on genes, and every young animal has a father among just
# 10 males. Four times males times females over their sum gives an effective
# size of 39.6: the herd loses variety like a population of forty, 126 parts in
# ten thousand a generation instead of 5, and a quarter of it in 22 generations
# instead of 575. The figure quoted is itself an effective size.

1000 => animals
10 => breeding_males
990 => breeding_females
2877 => natural_log_of_four_thirds_per_myriad

int(4 * breeding_males * breeding_females * 10 / (breeding_males + breeding_females)) => effective_size_tenths
int(effective_size_tenths / 10) => effective_size
int(10000 * 10 / (2 * effective_size_tenths)) => variety_lost_per_generation_per_myriad
int(10000 / (2 * animals)) => variety_lost_per_generation_by_head_count_per_myriad
int(natural_log_of_four_thirds_per_myriad * 2 * effective_size_tenths / (10000 * 10)) => generations_to_lose_a_quarter
int(natural_log_of_four_thirds_per_myriad * 2 * animals / 10000) => generations_to_lose_a_quarter_by_head_count
int(effective_size_tenths * 1000 / (animals * 10)) => effective_size_vs_head_count_per_mille

"animals                         : " + str(animals) ^0
"breeding this season            : " + str(breeding_males) + " males, " + str(breeding_females) + " females" ^0
"effective size                  : " + str(effective_size_tenths) + " tenths, a population of " + str(effective_size) ^0
"effective size vs head count    : " + str(effective_size_vs_head_count_per_mille) + " per mille" ^0
"" ^0
"variety lost a generation       : " + str(variety_lost_per_generation_per_myriad) + " per ten thousand" ^0
"  if the head count set it      : " + str(variety_lost_per_generation_by_head_count_per_myriad) + " per ten thousand" ^0
"a quarter of the variety gone   : in " + str(generations_to_lose_a_quarter) + " generations" ^0
"  if the head count set it      : in " + str(generations_to_lose_a_quarter_by_head_count) + " generations" ^0
"" ^0

# ---- what the manager verified ----

"the head-count reasoning" ^0
"  count : " + str(animals) + " animals, accurate" ^0
"  breeding : every female breeds" ^0
"  the figure quoted : a few hundred is enough" ^0
"  intent : is the herd keeping its genetic variety" ^0
"  facts wrong : 0" ^0
"  verdict : " + str(animals) + " ANIMALS IS GENETICALLY SAFE" ^0
"" ^0
"  counting the herd accurately is the part done right here, and" ^0
"  it is why " + str(animals) + " is exactly how many animals the reserve holds" ^0
"" ^0

# ---- how fast variety drifts away ----

"who passes genes on" ^0
"  what sets the pace of drift : the number of parents genes pass" ^0
"    through, weighted so that the rarer sex counts most" ^0
"  here : half of every young animal's genes come from one of " + str(breeding_males) ^0
"    males, so the males are the narrow door" ^0
"  the effective size : four times males times females over their" ^0
"    sum, " + str(effective_size_tenths) + " tenths - a herd of " + str(animals) + " drifting like " + str(effective_size) ^0
"  the loss : " + str(variety_lost_per_generation_per_myriad) + " parts in ten thousand a generation, a quarter" ^0
"    of all its variety in " + str(generations_to_lose_a_quarter) + " generations" ^0
"  the figure quoted : an effective size, not a head count" ^0
"" ^0

# ---- what the manager got ----

"the herd" ^0
"  believed : " + str(animals) + " animals, safe" ^0
"  actual : breeding like " + str(effective_size) + ", losing variety " + str(variety_lost_per_generation_per_myriad) + " parts in ten" ^0
"    thousand a generation" ^0
"  is the count wrong : no" ^0
"  is a head count a genetic size : no; the genes pass through" ^0
"    only the animals that breed, and here mostly through " + str(breeding_males) ^0
"" ^0

# ---- null control ----

# The same herd sized by the parents its genes pass through instead of by its
# head count.
1000 => nc_genetic_size_read_from_the_head_count
39 => nc_genetic_size_read_from_the_breeding_sexes
961 => nc_animals_the_breeding_pattern_removes

"null control - size the herd by its parents" ^0
"  genetic size, read from the head count : " + str(nc_genetic_size_read_from_the_head_count) ^0
"  genetic size, read from the breeding sexes : " + str(nc_genetic_size_read_from_the_breeding_sexes) ^0
"  animals the breeding pattern removes : " + str(nc_animals_the_breeding_pattern_removes) ^0
"  no animal was counted differently; the size was taken where" ^0
"  the genes actually pass" ^0
"" ^0

# ---- the rule ----

"what an accurate count of " + str(animals) + " animals guarantees" ^0
"  the reserve holds " + str(animals) + " animals : exactly" ^0
"  the herd keeps its variety like a population of " + str(animals) + " : not addressed;" ^0
"    with " + str(breeding_males) + " breeding males the effective size is " + str(effective_size_tenths) + " tenths," ^0
"    and a quarter of the variety is gone in " + str(generations_to_lose_a_quarter) + " generations, not " + str(generations_to_lose_a_quarter_by_head_count) ^0
"" ^0

"a herd's genes do not count heads; they count parents, and a population is" ^0
"as narrow as the narrowest door its genes must pass through" ^0
"" ^0

"The reserve holds " + str(animals) + " animals - the count is right. But every young one has a" ^0
"father among " + str(breeding_males) + " males, so the herd's effective size is " + str(effective_size_tenths) + " tenths: it" ^0
"loses variety like " + str(effective_size) + " animals, a quarter of it in " + str(generations_to_lose_a_quarter) + " generations instead" ^0
"of " + str(generations_to_lose_a_quarter_by_head_count) + ", until the herd is sized by its parents rather than its head count." ^0
```

## Python (deterministic transpilation)

```python
animals = 1000
breeding_males = 10
breeding_females = 990
natural_log_of_four_thirds_per_myriad = 2877
effective_size_tenths = int(4 * breeding_males * breeding_females * 10 / (breeding_males + breeding_females))
effective_size = int(effective_size_tenths / 10)
variety_lost_per_generation_per_myriad = int(10000 * 10 / (2 * effective_size_tenths))
variety_lost_per_generation_by_head_count_per_myriad = int(10000 / (2 * animals))
generations_to_lose_a_quarter = int(natural_log_of_four_thirds_per_myriad * 2 * effective_size_tenths / (10000 * 10))
generations_to_lose_a_quarter_by_head_count = int(natural_log_of_four_thirds_per_myriad * 2 * animals / 10000)
effective_size_vs_head_count_per_mille = int(effective_size_tenths * 1000 / (animals * 10))
print("animals                         : " + str(animals))
print("breeding this season            : " + str(breeding_males) + " males, " + str(breeding_females) + " females")
print("effective size                  : " + str(effective_size_tenths) + " tenths, a population of " + str(effective_size))
print("effective size vs head count    : " + str(effective_size_vs_head_count_per_mille) + " per mille")
print("")
print("variety lost a generation       : " + str(variety_lost_per_generation_per_myriad) + " per ten thousand")
print("  if the head count set it      : " + str(variety_lost_per_generation_by_head_count_per_myriad) + " per ten thousand")
print("a quarter of the variety gone   : in " + str(generations_to_lose_a_quarter) + " generations")
print("  if the head count set it      : in " + str(generations_to_lose_a_quarter_by_head_count) + " generations")
print("")
print("the head-count reasoning")
print("  count : " + str(animals) + " animals, accurate")
print("  breeding : every female breeds")
print("  the figure quoted : a few hundred is enough")
print("  intent : is the herd keeping its genetic variety")
print("  facts wrong : 0")
print("  verdict : " + str(animals) + " ANIMALS IS GENETICALLY SAFE")
print("")
print("  counting the herd accurately is the part done right here, and")
print("  it is why " + str(animals) + " is exactly how many animals the reserve holds")
print("")
print("who passes genes on")
print("  what sets the pace of drift : the number of parents genes pass")
print("    through, weighted so that the rarer sex counts most")
print("  here : half of every young animal's genes come from one of " + str(breeding_males))
print("    males, so the males are the narrow door")
print("  the effective size : four times males times females over their")
print("    sum, " + str(effective_size_tenths) + " tenths - a herd of " + str(animals) + " drifting like " + str(effective_size))
print("  the loss : " + str(variety_lost_per_generation_per_myriad) + " parts in ten thousand a generation, a quarter")
print("    of all its variety in " + str(generations_to_lose_a_quarter) + " generations")
print("  the figure quoted : an effective size, not a head count")
print("")
print("the herd")
print("  believed : " + str(animals) + " animals, safe")
print("  actual : breeding like " + str(effective_size) + ", losing variety " + str(variety_lost_per_generation_per_myriad) + " parts in ten")
print("    thousand a generation")
print("  is the count wrong : no")
print("  is a head count a genetic size : no; the genes pass through")
print("    only the animals that breed, and here mostly through " + str(breeding_males))
print("")
nc_genetic_size_read_from_the_head_count = 1000
nc_genetic_size_read_from_the_breeding_sexes = 39
nc_animals_the_breeding_pattern_removes = 961
print("null control - size the herd by its parents")
print("  genetic size, read from the head count : " + str(nc_genetic_size_read_from_the_head_count))
print("  genetic size, read from the breeding sexes : " + str(nc_genetic_size_read_from_the_breeding_sexes))
print("  animals the breeding pattern removes : " + str(nc_animals_the_breeding_pattern_removes))
print("  no animal was counted differently; the size was taken where")
print("  the genes actually pass")
print("")
print("what an accurate count of " + str(animals) + " animals guarantees")
print("  the reserve holds " + str(animals) + " animals : exactly")
print("  the herd keeps its variety like a population of " + str(animals) + " : not addressed;")
print("    with " + str(breeding_males) + " breeding males the effective size is " + str(effective_size_tenths) + " tenths,")
print("    and a quarter of the variety is gone in " + str(generations_to_lose_a_quarter) + " generations, not " + str(generations_to_lose_a_quarter_by_head_count))
print("")
print("a herd's genes do not count heads; they count parents, and a population is")
print("as narrow as the narrowest door its genes must pass through")
print("")
print("The reserve holds " + str(animals) + " animals - the count is right. But every young one has a")
print("father among " + str(breeding_males) + " males, so the herd's effective size is " + str(effective_size_tenths) + " tenths: it")
print("loses variety like " + str(effective_size) + " animals, a quarter of it in " + str(generations_to_lose_a_quarter) + " generations instead")
print("of " + str(generations_to_lose_a_quarter_by_head_count) + ", until the herd is sized by its parents rather than its head count.")
```

## stdout (executed)

```text
animals                         : 1000
breeding this season            : 10 males, 990 females
effective size                  : 396 tenths, a population of 39
effective size vs head count    : 39 per mille

variety lost a generation       : 126 per ten thousand
  if the head count set it      : 5 per ten thousand
a quarter of the variety gone   : in 22 generations
  if the head count set it      : in 575 generations

the head-count reasoning
  count : 1000 animals, accurate
  breeding : every female breeds
  the figure quoted : a few hundred is enough
  intent : is the herd keeping its genetic variety
  facts wrong : 0
  verdict : 1000 ANIMALS IS GENETICALLY SAFE

  counting the herd accurately is the part done right here, and
  it is why 1000 is exactly how many animals the reserve holds

who passes genes on
  what sets the pace of drift : the number of parents genes pass
    through, weighted so that the rarer sex counts most
  here : half of every young animal's genes come from one of 10
    males, so the males are the narrow door
  the effective size : four times males times females over their
    sum, 396 tenths - a herd of 1000 drifting like 39
  the loss : 126 parts in ten thousand a generation, a quarter
    of all its variety in 22 generations
  the figure quoted : an effective size, not a head count

the herd
  believed : 1000 animals, safe
  actual : breeding like 39, losing variety 126 parts in ten
    thousand a generation
  is the count wrong : no
  is a head count a genetic size : no; the genes pass through
    only the animals that breed, and here mostly through 10

null control - size the herd by its parents
  genetic size, read from the head count : 1000
  genetic size, read from the breeding sexes : 39
  animals the breeding pattern removes : 961
  no animal was counted differently; the size was taken where
  the genes actually pass

what an accurate count of 1000 animals guarantees
  the reserve holds 1000 animals : exactly
  the herd keeps its variety like a population of 1000 : not addressed;
    with 10 breeding males the effective size is 396 tenths,
    and a quarter of the variety is gone in 22 generations, not 575

a herd's genes do not count heads; they count parents, and a population is
as narrow as the narrowest door its genes must pass through

The reserve holds 1000 animals - the count is right. But every young one has a
father among 10 males, so the herd's effective size is 396 tenths: it
loses variety like 39 animals, a quarter of it in 22 generations instead
of 575, until the herd is sized by its parents rather than its head count.
```

## Round-trip

`ok: true` — round-trip fixpoint reached (python1 == python2)

## Trace event types

eml:run:start · eml:assign · eml:output · eml:run:done
