Scan direction #
The orientation of a left-to-right vs right-to-left scan, shared by the transducer
machines and the side-determinacy predicates of the subregular function theory, with
the window of positions a direction cuts around a target coordinate, and the reverse
conjugation revConj realizing the flip on string functions. Extracted to its own
leaf so the footprint-predicate file (Dependence.lean) does not have to depend on
the transducer machine file just to name a left/right tag.
The orientation of an FST scan: left consumes input head-first, right
tail-first (via List.reverse conjugation). The two scan modes give rise to
distinct function classes — isomorphic under reversal but not equal as
subclasses of the rational functions over un-reversed strings.
- left : ScanDirection
- right : ScanDirection
Instances For
Equations
- instDecidableEqScanDirection x✝ y✝ = if h : x✝.ctorIdx = y✝.ctorIdx then isTrue ⋯ else isFalse ⋯
Equations
- instReprScanDirection.repr ScanDirection.left prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ScanDirection.left")).group prec✝
- instReprScanDirection.repr ScanDirection.right prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ScanDirection.right")).group prec✝
Instances For
Equations
- instReprScanDirection = { reprPrec := instReprScanDirection.repr }
The input positions not d-far from target i on side s.
Equations
- ScanDirection.left.window x✝¹ x✝ = Set.Ici (x✝¹ - x✝)
- ScanDirection.right.window x✝¹ x✝ = Set.Iic (x✝¹ + x✝)
Instances For
Reverse conjugation #
The action of flipping scan direction on string functions: right-scan function classes
are the List.revConj-images of the left-scan ones, so their theory transports along
the involution rather than being restated.
Conjugation by List.reverse: compute on the reversed input, reverse the result.
Equations
- List.revConj f xs = (f xs.reverse).reverse