Home /Modules/sldocument/SLVeritable.sleela

SLVeritable.sleela

lib/sldocument/SLVeritable.sleela · 109 line(s) · sleela

<< lib/sldocument/SLVeritable.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLVeritable, the single binary value an .sldocument step
     usually returns — a verified truth that is "veritable and kind".
   
   An .sldocument runs top-down, and each ordered step generally returns one
     binary item. That item is modeled here as a two-fold judgement:
       - veritable: the step's result is true / holds (the binary truth), AND
       - kind:      the result is well-formed and benign — the right *kind* of
                    value, not a malformed or hostile one.
     Both must hold for the value to be "sound". A step that produces a true but
     ill-formed result is veritable-but-not-kind, and the document does not treat
     it as a clean pass.
   
   Family: sldocument. Native VM/OS work crosses an explicit bridge. >>
#sleela 2.5
material;
< Unified SLeeLa standard-library front-end object. >
class SLVeritable {
  < ---- 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 = 10196;
  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-05";
  < 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; }
  < the binary truth: did the step hold? >
  boolean veritable;
  < is the result well-formed and benign? >
  boolean kind;
  < the symbol this value answers for >
  String label;
  int state;

  < The two canonical constructions. >
  void affirm(String forSymbol) { veritable = true;  kind = true;  label = forSymbol; state = 1; }
  void deny(String forSymbol)   { veritable = false; kind = true;  label = forSymbol; state = 1; }

  < General construction from an explicit pair. >
  void configure(boolean isVeritable, boolean isKind, String forSymbol) {
    veritable = isVeritable;
    kind = isKind;
    label = forSymbol;
    state = 1;
  }

  boolean active() { return state == 1; }
  boolean isVeritable() { return veritable; }
  boolean isKind() { return kind; }
  String symbol() { return label; }

  < Sound == veritable AND kind: a true result of the right kind. >
  boolean sound() { return state == 1 && veritable && kind; }

  < The binary item itself, as a single bit (1 = veritable, 0 = not), which is >
  < what the step hands back by default. >
  int bit() { return veritable ? 1 : 0; }

  < Logical composition, preserving kindness: an unkind operand makes the >
  < result unkind, so faults propagate rather than hide. >
  SLVeritable and(SLVeritable other) {
    SLVeritable r = new SLVeritable();
    if (other == null) { r.configure(false, false, label); return r; }
    r.configure(veritable && other.isVeritable(), kind && other.isKind(), label);
    return r;
  }

  SLVeritable or(SLVeritable other) {
    SLVeritable r = new SLVeritable();
    if (other == null) { r.configure(veritable, kind, label); return r; }
    r.configure(veritable || other.isVeritable(), kind && other.isKind(), label);
    return r;
  }
}