moving to a SRM implementation more faithful to the C model
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Sat, 4 Jan 2025 10:20:09 +0000 (10:20 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Sat, 4 Jan 2025 10:20:09 +0000 (10:20 +0000)
32 files changed:
developer/documentđź–‰/Step_Right_Machine.txt
developer/example/CountingNumber$State.class [new file with mode: 0644]
developer/example/CountingNumber$State_InfiniteRight.class [new file with mode: 0644]
developer/example/CountingNumber$State_InterimSegment.class [new file with mode: 0644]
developer/example/CountingNumber$State_Leftmost.class [new file with mode: 0644]
developer/example/CountingNumber$State_Rightmost.class [new file with mode: 0644]
developer/example/CountingNumber.class
developer/example/CountingNumber.java
developer/example/Example_* [new file with mode: 0755]
developer/example/Example_CountingNumber [deleted file]
developer/example/Example_CountingNumber.class [deleted file]
developer/example/Example_CountingNumber.java [deleted file]
developer/example/Example_CountingNumber_0.java [new file with mode: 0644]
developer/example/Example_IndexTree_Diagonal_SRM.java [new file with mode: 0644]
developer/example/Example_SRMI_Array [deleted file]
developer/example/Example_SRMI_Array.class [deleted file]
developer/example/Example_SRMI_Array.java
developer/example/Example_SRM_List [deleted file]
developer/example/Example_SRM_List.class [deleted file]
developer/example/Example_SRM_List.java
developer/example/IndexTree_Diagonal_SRM.java [new file with mode: 0644]
developer/example/hold/CountingNumber.java [new file with mode: 0644]
developer/example/hold/Example_IndexTree_0.class [deleted file]
developer/example/hold/Example_IndexTree_Diagonal_SRM.class [deleted file]
developer/example/hold/Example_IndexTree_Diagonal_SRM.java [deleted file]
developer/example/hold/IndexTree_Diagonal_SRM.java [deleted file]
developer/javacđź–‰/#Ariadne_LockManager.java# [deleted file]
developer/javacđź–‰/#Ariadne_Node.xjava# [deleted file]
developer/javacđź–‰/Ariadne_IndexTree_Child_SRM.java
developer/javacđź–‰/Ariadne_SRM.java
developer/javacđź–‰/Ariadne_SRMI_Array.java
developer/javacđź–‰/Ariadne_SRM_List.java

index cee6bef..d602f9b 100644 (file)
@@ -48,3 +48,9 @@ The SRM methods (mount, dismount, lenient_mount, lenient_dismount) simply delega
 Relinquishing Locks Last:
 
 By ensuring that relinquish is the last step in dismount and other relevant methods, we prevent premature lock release before operations are complete.
+
+----
+
+a SRM with a function implementation represents an evolving system, it is common that information is lost for reversing a forward step in an evolving system, so it is natural in function based programming to have a tape machine that only steps right.
+
+Still a Turing Machine can step left, and there are computation complexity implications. Some of these can be mitigated by having a context window, and thus tentative forward evolution of the system.
diff --git a/developer/example/CountingNumber$State.class b/developer/example/CountingNumber$State.class
new file mode 100644 (file)
index 0000000..a34a9fc
Binary files /dev/null and b/developer/example/CountingNumber$State.class differ
diff --git a/developer/example/CountingNumber$State_InfiniteRight.class b/developer/example/CountingNumber$State_InfiniteRight.class
new file mode 100644 (file)
index 0000000..8e706ff
Binary files /dev/null and b/developer/example/CountingNumber$State_InfiniteRight.class differ
diff --git a/developer/example/CountingNumber$State_InterimSegment.class b/developer/example/CountingNumber$State_InterimSegment.class
new file mode 100644 (file)
index 0000000..13e4d7e
Binary files /dev/null and b/developer/example/CountingNumber$State_InterimSegment.class differ
diff --git a/developer/example/CountingNumber$State_Leftmost.class b/developer/example/CountingNumber$State_Leftmost.class
new file mode 100644 (file)
index 0000000..e2283d6
Binary files /dev/null and b/developer/example/CountingNumber$State_Leftmost.class differ
diff --git a/developer/example/CountingNumber$State_Rightmost.class b/developer/example/CountingNumber$State_Rightmost.class
new file mode 100644 (file)
index 0000000..ae86555
Binary files /dev/null and b/developer/example/CountingNumber$State_Rightmost.class differ
index 2df2a30..9cc87ce 100644 (file)
Binary files a/developer/example/CountingNumber.class and b/developer/example/CountingNumber.class differ
index 0e000ec..adedfc5 100644 (file)
-import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
-import com.ReasoningTechnology.Ariadne.Ariadne_Test;
 import java.math.BigInteger;
 
-public class CountingNumber extends Ariadne_SRM<BigInteger>{
+public class CountingNumber {
 
-  private static final Ariadne_Test test = Ariadne_Test.make("Ariadne_SRM<BigInteger>::");
+  private BigInteger i;
+  private BigInteger maximum;
+  private State current_state;
+
+  public static CountingNumber make( BigInteger maximum ){
+    return new CountingNumber( maximum );
+  }
 
   public static CountingNumber make(){
-    return new CountingNumber(null);
+    return new CountingNumber( null );
   }
-  public static CountingNumber make(BigInteger maximum){
-    return new CountingNumber(maximum);
+
+  private CountingNumber( BigInteger maximum ){
+    this.i = BigInteger.ONE;
+    this.maximum = maximum;
+    this.current_state = ( maximum == null ) ? new State_InfiniteRight() : new State_Leftmost();
   }
 
-  private BigInteger i;
-  private BigInteger maximum;
-  Ariadne_SRM.Location location;
+  private void set_state( State new_state ){
+    this.current_state = new_state;
+  }
 
-  protected CountingNumber(BigInteger maximum){
-    i = BigInteger.ONE;
-    this.maximum = maximum;
-    this.location = Location.LEFTMOST;
-    test.print("CountingNumber read() value initialized to: " + i);
+  public boolean can_read(){
+    return current_state.can_read();
   }
 
-  @Override
-  public Topology topology(){
-    if(maximum == null) return Topology.INFINITE_RIGHT;
-    return Topology.SEGMENT;
+  public boolean can_step(){
+    return current_state.can_step();
   }
 
-  @Override
-  public Location location(){
-    return location;
+  public void step(){
+    current_state.step();
   }
-  
-  @Override
+
   public BigInteger read(){
-    return i;  // note that BigInteger is immutable
+    return i;
   }
 
-  @Override
-  public void step(){
-    super.step();
-    i = i.add(BigInteger.ONE);
-
-    if(topology() == Topology.SEGMENT){
-      if(i.compareTo(maximum) == 0){
-        location = Location.RIGHTMOST;
-      }else if(location() == Location.LEFTMOST){
-        location = Location.INTERIM;
+  // --- State Interface ---
+  private abstract class State {
+    abstract boolean can_read();
+    abstract boolean can_step();
+    abstract void step();
+  }
+
+  // --- State_Leftmost ---
+  private class State_Leftmost extends State {
+    @Override
+    boolean can_read(){
+      return true;
+    }
+
+    @Override
+    boolean can_step(){
+      return true;
+    }
+
+    @Override
+    void step(){
+      i = i.add( BigInteger.ONE );
+      if( i.equals( maximum ) ){
+        set_state( new State_Rightmost() );
+      }else{
+        set_state( new State_InterimSegment() );
       }
     }
-      
-    test.print(" after step, new read() value: " + i);
   }
 
-}
+  // --- State_InterimSegment ---
+  private class State_InterimSegment extends State {
+    @Override
+    boolean can_read(){
+      return true;
+    }
 
+    @Override
+    boolean can_step(){
+      return true;
+    }
+
+    @Override
+    void step(){
+      i = i.add( BigInteger.ONE );
+      if( i.equals( maximum ) ){
+        set_state( new State_Rightmost() );
+      }
+    }
+  }
+
+  // --- State_InfiniteRight ---
+  private class State_InfiniteRight extends State {
+    @Override
+    boolean can_read(){
+      return true;
+    }
+
+    @Override
+    boolean can_step(){
+      return true;
+    }
+
+    @Override
+    void step(){
+      i = i.add( BigInteger.ONE );
+    }
+  }
+
+  // --- State_Rightmost ---
+  private class State_Rightmost extends State {
+    @Override
+    boolean can_read(){
+      return true;
+    }
+
+    @Override
+    boolean can_step(){
+      return false;
+    }
+
+    @Override
+    void step(){
+      throw new UnsupportedOperationException( "Cannot step from RIGHTMOST." );
+    }
+  }
+}
diff --git a/developer/example/Example_* b/developer/example/Example_*
new file mode 100755 (executable)
index 0000000..3c6f542
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+java Example_*
diff --git a/developer/example/Example_CountingNumber b/developer/example/Example_CountingNumber
deleted file mode 100755 (executable)
index 624ad06..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_CountingNumber
diff --git a/developer/example/Example_CountingNumber.class b/developer/example/Example_CountingNumber.class
deleted file mode 100644 (file)
index aee2ee4..0000000
Binary files a/developer/example/Example_CountingNumber.class and /dev/null differ
diff --git a/developer/example/Example_CountingNumber.java b/developer/example/Example_CountingNumber.java
deleted file mode 100644 (file)
index 3ff0f70..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Donald Knuth pointed out in the Art of Computer Programming, that there
-is a mid-test loop missing from most languages. The mid-test loop works
-well with inclusive bound loops, as is needed with the SRM.
-
-*/
-import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
-import java.math.BigInteger;
-
-public class Example_CountingNumber{
-
-  protected static void print_ten(CountingNumber n){
-    System.out.println("Iterating through Counting Numbers:");
-    if( !n.can_read() ) return;
-    if(n.topology() == Ariadne_SRM.Topology.SEGMENT){
-
-      do{
-        System.out.println("Current Number: " + n.read());
-        if( n.location() ==  Ariadne_SRM.Location.RIGHTMOST ) break;
-        n.step();
-      }while(true);
-
-    }else if(n.topology() == Ariadne_SRM.Topology.INFINITE_RIGHT){
-
-      int i = 1;
-      do{
-        System.out.println("Current Number: " + n.read());
-        if( i == 10 ) break;
-        n.step();
-        i++;
-      }while(true);
-
-    } else {
-      System.out.println("Unrecognized tape topology.");
-    }
-  }
-
-  public static void main(String[] args){
-    print_ten(CountingNumber.make(BigInteger.TEN));
-    print_ten(CountingNumber.make());
-
-  }
-}
diff --git a/developer/example/Example_CountingNumber_0.java b/developer/example/Example_CountingNumber_0.java
new file mode 100644 (file)
index 0000000..95a1fd7
--- /dev/null
@@ -0,0 +1,37 @@
+import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
+import java.math.BigInteger;
+
+public class Example_CountingNumber_0 {
+
+  protected static void print_ten(CountingNumber n) {
+    System.out.println("Iterating through Counting Numbers:");
+    if (!n.can_read()) return;
+
+    if (n.topology() == Ariadne_SRM.Topology.SEGMENT) {
+      if (n.can_read()) {
+        do {
+          System.out.println("Current Number: " + n.read());
+          if (!n.can_step()) break;
+          n.step();
+        } while (true);
+      }
+    } else if (n.topology() == Ariadne_SRM.Topology.INFINITE_RIGHT) {
+      int i = 1;
+      if (n.can_read()) {
+        do {
+          System.out.println("Current Number: " + n.read());
+          if (i == 10) break;
+          n.step();
+          i++;
+        } while (true);
+      }
+    } else {
+      System.out.println("Unrecognized tape topology.");
+    }
+  }
+
+  public static void main(String[] args) {
+    print_ten(CountingNumber.make(BigInteger.TEN));
+    print_ten(CountingNumber.make());
+  }
+}
diff --git a/developer/example/Example_IndexTree_Diagonal_SRM.java b/developer/example/Example_IndexTree_Diagonal_SRM.java
new file mode 100644 (file)
index 0000000..746735a
--- /dev/null
@@ -0,0 +1,39 @@
+import java.math.BigInteger;
+import java.util.Queue;
+
+public class Example_IndexTree_Diagonal_SRM {
+
+  public static void main(String[] args){
+    System.out.println("Starting IndexTree SRM Example");
+
+    // Instantiate the IndexTree Diagonal SRM
+    IndexTree_Diagonal_SRM srm = IndexTree_Diagonal_SRM.make();
+
+    int step_count = 0;
+    do{
+      System.out.println("Step " + (step_count + 1) + ":");
+      /*
+      Queue<BigInteger[]> read_list = srm.read();
+      if(!read_list.isEmpty()){
+        for(BigInteger[] label : read_list){
+          System.out.println("  Node Label: " + format_label(label));
+        }
+      }
+      */
+      if(step_count == 3) break; // Mid-loop test for inclusive bounds
+      step_count++;
+      srm.step();
+    }while(true);
+  }
+
+  private static String format_label(BigInteger[] label){
+    if(label.length == 0) return "[]";
+    StringBuilder formatted = new StringBuilder("[");
+    for(int i = 0; i < label.length; i++){
+      formatted.append(label[i].toString());
+      if(i < label.length - 1) formatted.append(" ,");
+    }
+    formatted.append("]");
+    return formatted.toString();
+  }
+}
diff --git a/developer/example/Example_SRMI_Array b/developer/example/Example_SRMI_Array
deleted file mode 100755 (executable)
index 80c5dbd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_SRMI_Array
diff --git a/developer/example/Example_SRMI_Array.class b/developer/example/Example_SRMI_Array.class
deleted file mode 100644 (file)
index 4917a44..0000000
Binary files a/developer/example/Example_SRMI_Array.class and /dev/null differ
index 9f1f6cf..818a72f 100644 (file)
@@ -5,9 +5,7 @@ import java.util.Arrays;
 import java.util.List;
 
 public class Example_SRMI_Array {
-  public static void main( String[] args ) {
-  /*
-
+  public static void main( String[] args ){
     // Create a list
     List<String> label_list = Arrays.asList( "A" ,"B" ,"C" ,"D" );
 
@@ -19,15 +17,13 @@ public class Example_SRMI_Array {
     System.out.println( "Location: " + srm.location() );
 
     // Traverse the list
-    while( srm.location() != Ariadne_SRM.Location.RIGHTMOST ) {
-      System.out.println( "Reading: " + srm.read() );
+    while( srm.location() != Ariadne_SRM.Location.RIGHTMOST ){
+      System.out.println( "Reading: " + srm.access() );
       srm.step();
     }
 
     // Final item
-    System.out.println( "Reading: " + srm.read() );
+    System.out.println( "Reading: " + srm.access() );
     System.out.println( "Location: " + srm.location() );
-
-  */
   }
 }
diff --git a/developer/example/Example_SRM_List b/developer/example/Example_SRM_List
deleted file mode 100755 (executable)
index e0d48dd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_SRM_List
diff --git a/developer/example/Example_SRM_List.class b/developer/example/Example_SRM_List.class
deleted file mode 100644 (file)
index abd61ea..0000000
Binary files a/developer/example/Example_SRM_List.class and /dev/null differ
index 486db68..4aa315a 100644 (file)
@@ -20,16 +20,16 @@ public class Example_SRM_List {
 
     // Traverse the list
     while( srm.location() != Ariadne_SRM.Location.RIGHTMOST ){
-      System.out.println("Reading: " + srm.read());
+      System.out.println("Reading: " + srm.access());
       srm.step();
     }
 
     // Final item
-    System.out.println(" Reading: " + srm.read() );
+    System.out.println(" Reading: " + srm.access() );
     System.out.println(" Final Location: " + srm.location() );
 
-    // Reset the SRM and traverse again
-    srm.reset();
-    System.out.println( "After reset: " + srm.read() );
+    // Rewind the SRM and traverse again
+    srm.rewind();
+    System.out.println( "After rewind: " + srm.access() );
   }
 }
diff --git a/developer/example/IndexTree_Diagonal_SRM.java b/developer/example/IndexTree_Diagonal_SRM.java
new file mode 100644 (file)
index 0000000..b3fb2b7
--- /dev/null
@@ -0,0 +1,106 @@
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import com.ReasoningTechnology.Ariadne.Ariadne_Test;
+import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
+import com.ReasoningTechnology.Ariadne.Ariadne_IndexTree_Node;
+
+public class IndexTree_Diagonal_SRM extends Ariadne_SRM<List<BigInteger[]>> {
+
+  private final List<BigInteger[]> list_of__unopened_node;
+  private final List<List<BigInteger[]>> list_of__opened_incomplete_child_list;
+  private final List<BigInteger[]> read_list;
+  private final Ariadne_Test tester;
+
+  public static IndexTree_Diagonal_SRM make() {
+    return new IndexTree_Diagonal_SRM();
+  }
+
+  protected IndexTree_Diagonal_SRM() {
+    this.list_of__unopened_node = new ArrayList<>();
+    this.list_of__opened_incomplete_child_list = new ArrayList<>();
+    this.read_list = new ArrayList<>();
+    this.tester = Ariadne_Test.make("IndexTree_Diagonal_SRM: ");
+    enqueue_root();
+  }
+
+  @Override
+  public List<BigInteger[]> access() {
+    return read_list;
+  }
+
+  @Override
+  public void step() {
+    read_list.clear();
+
+    while (!list_of__unopened_node.isEmpty()) {
+      BigInteger[] label = list_of__unopened_node.remove(0);
+
+      // Retrieve the node using lookup
+      Ariadne_IndexTree_Node node = lookup(label);
+
+      // Descend by getting neighbors
+      List<BigInteger[]> child_labels = fetch_child_labels(node);
+      if (!child_labels.isEmpty()) {
+        list_of__opened_incomplete_child_list.add(child_labels);
+      }
+    }
+
+    while (!list_of__opened_incomplete_child_list.isEmpty()) {
+      List<BigInteger[]> child_labels = list_of__opened_incomplete_child_list.remove(0);
+      if (!child_labels.isEmpty()) {
+        BigInteger[] label = child_labels.remove(0);
+        read_list.add(label);
+
+        tester.print("Queued label: " + format_label(label));
+
+        // Retrieve node and check its neighbors
+        Ariadne_IndexTree_Node node = lookup(label);
+        if (!fetch_child_labels(node).isEmpty()) {
+          list_of__unopened_node.add(label);
+        }
+      }
+    }
+  }
+
+  private void enqueue_root() {
+    BigInteger[] root_label = new BigInteger[0];
+    read_list.add(root_label);
+
+    tester.print("Queued root label: " + format_label(root_label));
+
+    Ariadne_IndexTree_Node root_node = lookup(root_label);
+    if (!fetch_child_labels(root_node).isEmpty()) {
+      list_of__unopened_node.add(root_label);
+    }
+  }
+
+  private Ariadne_IndexTree_Node lookup(BigInteger[] label) {
+    // Perform a lookup to retrieve the node corresponding to the label
+    return Ariadne_IndexTree_Node.make(label);
+  }
+
+  private List<BigInteger[]> fetch_child_labels(Ariadne_IndexTree_Node node) {
+    List<BigInteger[]> child_labels = new ArrayList<>();
+
+    if (node != null) {
+      Ariadne_SRM<BigInteger[]> neighbor_srm = node.neighbor();
+      while (neighbor_srm.can_step()) {
+        child_labels.add(neighbor_srm.read());
+        neighbor_srm.step();
+      }
+    }
+
+    return child_labels;
+  }
+
+  private String format_label(BigInteger[] label) {
+    StringBuilder formatted = new StringBuilder("[");
+    for (int i = 0; i < label.length; i++) {
+      formatted.append(label[i].toString());
+      if (i < label.length - 1) formatted.append(",");
+    }
+    formatted.append("]");
+    return formatted.toString();
+  }
+}
diff --git a/developer/example/hold/CountingNumber.java b/developer/example/hold/CountingNumber.java
new file mode 100644 (file)
index 0000000..f4f41cf
--- /dev/null
@@ -0,0 +1,79 @@
+import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
+import com.ReasoningTechnology.Ariadne.Ariadne_Test;
+import java.math.BigInteger;
+
+public class CountingNumber extends Ariadne_SRM<BigInteger> {
+
+  private static final Ariadne_Test test = Ariadne_Test.make( "Ariadne_SRM<BigInteger>::" );
+
+  public static CountingNumber make(){
+    return new CountingNumber( null );
+  }
+
+  public static CountingNumber make( BigInteger maximum ){
+    return new CountingNumber( maximum );
+  }
+
+  private final Topology _topology;
+  private BigInteger i;
+  private BigInteger maximum;
+  private Location location;
+  private Runnable step_behavior;
+
+  protected CountingNumber( BigInteger maximum ){
+    this.maximum = maximum;
+    this.i = BigInteger.ONE;
+    this.location = Location.LEFTMOST;
+
+    if( maximum == null ){
+      _topology = Topology.INFINITE_RIGHT;
+      step_behavior = this::step_infinite_right;
+    } else {
+      _topology = Topology.SEGMENT;
+      step_behavior = this::step_segment;
+    }
+
+    test.print( "CountingNumber initialized with topology: " + _topology + ", initial value: " + i );
+  }
+
+  @Override
+  public Topology topology(){
+    return _topology;
+  }
+
+  @Override
+  public Location location(){
+    return location;
+  }
+
+  @Override
+  public BigInteger read(){
+    return i;
+  }
+
+  @Override
+  public void step(){
+    step_behavior.run();
+  }
+
+  private void step_segment(){
+    i = i.add( BigInteger.ONE );
+    if( i.equals( maximum ) ){
+      location = Location.RIGHTMOST;
+      step_behavior = this::step_from_rightmost;
+    }else if( location == Location.LEFTMOST ){
+      location = Location.INTERIM;
+    }
+    test.print( " after step_segment, new read() value: " + i );
+  }
+
+  private void step_infinite_right(){
+    i = i.add( BigInteger.ONE );
+    test.print( " after step_infinite_right, new read() value: " + i );
+  }
+
+  private void step_from_rightmost(){
+    throw new UnsupportedOperationException( "CountingNumber::step can not step from RIGHTMOST." );
+  }
+
+}
diff --git a/developer/example/hold/Example_IndexTree_0.class b/developer/example/hold/Example_IndexTree_0.class
deleted file mode 100644 (file)
index 1aa7f73..0000000
Binary files a/developer/example/hold/Example_IndexTree_0.class and /dev/null differ
diff --git a/developer/example/hold/Example_IndexTree_Diagonal_SRM.class b/developer/example/hold/Example_IndexTree_Diagonal_SRM.class
deleted file mode 100644 (file)
index 7f9b08e..0000000
Binary files a/developer/example/hold/Example_IndexTree_Diagonal_SRM.class and /dev/null differ
diff --git a/developer/example/hold/Example_IndexTree_Diagonal_SRM.java b/developer/example/hold/Example_IndexTree_Diagonal_SRM.java
deleted file mode 100644 (file)
index 746735a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-import java.math.BigInteger;
-import java.util.Queue;
-
-public class Example_IndexTree_Diagonal_SRM {
-
-  public static void main(String[] args){
-    System.out.println("Starting IndexTree SRM Example");
-
-    // Instantiate the IndexTree Diagonal SRM
-    IndexTree_Diagonal_SRM srm = IndexTree_Diagonal_SRM.make();
-
-    int step_count = 0;
-    do{
-      System.out.println("Step " + (step_count + 1) + ":");
-      /*
-      Queue<BigInteger[]> read_list = srm.read();
-      if(!read_list.isEmpty()){
-        for(BigInteger[] label : read_list){
-          System.out.println("  Node Label: " + format_label(label));
-        }
-      }
-      */
-      if(step_count == 3) break; // Mid-loop test for inclusive bounds
-      step_count++;
-      srm.step();
-    }while(true);
-  }
-
-  private static String format_label(BigInteger[] label){
-    if(label.length == 0) return "[]";
-    StringBuilder formatted = new StringBuilder("[");
-    for(int i = 0; i < label.length; i++){
-      formatted.append(label[i].toString());
-      if(i < label.length - 1) formatted.append(" ,");
-    }
-    formatted.append("]");
-    return formatted.toString();
-  }
-}
diff --git a/developer/example/hold/IndexTree_Diagonal_SRM.java b/developer/example/hold/IndexTree_Diagonal_SRM.java
deleted file mode 100644 (file)
index 42f44db..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-import java.math.BigInteger;
-import com.ReasoningTechnology.Ariadne.Ariadne_Test;
-import com.ReasoningTechnology.Ariadne.Ariadne_SRM;
-import com.ReasoningTechnology.Ariadne.Ariadne_SRM_List;
-import com.ReasoningTechnology.Ariadne.Ariadne_IndexTree_Node;
-
-public class IndexTree_Diagonal_SRM extends Ariadne_SRM<BigInteger[]> {
-
-  private final Ariadne_SRM_List<Ariadne_IndexTree_Node> list_of__unopened_node;
-  private final Ariadne_SRM_List<Ariadne_SRM_List<Ariadne_IndexTree_Node>> list_of__opened_incomplete_child_list;
-  private final Ariadne_SRM_List<BigInteger[]> read_list;
-  private final Ariadne_Test tester;
-
-  public static IndexTree_Diagonal_SRM make(){
-    return new IndexTree_Diagonal_SRM();
-  }
-
-  protected IndexTree_Diagonal_SRM(){
-    this.list_of__unopened_node = new Ariadne_SRM_List<>();
-    this.list_of__opened_incomplete_child_list = new Ariadne_SRM_List<>();
-    this.read_list = new Ariadne_SRM_List<>();
-    this.tester = Ariadne_Test.make("IndexTree_Diagonal_SRM: ");
-    enqueue_root();
-  }
-
-  @Override
-  public void step(){
-    super.step();
-    
-    read_list.clear(); // Clear the current read list for the new diagonal
-
-    // Process unopened nodes
-    while(!list_of__unopened_node.is_empty()){
-      Ariadne_IndexTree_Node node = list_of__unopened_node.read();
-      list_of__unopened_node.step(); // Remove node from unopened list
-      Ariadne_SRM_List<Ariadne_IndexTree_Node> child_list = node.open();
-      if(child_list != null){
-        list_of__opened_incomplete_child_list.add(child_list);
-      }
-    }
-
-    // Process incomplete child lists
-    while(!list_of__opened_incomplete_child_list.is_empty()){
-      Ariadne_SRM_List<Ariadne_IndexTree_Node> child_list = list_of__opened_incomplete_child_list.read();
-      if(!child_list.is_empty()){
-        Ariadne_IndexTree_Node node = child_list.read();
-        child_list.step(); // Step to the next node in the child list
-        BigInteger[] label = node.label();
-        read_list.add(label); // Queue the label on the read list
-        tester.print("Queued label: " + format_label(label));
-        if(node.has_children()){
-          list_of__unopened_node.add(node); // Add node to unopened list if it has children
-        }
-        if(child_list.is_empty()){
-          list_of__opened_incomplete_child_list.step(); // Remove empty child lists
-        }
-      }
-    }
-  }
-
-  private void enqueue_root(){
-    Ariadne_IndexTree_Node root = Ariadne_IndexTree_Node.make(new BigInteger[0]);
-    read_list.add(root.label());
-    tester.print("Queued root label: " + format_label(root.label()));
-    if(root.has_children()){
-      list_of__unopened_node.add(root);
-    }
-  }
-
-  private String format_label(BigInteger[] label){
-    if(label.length == 0) return "[]";
-    StringBuilder formatted = new StringBuilder("[");
-    for(int i = 0; i < label.length; i++){
-      formatted.append(label[i].toString());
-      if(i < label.length - 1) formatted.append(" ,");
-    }
-    formatted.append("]");
-    return formatted.toString();
-  }
-}
diff --git a/developer/javacđź–‰/#Ariadne_LockManager.java# b/developer/javacđź–‰/#Ariadne_LockManager.java#
deleted file mode 100644 (file)
index 06773c8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-
-
-*/
-
-
-package com.ReasoningTechnology.Ariadne;
-
-public interface Ariadne_OwnershipServer{
-  Ariadne_LockManagerDelegate<T>  single_thread(Object resource);
-  Ariadne_LockManagerDelegate<T>  multiple_thread(Object resource);
-}
diff --git a/developer/javacđź–‰/#Ariadne_Node.xjava# b/developer/javacđź–‰/#Ariadne_Node.xjava#
deleted file mode 100644 (file)
index d2d55b4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-import java.util.HashMap;
-import java.util.HashSet;
-
-public class Ariadne_Node extends HashMap<String, Object>{
-
-  // owned by the class
-  //
-  public static Ariadne_Node make(Ariadne_Label label){
-    return new Ariadne_Node(label);
-  }
-
-  // data owned by the instance
-  //
-  private Ariadne_Label label;
-  private HashSet<Ariadne_Label> mark_set;
-
-  // constructors
-  //
-  public Ariadne_Node(Ariadne_Label label){
-    super();
-    this.label = label;
-    this.market_set = new HashSet<Ariadne_Label>;
-  }
-
-  // instance interface
-  //
-  public Ariadne_Label label(){
-    return this.label;
-  }
-
-  public Ariadne_StepRightMachine<Ariadne_Label> neighbor_set(); 
-
-  public void mark(Ariadne_Token token){
-    mark_set.add(token);
-  }
-
-  public boolean has_mark(Ariadne_Token token){
-    return mark_set.contains(token);
-  }
-
-  public Ariadne_LabelList neighbor(){
-    return(Ariadne_LabelList) this.get(neighbor_property_name);
-  }
-
-  // Object interface
-  //
-
-
-}
index ee9cec5..2226a0f 100644 (file)
@@ -24,7 +24,7 @@ public class Ariadne_IndexTree_Child_SRM extends Ariadne_SRM<BigInteger[]> {
   }
 
   @Override
-  public BigInteger[] read(){
+  public BigInteger[] access(){
     // Return a reference to the current label
     return label;
   }
index 16fee89..1ef9317 100644 (file)
@@ -18,6 +18,9 @@ public class Ariadne_SRM<TElement> {
   protected Ariadne_SRM(){
   }
 
+  // machine and tape status/properties
+  //
+
   public enum Topology{
     UNDEFINED
     ,NO_CELLS
@@ -47,13 +50,30 @@ public class Ariadne_SRM<TElement> {
       return topology().ordinal() >= Topology.SEGMENT.ordinal()
           && location().ordinal() <= Location.INTERIM.ordinal();
   }
-
   public boolean can_read() {
       return topology().ordinal() >= Topology.SINGLETON.ordinal();
   }
 
-  // returns a reference, cell can then be read or written
-  public TElement access(){
+  // moving the head
+  //
+
+  public void step(){
+    throw new UnsupportedOperationException("Ariadne_SRM::step not implemented.");
+  }
+
+  public void rewind(){
+    throw new UnsupportedOperationException("Ariadne_SRM::rewind not implemented.");      
+  }
+
+  public void fast_forward(){
+    throw new UnsupportedOperationException("Ariadne_SRM::fast_forward not implemented.");      
+  }
+
+  // access
+  //
+  
+  public TElement access(){ 
+    // returns a reference, cell can then be read or written
     throw new UnsupportedOperationException("Ariadne_SRM::read not implemented.");
   }
 
@@ -70,16 +90,4 @@ public class Ariadne_SRM<TElement> {
     throw new UnsupportedOperationException("Ariadne_SRM::read not implemented.");
   }
 
-  public void step(){
-    throw new UnsupportedOperationException("Ariadne_SRM::step not implemented.");
-  }
-
-  public void rewind(){
-    throw new UnsupportedOperationException("Ariadne_SRM::rewind not implemented.");      
-  }
-
-  public void fast_forward(){
-    throw new UnsupportedOperationException("Ariadne_SRM::fast_forward not implemented.");      
-  }
-
 }
index 5e95b45..f5b5c92 100644 (file)
@@ -1,18 +1,18 @@
 package com.ReasoningTechnology.Ariadne;
 import java.util.List;
 
-public class Ariadne_SRMI_Array<T> extends Ariadne_SRMI<T>{
+public class Ariadne_SRMI_Array<TElement> extends Ariadne_SRMI<TElement>{
 
   public static <T> Ariadne_SRMI_Array<T> make(List<T> array){
     return new Ariadne_SRMI_Array<>(array);
   }
 
-  private List<T> _array;
+  private List<TElement> _array;
   private int _index;
   private Topology _topology;
   private Location _location;
 
-  protected Ariadne_SRMI_Array(){
+  protected Ariadne_SRMI_Array(List<TElement> array) {
     _array = array;
 
     if( _array == null || _array.isEmpty() ) 
@@ -41,8 +41,8 @@ public class Ariadne_SRMI_Array<T> extends Ariadne_SRMI<T>{
   }
 
   @Override
-  public T access(){
-    if( can_read() ) return _array.get( _index() );
+  public TElement access(){
+    if( can_read() ) return _array.get( _index );
     throw new UnsupportedOperationException("Ariadne_SRMI_Array::read can not read tape.");
   }
 
index 49c20bb..45a11c3 100644 (file)
@@ -16,7 +16,7 @@ public class Ariadne_SRM_List<TElement> extends Ariadne_SRM<TElement> {
     return new Ariadne_SRM_List<>(list);
   }
 
-  private final List<TElement> _list;  // The attached linked list
+  private List<TElement> _list;  // The attached linked list
   private ListIterator<TElement> iterator;  // Iterator for traversal
   private TElement read_value;  // Stores the current cell value
 
@@ -25,6 +25,9 @@ public class Ariadne_SRM_List<TElement> extends Ariadne_SRM<TElement> {
 
   // Protected constructor for controlled instantiation
   protected Ariadne_SRM_List(List<TElement> list){
+    init(list);
+  }
+  private void init(List<TElement> list){
     _list = list;
     
     if( _list == null || _list.isEmpty() ) 
@@ -39,7 +42,7 @@ public class Ariadne_SRM_List<TElement> extends Ariadne_SRM<TElement> {
     else
       _location = Location.OTHER;
 
-    if(_topology >= SINGLETON){
+    if(_topology.ordinal() >= Topology.SINGLETON.ordinal()){
       iterator = _list.listIterator();
       read_value = iterator.next();
     }
@@ -65,11 +68,15 @@ public class Ariadne_SRM_List<TElement> extends Ariadne_SRM<TElement> {
   public void step(){
     if( can_step() ){
       read_value = iterator.next();  // Move to the next cell and update current value
-      if( !iterator.has_next() ) _location = Location.RIGHTMOST;
+      if( !iterator.hasNext() ) _location = Location.RIGHTMOST;
       return;
     }
     throw new UnsupportedOperationException("Ariadne_SRM_List::step can not step.");
   }
 
+  @Override
+  public void rewind(){
+    init(_list);
+  }
 
 }