pytket.predicates

class pytket.predicates.CliffordCircuitPredicate

Predicate asserting that a circuit has only Clifford gates.

__init__(self: pytket.predicates.CliffordCircuitPredicate) None

Constructor.

class pytket.predicates.CompilationUnit

This class comprises a circuit and the predicates that the circuit is required to satisfy, for example to run on a backend.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pytket.predicates.CompilationUnit, circuit: pytket.circuit.Circuit) -> None

Construct from a circuit, with no predicates.

  1. __init__(self: pytket.predicates.CompilationUnit, circuit: pytket.circuit.Circuit, predicates: List[pytket.predicates.Predicate]) -> None

Construct from a circuit and some required predicates.

check_all_predicates(self: pytket.predicates.CompilationUnit) bool
Returns

True if all predicates are satisfied, else False

property circuit

Return a copy of the circuit.

property final_map

Returns the map from the original qubits to their corresponding qubits at the end of the current circuit.

property initial_map

Returns the map from the original qubits to the corresponding qubits at the start of the current circuit.

class pytket.predicates.ConnectivityPredicate

Predicate asserting that a circuit satisfies a given connectivity graph. The graph is always considered to be undirected.

__init__(self: pytket.predicates.ConnectivityPredicate, architecture: pytket.routing.Architecture) None

Construct from an Architecture.

class pytket.predicates.DefaultRegisterPredicate

Predicate asserting that a circuit only uses the default quantum and classical registers.

__init__(self: pytket.predicates.DefaultRegisterPredicate) None

Constructor.

class pytket.predicates.DirectednessPredicate

Predicate asserting that a circuit satisfies a given connectivity graph. The graph is always considered to be directed.

__init__(self: pytket.predicates.DirectednessPredicate, architecture: pytket.routing.Architecture) None

Construct from an Architecture.

class pytket.predicates.GateSetPredicate

Predicate asserting that the circuit contains only gates from a given set.

__init__(self: pytket.predicates.GateSetPredicate, allowed_types: Set[pytket.circuit.OpType]) None

Construct from a set of gate types.

class pytket.predicates.MaxNQubitsPredicate

Predicate asserting that a circuit has at most n qubits.

__init__(self: pytket.predicates.MaxNQubitsPredicate, arg0: int) None

Constructor.

class pytket.predicates.MaxTwoQubitGatesPredicate

Predicate asserting that a circuit has no gates with more than two input wires.

__init__(self: pytket.predicates.MaxTwoQubitGatesPredicate) None

Constructor.

class pytket.predicates.NoClassicalBitsPredicate

Predicate asserting that a circuit has no classical wires.

__init__(self: pytket.predicates.NoClassicalBitsPredicate) None

Constructor.

class pytket.predicates.NoClassicalControlPredicate

Predicate asserting that a circuit has no classical controls.

__init__(self: pytket.predicates.NoClassicalControlPredicate) None

Constructor.

class pytket.predicates.NoFastFeedforwardPredicate

Predicate asserting that a circuit has no fast feedforward.

__init__(self: pytket.predicates.NoFastFeedforwardPredicate) None

Constructor.

class pytket.predicates.NoMidMeasurePredicate

Predicate asserting that all measurements occur at the end of the circuit.

__init__(self: pytket.predicates.NoMidMeasurePredicate) None

Constructor.

class pytket.predicates.NoSymbolsPredicate

Predicate asserting that no gates in the circuit have symbolic parameters.

__init__(self: pytket.predicates.NoSymbolsPredicate) None

Constructor.

class pytket.predicates.NoWireSwapsPredicate

Predicate asserting that a circuit has no wire swaps.

__init__(self: pytket.predicates.NoWireSwapsPredicate) None

Constructor.

class pytket.predicates.PlacementPredicate

Predicate asserting that a circuit has been acted on by some Placement object.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pytket.predicates.PlacementPredicate, architecture: pytket.routing.Architecture) -> None

Construct from an Architecture.

  1. __init__(self: pytket.predicates.PlacementPredicate, nodes: Set[pytket.circuit.Node]) -> None

Construct from a set of Node.

class pytket.predicates.Predicate

A predicate that may be satisfied by a circuit.

__init__(*args, **kwargs)
implies(self: pytket.predicates.Predicate, other: pytket.predicates.Predicate) bool
Returns

True if predicate implies another one, else False

verify(self: pytket.predicates.Predicate, circuit: pytket.circuit.Circuit) bool
Returns

True if circuit satisfies predicate, else False

class pytket.predicates.UserDefinedPredicate

User-defined predicate.

__init__(self: pytket.predicates.UserDefinedPredicate, check_function: Callable[[pytket.circuit.Circuit], bool]) None

Construct from a user-defined function from Circuit to bool.