class FiniteCombinatoryLogic extends AnyRef
Type inhabitation for finite combinatory logic (FCL)
- Alphabetic
- By Inheritance
- FiniteCombinatoryLogic
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new FiniteCombinatoryLogic(subtypes: SubtypeEnvironment, repository: Repository)
Type Members
-
implicit
class
MinimalArguments extends Minimizable
Typeclass instance to minimize an argument collection wrt.
Typeclass instance to minimize an argument collection wrt. to its cardinality under the constraint that inhabitant sets remain equal. We have:
forall argvect in args, exists argvect' in args.minimize, forall i, argvect(i) <= argvect'(i)Example:Seq(Seq('A :&: 'B, 'C), Seq('A, 'D), Seq('A :&: 'B, 'C :&: D)).minimize = Seq(Seq('A :&: 'B, 'C), Seq('A, 'D))
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
covers(tgt: Type with Organized, paths: Seq[(Seq[Type], Type with Path)]): Seq[Seq[Type]]
Finds all piecewise intersections of argument sequences in
paths, such that correspondingly intersected targets are subtypes oftgt.Finds all piecewise intersections of argument sequences in
paths, such that correspondingly intersected targets are subtypes oftgt. Avoids selecting redundant paths and argument vectors. Assumes all argument sequences inpathsare of equal length. Example:covers('A :&: 'B, (Seq('X, P), 'A) +: (Seq('Y, Q), 'A) +: (Seq('Z, P), 'B) +: Seq.empty) == Seq('X :&: 'Z, P) +: Seq('Y :&: 'Z, P) +: Seq.empty -
final
def
ensureTargetExistsIfEqualTypePresent(grammar: TreeGrammar, target: Type): TreeGrammar
Ensures
targetis present as a left hand side ofgrammar, if a (subtype-)equal left hand side exists.Ensures
targetis present as a left hand side ofgrammar, if a (subtype-)equal left hand side exists. The preexisting left hand sides will be cloned. This is necessary, wheninhabitStepsubstitutes equal types. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
findSmallerEntry(grammar: TreeGrammar, ty: Type): Option[(Type, Set[(String, Seq[Type])])]
Finds an entries of
grammarwhere the left hand side is a subtype ofty. -
final
def
findSupertypeEntries(grammar: TreeGrammar, ty: Type): TreeGrammar
Finds all entries of
grammarwhere the left hand side is a supertype ofty. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
groundTypesOf(grammar: TreeGrammar): Set[Type]
Finds all productive left hand sides in
grammar.Finds all productive left hand sides in
grammar. A left hand side is productive, if any of its right hand sides only requires arguments, which are productive left hand sides of the grammar. -
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
inhabit(targets: Type*): TreeGrammar
Inhabits all types in targets and return a tree grammar to represent results.
Inhabits all types in targets and return a tree grammar to represent results. The tree grammar will contain entries (sigma -> Seq((c, args), rhs)), where sigma is a target type, c is a combinator name, args are the argument types necessary for c to inhabit sigma and rhs are all possible other combinator name, argument type pairs for target sigma. The resulting tree grammar is pruned to eliminate unproductive derivation chains.
-
final
def
inhabitRec(targets: Type*): Stream[(TreeGrammar, Stream[Stream[Type]])]
Inhabits all elements of
targets.Inhabits all elements of
targets. Recursively performs inhabitation until there are now fresh targets. Continues with the next target on failure. -
final
def
inhabitSequentially(grammar: TreeGrammar, tgts: Stream[Type]): (TreeGrammar, Stream[Stream[Type]])
Inhabits the arguments of a single combinator.
Inhabits the arguments of a single combinator. Sequentially performs
inhabitStepfor each target intgts. Aborts and rolls back, whenever a step along the way fails. -
final
def
inhabitSequentiallyContinueIfFailing(grammar: TreeGrammar, tgts: Stream[Stream[Type]]): (TreeGrammar, Stream[Stream[Type]])
Inhabits the arguments of multiple combinators.
Inhabits the arguments of multiple combinators. Sequentially performs
inhabitSequentiallyfor each target stream intgts. Continues with the next stream when a step along the way fails. -
final
def
inhabitStep(result: TreeGrammar, tgt: Type): (TreeGrammar, Stream[Stream[Type]])
Performs a single inhabitation step.
Performs a single inhabitation step. Finds combinators which can inhabit
tgt, adds their application as right hand sides for the left hand sidetgtand returns a stream of new targets for each combinator that was used. Removes combinators depending ontgtifgrammarcontains a pair(sigma -> rhs), wheresigmais a supertype oftgtandrhsis an empty set. Replaces all occurences oftgtif a (subtype-)equal left hand side is already present.- result
the tree grammar constructed so far.
- tgt
the current target.
- returns
an updated tree grammar and a stream of new targets for every new right hand side; empty target streams indicate failure, while
Stream.empty #:: Stream.empty[Stream[Type]]indicates success without fresh targets.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
newProductionsAndTargets(results: Map[String, Iterable[Seq[Type]]]): (Set[(String, Seq[Type])], Stream[Stream[Type]])
Rearranges intermediate results to a set of new grammar rules and recursive targets.
Rearranges intermediate results to a set of new grammar rules and recursive targets. Input format: a map containing combinator names and alternative recursive targets to use that combinator. Output format: a set of combinator names with the respective parameter types to inhabit for using the combinator, and a collection of all parameter type collections to use the combinators in the set. Example:
newProductionsAndTargets(Map("c" -> Seq(Seq('A, 'B), Seq('C), Seq('A, 'B))), "d" -> Seq(), "e" -> Seq(Seq())) == (Set(("c", Seq('A, 'B)), ("c", Seq('C)), ("e", Seq())), Stream.empty #:: ('C #:: Stream.empty) #:: ('A #:: 'B #:: Stream.empty) #:: Stream.empty -
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
prune(grammar: TreeGrammar): TreeGrammar
Removes all unproductive left hand sides in
grammar.Removes all unproductive left hand sides in
grammar.- See also
FiniteCombinatoryLogic.groundTypesOf(TreeGrammar)for a description of productivity.
-
def
removeEntriesWithArgument(grammar: TreeGrammar, arg: Type): TreeGrammar
Removes all entries of
grammarwhereargoccurs in a right hand side. - val repository: Repository
-
final
def
substituteArguments(grammar: TreeGrammar, oldType: Type, newType: Type): TreeGrammar
Substitutes all right hand side occurences in
grammarofoldTypebynewType. - val subtypes: SubtypeEnvironment
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )