pub struct QueryHeap { /* private fields */ }Expand description
Working heap for proof search.
Wraps a shared read-only program heap (Arc<Vec<Cell>>) and an
owned mutable cell buffer for query-time allocations. Supports
branching via an optional parent pointer for backtracking.
Implementations§
Trait Implementations§
Source§impl Heap for QueryHeap
impl Heap for QueryHeap
Source§fn term_string(&self, addr: usize) -> String
fn term_string(&self, addr: usize) -> String
Create String to represent cell, can be recursively used to format complex structures or list
fn heap_push(&mut self, cell: Cell) -> usize
fn heap_len(&self) -> usize
fn get_id(&self) -> usize
fn truncate(&mut self, len: usize)
fn _set_arg(&mut self, value: usize) -> usize
fn set_const(&mut self, id: usize) -> usize
fn set_ref(&mut self, ref_addr: Option<usize>) -> usize
fn deref_addr(&self, addr: usize) -> usize
Source§fn bind(&mut self, binding: &[(usize, usize)])
fn bind(&mut self, binding: &[(usize, usize)])
Update address value of ref cells affected by binding
@binding: List of (usize, usize) tuples representing heap indexes, left -> right
Source§fn unbind(&mut self, binding: &[(usize, usize)])
fn unbind(&mut self, binding: &[(usize, usize)])
Reset Ref cells affected by binding to self references
@binding: List of (usize, usize) tuples representing heap indexes, left -> right
Source§fn str_symbol_arity(&self, addr: usize) -> (usize, usize)
fn str_symbol_arity(&self, addr: usize) -> (usize, usize)
Get the symbol id and arity of functor structure
Source§fn term_vars(&self, addr: usize, args: bool) -> Vec<usize>
fn term_vars(&self, addr: usize, args: bool) -> Vec<usize>
Collect all REF, cells in structure or referenced by structure
If cell at addr is a reference return that cell
Source§fn str_iterator(&self, addr: usize) -> RangeInclusive<usize>
fn str_iterator(&self, addr: usize) -> RangeInclusive<usize>
Given address to a str cell create an operator over the sub terms addresses, including functor/predicate
fn _normalise_args(&mut self, addr: usize, args: &[usize])
fn _copy_complex( &mut self, other: &impl Heap, addr: usize, update_addr: &mut usize, )
fn _copy_simple(&mut self, other: &impl Heap, addr: usize, update_addr: &usize)
fn _copy_term(&mut self, other: &impl Heap, addr: usize) -> usize
Source§fn copy_term_with_ref_map(
&mut self,
other: &impl Heap,
addr: usize,
ref_map: &mut HashMap<usize, usize>,
) -> usize
fn copy_term_with_ref_map( &mut self, other: &impl Heap, addr: usize, ref_map: &mut HashMap<usize, usize>, ) -> usize
Copy a term from
other heap into self, tracking variable identity
via ref_map. Unbound Ref cells in other are mapped to fresh Ref
cells in self; the same source Ref always maps to the same target Ref.
Call with a shared ref_map across multiple terms to preserve variable
sharing (e.g. across literals in a clause).Source§fn _copy_ref_map_complex(
&mut self,
other: &impl Heap,
addr: usize,
ref_map: &mut HashMap<usize, usize>,
) -> Option<Cell>
fn _copy_ref_map_complex( &mut self, other: &impl Heap, addr: usize, ref_map: &mut HashMap<usize, usize>, ) -> Option<Cell>
Pre-pass helper for copy_term_with_ref_map: recursively copy complex
sub-terms and return the Cell to later insert, or None for simple cells.
Source§fn _copy_ref_map_simple(
&mut self,
other: &impl Heap,
addr: usize,
ref_map: &mut HashMap<usize, usize>,
)
fn _copy_ref_map_simple( &mut self, other: &impl Heap, addr: usize, ref_map: &mut HashMap<usize, usize>, )
Post-pass helper for copy_term_with_ref_map: push a simple cell,
handling Ref identity via ref_map.
fn _term_equal(&self, addr1: usize, addr2: usize) -> bool
fn contains_args(&self, addr: usize) -> bool
Source§fn _print_heap(&self)
fn _print_heap(&self)
Debug function for printing formatted string of current heap state
Source§fn list_string(&self, addr: usize) -> String
fn list_string(&self, addr: usize) -> String
Create a string from a list
Source§fn func_string(&self, addr: usize) -> String
fn func_string(&self, addr: usize) -> String
Create a string for a functor structure
Source§fn tuple_string(&self, addr: usize) -> String
fn tuple_string(&self, addr: usize) -> String
Create a string for a tuple
Source§fn set_string(&self, addr: usize) -> String
fn set_string(&self, addr: usize) -> String
Create a string for a set
Auto Trait Implementations§
impl Freeze for QueryHeap
impl RefUnwindSafe for QueryHeap
impl !Send for QueryHeap
impl !Sync for QueryHeap
impl Unpin for QueryHeap
impl UnsafeUnpin for QueryHeap
impl UnwindSafe for QueryHeap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more