Skip to main content

InvHom

Struct InvHom 

Source
pub struct InvHom<'h, A> { /* private fields */ }
Expand description

Nondeleting inverse-homomorphism automaton.

InvHom<A> accepts a source tree t exactly when the wrapped automaton A accepts the homomorphic image h(t). The state type is unchanged: a source subtree receives the state that A assigns to its image.

The homomorphism is validated when it is built, so every source child occurs exactly once in each image term. This gives the condensed implementation a well-defined way to recover source child states from target-side rules.

Implementations§

Source§

impl<'h, A> InvHom<'h, A>

Source

pub fn new(inner: A, hom: &'h Homomorphism) -> Self

Wrap inner with the given homomorphism.

Source

pub fn inner(&self) -> &A

Return the wrapped automaton.

Source

pub fn homomorphism(&self) -> &Homomorphism

Return the homomorphism used to map source symbols to target terms.

Trait Implementations§

Source§

impl<A: BottomUpTa> BottomUpTa for InvHom<'_, A>

Source§

type State = <A as BottomUpTa>::State

State type carried by the automaton. Read more
Source§

fn step( &self, f_src: Symbol, children: &[A::State], out: &mut dyn FnMut(A::State), )

Report all possible parent states for f(children...). Read more
Source§

fn is_accepting(&self, q: &A::State) -> bool

Return whether q is an accepting state. Read more
Source§

impl<A> CondensedTa for InvHom<'_, A>

Source§

fn condensed_rules( &self, out: &mut dyn FnMut(&[A::State], &SymbolSet, A::State), )

Enumerate every distinct (children, result) pair, reporting the set of symbols that have that shape. Read more
Source§

fn condensed_nullary_rules(&self, out: &mut dyn FnMut(&SymbolSet, A::State))

Enumerate condensed nullary rules. Read more
Source§

fn condensed_rules_by_child( &self, position: usize, state: &A::State, out: &mut dyn FnMut(&[A::State], &SymbolSet, A::State), )

Enumerate condensed rules whose child at position is state. Read more
Source§

impl<A> CondensedTopDownTa for InvHom<'_, A>
where A: TopDownTa,

Source§

fn condensed_rules_by_parent( &self, parent: &A::State, out: &mut dyn FnMut(&SymbolSet, &[A::State]), )

Report every condensed rule symbols(children...) -> parent. Read more
Source§

fn condensed_initial_states(&self, out: &mut dyn FnMut(A::State))

Report initial states of the top-down view.
Source§

impl<A: DetBottomUpTa> DetBottomUpTa for InvHom<'_, A>

Source§

fn det_group(&self, f_src: Symbol) -> u32

Source symbols sharing an image term yield identical step_det results for any given children, so the structurally-deduplicated term id groups them: callers can compute one transition per group and reuse it for every symbol in the set. Unmapped symbols (step_det is always None) map to a sentinel group.

Source§

fn step_det(&self, f_src: Symbol, children: &[A::State]) -> Option<A::State>

Return the unique result state, or None if no transition exists. Read more
Source§

impl IntersectionHeuristic<InvHom<'_, StringDecompositionAutomaton>> for SentenceSxHeuristic<'_>

Source§

fn outside_estimate(&self, left: StateId, span: &Span) -> f64

Return an optimistic (admissible) upper bound in (0, 1] on the best outside weight of any completion around product state (left, right).
Source§

fn admits(&self, _left: StateId, _right: &R::State) -> bool

Sound hard filter consulted at candidate-construction time: return false iff (left, right) provably has zero outside weight (it can appear in no valid completion), so the A* loop may skip building the edge entirely rather than merely deprioritizing it. Read more
Source§

fn estimate_if_admitted(&self, left: StateId, right: &R::State) -> Option<f64>

Return the outside estimate when the product is admitted, and None when it is provably unable to occur in an accepting derivation. Read more
Source§

fn memoize_admission(&self) -> bool

Whether A* should memoize the admission decision by product pair. Read more
Source§

fn estimate_after_admission(&self, left: StateId, right: &R::State) -> f64

Return the outside estimate when admission for this pair is already known to succeed. Read more
Source§

impl IntersectionHeuristic<InvHom<'_, StringDecompositionAutomaton>> for ObligatoryLeafHeuristic<'_>

Source§

fn outside_estimate(&self, left: StateId, span: &Span) -> f64

Return an optimistic (admissible) upper bound in (0, 1] on the best outside weight of any completion around product state (left, right).
Source§

fn admits(&self, left: StateId, span: &Span) -> bool

Sound hard filter consulted at candidate-construction time: return false iff (left, right) provably has zero outside weight (it can appear in no valid completion), so the A* loop may skip building the edge entirely rather than merely deprioritizing it. Read more
Source§

fn estimate_if_admitted(&self, left: StateId, span: &Span) -> Option<f64>

Return the outside estimate when the product is admitted, and None when it is provably unable to occur in an accepting derivation. Read more
Source§

fn memoize_admission(&self) -> bool

Whether A* should memoize the admission decision by product pair. Read more
Source§

fn estimate_after_admission(&self, _left: StateId, _span: &Span) -> f64

Return the outside estimate when admission for this pair is already known to succeed. Read more
Source§

impl<A: StateUniverse> StateUniverse for InvHom<'_, A>

Source§

fn all_states(&self, out: &mut dyn FnMut(A::State))

Report every state in the finite universe exactly once.

Auto Trait Implementations§

§

impl<'h, A> Freeze for InvHom<'h, A>
where A: Freeze,

§

impl<'h, A> RefUnwindSafe for InvHom<'h, A>
where A: RefUnwindSafe,

§

impl<'h, A> Send for InvHom<'h, A>
where A: Send,

§

impl<'h, A> Sync for InvHom<'h, A>
where A: Sync,

§

impl<'h, A> Unpin for InvHom<'h, A>
where A: Unpin,

§

impl<'h, A> UnsafeUnpin for InvHom<'h, A>
where A: UnsafeUnpin,

§

impl<'h, A> UnwindSafe for InvHom<'h, A>
where A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.