txgraffiti.playground

txgraffiti.playground.conjecture

class txgraffiti.playground.conjecture.ConjecturePlayground(df, object_symbol='G', base=None)[source]

Bases: object

append_row(row)[source]

Append a new row (dict of col:value) to self.df, then clear any cached conjectures.

convert_columns(convert_dict)[source]
discover(*args, **kwargs)[source]

Run generate(…) with the given parameters, cache, and return the list.

Return type:

list[Conjecture]

discover_equalities(*, generators=None, min_fraction=0.15)[source]

Find all single‐feature inequalities of the form L≤R or L≥R (with hypothesis TRUE) that are tight (slack==0) on at least min_fraction of the rows. For each, register & return a Predicate L_eq_R.

Return type:

list[Predicate]

exists(pred)[source]
Return type:

bool

export_conjectures(path, format='json')[source]

Write self.conjectures to disk in JSON or CSV form.

export_to_lean(path, name_prefix='conjecture', object_symbol=None)[source]

Write all cached conjectures to path in Lean theorem‐stub format. Each theorem will be named {name_prefix}_{i}.

forall(pred)[source]
Return type:

bool

generate(*, methods=None, features=None, target=None, hypothesis=None, heuristics=None, post_processors=None, **kwargs)[source]
Return type:

Iterator[Conjecture]

prop(name)[source]
Return type:

Property

reset(new_df=None)[source]

If new_df is given, replace self.df; otherwise rebind the same DataFrame (e.g. after in-place edits). In either case, clear cached conjectures.

class txgraffiti.playground.conjecture.Exists(pred, df, object_symbol='G')[source]

Bases: object

is_true()[source]
Return type:

bool

witness()[source]
Return type:

DataFrame

class txgraffiti.playground.conjecture.ForAll(conj, df, object_symbol='G')[source]

Bases: object

counterexamples()[source]
Return type:

DataFrame

is_true()[source]
Return type:

bool

txgraffiti.playground.registry

txgraffiti.playground.registry.list_playgrounds()[source]

Return all registered generator functions.

Return type:

list[Callable[..., Iterator[Conjecture]]]

txgraffiti.playground.registry.register_playground(fn)[source]

Use as a plain decorator: :rtype: Callable[..., Iterator[Conjecture]]

@register_gen def convex_hull(…): …