Home /Modules/boolean/BooleanWord16.sleela

BooleanWord16.sleela

lib/boolean/16/BooleanWord16.sleela · 89 line(s) · sleela

<< lib/boolean/16/BooleanWord16.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines BooleanWord16, the generative factory for all 65536 depth-16 Boolean/Binary words. Full materialization of every combination as a file is impractical at this depth; this factory models any such word by its HEAD (result) and CARRY (caveat) composition, which is validated and read on demand. >>
#sleela 2.5
material;
< SLeeLa boolean/16 generative word factory. >
< All 65536 combinations of BOOLEAN.TRUE / BOOLEAN.FALSE at depth 16 >
< are modeled by this type rather than materialized as 65536 separate files. >
< A word is summarized by its HEAD syllable (the RESULT) and the composition of >
< its CARRY (the caveat structure): how many carried syllables are TRUE and how >
< many are FALSE. A FALSE carried behind the head raises a caveat to observe. >
class BooleanWord16 {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10830;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < 1 = TRUE result, 0 = FALSE result >
  int headBit;
  < number of carried TRUE syllables >
  int carryTrue;
  < number of carried FALSE syllables >
  int carryFalse;
  < Configure one word of this depth: the head result and the carry makeup. >
  void configure(int head, int cTrue, int cFalse) {
    headBit = head; carryTrue = cTrue; carryFalse = cFalse;
  }
  int depth() { return 16; }
  int carryDepth() { return 15; }
  < Valid when the head bit is 0/1 and the carry syllables fill the carry slots. >
  boolean valid() {
    return (headBit == 0 || headBit == 1)
        && carryTrue >= 0 && carryFalse >= 0
        && carryTrue + carryFalse == 15;
  }
  < Head syllable = the asserted result. >
  boolean head() { return headBit == 1; }
  String headSyllable() { return headBit == 1 ? "TRUE" : "FALSE"; }
  < A caveat exists when any carried syllable is FALSE. >
  boolean caveat() { return carryFalse > 0; }
  < Agreement: the word is uniform (carry entirely matches the head). >
  boolean agrees() {
    return (headBit == 1 && carryFalse == 0) || (headBit == 0 && carryTrue == 0);
  }
  int trueCount() { return carryTrue + (headBit == 1 ? 1 : 0); }
  int falseCount() { return carryFalse + (headBit == 0 ? 1 : 0); }
  < Dotted label for the result and the caveat posture. >
  String describe() {
    return "BOOLEAN." + headSyllable()
         + (caveat() ? " +carry-caveat" : " +clean");
  }
}