
    cwi:o                        S r SSKJr  SSKJrJrJrJr  SSKJ	r	J
r
JrJrJrJr  SSKJrJr  SSKJr  / SQr " S	 S
\5      r " S S\5      r " S S\S9r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      SS9S 5       r\R0                  " \
" S5      S S9S! 5       r \R0                  " \
" S5      S"S9S# 5       r!\R0                  " \
" S5      S$S9S% 5       r"\R0                  " \
" S5      S&S9S' 5       r#\R0                  " \
" S5      S(S9S) 5       r$\R0                  " \
" S5      S*S9S+ 5       r%\R0                  " \
" S5      S,S9S- 5       r&\R0                  " \
" S5      S.S9S/ 5       r'\R0                  " \
" S5      S0S9S1 5       r(\R0                  " \
" S5      S2S9S3 5       r)\R0                  " \
" S5      S4S9S5 5       r*\R0                  " \
" S5      S6S9S7 5       r+ " S8 S9\S9   5      r,g:);a(  
Functions and classes to observe or add ground statements.

Examples
--------
The following example shows how to add a fact to a program via the backend and
observe the corresponding rule passed to the backend:

    >>> from clingo.symbol import Function
    >>> from clingo.control import Control
    >>>
    >>> class Observer:
    ...     def rule(self, choice, head, body):
    ...         print("rule:", choice, head, body)
    ...
    >>> ctl = Control()
    >>> ctl.register_observer(Observer())
    >>>
    >>> sym_a = Function("a")
    >>> with ctl.backend() as backend:
    ...     atm_a = backend.add_atom(sym_a)
    ...     backend.add_rule([atm_a])
    ...
    rule: False [1] []
    >>> ctl.symbolic_atoms[sym_a].is_fact
    True
    >>>
    >>> print(ctl.solve(on_model=print))
    a
    SAT
    )ABCMeta)ContextManagerOptionalSequenceTuple   )_c_call_cb_error_handler_ffi_handle_error_lib_to_str)OrderedEnum
TruthValue)Symbol)BackendHeuristicTypeObserverTheorySequenceTypec                   d    \ rS rSrSr\R                  r \R                  r	 \R                  rSrg)r   +   /
Enumeration of the different heuristic types.
 N)__name__
__module____qualname____firstlineno____doc__r   !clingo_theory_sequence_type_tupler    clingo_theory_sequence_type_listListclingo_theory_sequence_type_setSet__static_attributes__r       H/home/james-whalen/.local/lib/python3.13/site-packages/clingo/backend.pyr   r   +   s=     22E 00D 
.
.Cr%   r   c                       \ rS rSrSr\R                  r \R                  r	 \R                  r \R                  r \R                  r \R                   rSrg)r   >   r   r   N)r   r   r   r   r   r   clingo_heuristic_type_factorFactorclingo_heuristic_type_falseFalse_clingo_heuristic_type_initInitclingo_heuristic_type_levelLevelclingo_heuristic_type_signSignclingo_heuristic_type_trueTrue_r$   r   r%   r&   r   r   >   ss     ..F --F **D ,,E **D ++Er%   r   c                   8   \ rS rSrSrS\SS4S jrS4S jrS\S	\\	   S
\\	   SS4S jr
S\S	\\	   S\	S
\\\	\	4      SS4
S jrS\	S\\\	\	4      SS4S jrS\\	   SS4S jrS\S\	SS4S jrS\S\\	   SS4S jrS\	S\SS4S jrS\\	   SS4S jrS\	S\S\	S\	S\\	   SS4S jrS\	S\	S\\	   SS4S  jrS!\	S"\	SS4S# jrS!\	S$\SS4S% jrS!\	S&\	S'\\	   SS4S( jrS)\	S*\\	   S\\	   SS4S+ jrS,\	S!\	S-\\	   SS4S. jrS,\	S!\	S-\\	   S/\	S0\	SS4S1 jrS4S2 jrS3r g)5r   ]   z
Interface that has to be implemented to inspect rules produced during
grounding.

See Also
--------
clingo.control.Control.register_observer

Notes
-----
Not all functions the `Observer` interface have to be implemented and can
be omitted if not needed.
incrementalreturnNc                     g)z
Called once in the beginning.

Parameters
----------
incremental
    Whether the program is incremental. If the incremental flag is
    true, there can be multiple calls to `clingo.control.Control.solve`.
Nr   )selfr7   s     r&   init_programObserver.init_programl       r%   c                     g)zD
Marks the beginning of a block of directives passed to the solver.
Nr   r:   s    r&   
begin_stepObserver.begin_stepw   r=   r%   choiceheadbodyc                     g)z
Observe rules passed to the solver.

Parameters
----------
choice
    Determines if the head is a choice or a disjunction.
head
    List of program atoms forming the rule head.
body
    List of program literals forming the rule body.
Nr   )r:   rB   rC   rD   s       r&   ruleObserver.rule|   r=   r%   lower_boundc                     g)a  
Observe rules with one weight constraint in the body passed to the
solver.

Parameters
----------
choice
    Determines if the head is a choice or a disjunction.
head
    List of program atoms forming the head of the rule.
lower_bound
    The lower bound of the weight constraint in the rule body.
body
    List of weighted literals (pairs of literal and weight) forming the
    elements of the weight constraint.
Nr   )r:   rB   rC   rH   rD   s        r&   weight_ruleObserver.weight_rule   r=   r%   priorityliteralsc                     g)z
Observe minimize directives (or weak constraints) passed to the
solver.

Parameters
----------
priority
    The priority of the directive.
literals
    List of weighted literals whose sum to minimize (pairs of literal
    and weight).
Nr   r:   rL   rM   s      r&   minimizeObserver.minimize   r=   r%   atomsc                     g)zw
Observe projection directives passed to the solver.

Parameters
----------
atoms
    The program atoms to project on.
Nr   r:   rR   s     r&   projectObserver.project   r=   r%   symbolatomc                     g)a  
Observe shown atoms passed to the solver.  Facts do not have an
associated program atom. The value of the atom is set to zero.

Parameters
----------
symbol
    The symbolic representation of the atom.
atom
    The associated program atom (`0` for facts).
Nr   )r:   rW   rX   s      r&   output_atomObserver.output_atom   r=   r%   	conditionc                     g)z
Observe shown terms passed to the solver.

Parameters
----------
symbol
    The symbolic representation of the term.
condition
    List of program literals forming the condition when to show the
    term.
Nr   )r:   rW   r\   s      r&   output_termObserver.output_term   r=   r%   valuec                     g)z
Observe external statements passed to the solver.

Parameters
----------
atom
    The external atom in form of a program literal.
value
    The truth value of the external statement.
Nr   r:   rX   r`   s      r&   externalObserver.external   r=   r%   c                     g)z
Observe assumption directives passed to the solver.

Parameters
----------
literals
    The program literals to assume (positive literals are true and
    negative literals false for the next solve call).
Nr   r:   rM   s     r&   assumeObserver.assume   r=   r%   type_biasc                     g)a
  
Observe heuristic directives passed to the solver.

Parameters
----------
atom
    The program atom heuristically modified.
type_
    The type of the modification.
bias
    A signed integer.
priority
    An unsigned integer.
condition
    List of program literals.
Nr   r:   rX   ri   rj   rL   r\   s         r&   	heuristicObserver.heuristic   r=   r%   node_unode_vc                     g)u(  
Observe edge directives passed to the solver.

Parameters
----------
node_u
    The start vertex of the edge (in form of an integer).
node_v
    Тhe end vertex of the edge (in form of an integer).
condition
    The list of program literals forming th condition under which to
    add the edge.
Nr   r:   ro   rp   r\   s       r&   	acyc_edgeObserver.acyc_edge  r=   r%   term_idnumberc                     g)zx
Observe numeric theory terms.

Parameters
----------
term_id
    The id of the term.
number
    The value of the term.
Nr   )r:   ru   rv   s      r&   theory_term_numberObserver.theory_term_number  r=   r%   namec                     g)z|
Observe string theory terms.

Parameters
----------
term_id
    The id of the term.
name
    The string value of the term.
Nr   )r:   ru   rz   s      r&   theory_term_stringObserver.theory_term_string  r=   r%   name_id_or_type	argumentsc                     g)aa  
Observe compound theory terms.

Parameters
----------
term_id
    The id of the term.
name_id_or_type
    The name id or type of the term where the value `-1` stands for
    tuples, `-2` for sets, `-3` for lists, or otherwise for the id of
    the name (in form of a string term).
arguments
    The arguments of the term in form of a list of term ids.
Nr   )r:   ru   r~   r   s       r&   theory_term_compoundObserver.theory_term_compound+  r=   r%   
element_idtermsc                     g)z
Observe theory elements.

Parameters
----------
element_id
    The id of the element.
terms
    The term tuple of the element in form of a list of term ids.
condition
    The list of program literals forming the condition.
Nr   )r:   r   r   r\   s       r&   theory_elementObserver.theory_element=  r=   r%   atom_id_or_zeroelementsc                     g)z
Observe theory atoms without guard.

Parameters
----------
atom_id_or_zero
    The id of the atom or zero for directives.
term_id
    The term associated with the atom.
elements
    The elements of the atom in form of a list of element ids.
Nr   )r:   r   ru   r   s       r&   theory_atomObserver.theory_atomM  r=   r%   operator_idright_hand_side_idc                     g)a{  
Observe theory atoms with guard.

Parameters
----------
atom_id_or_zero
    The id of the atom or zero for directives.
term_id : int
    The term associated with the atom.
elements
    The elements of the atom in form of a list of element ids.
operator_id
    The id of the operator (a string term).
right_hand_side_id
    The id of the term on the right hand side of the atom.
Nr   )r:   r   ru   r   r   r   s         r&   theory_atom_with_guardObserver.theory_atom_with_guard]  r=   r%   c                     g)zt
Marks the end of a block of directives passed to the solver.

This function is called right before solving starts.
Nr   r?   s    r&   end_stepObserver.end_stepv  r=   r%   r   )r8   N)!r   r   r   r   r   boolr;   r@   r   intrF   r   rJ   rP   rU   r   rZ   r^   r   rc   rg   r   rm   rs   rx   strr|   r   r   r   r   r   r$   r   r%   r&   r   r   ]   s   	 	 	
4 x} HSM d  sm 	
 uS#X' 
0 sCx0I d Xc] t &   & Xc] t 
S 
 
 
	x} 	 	  	
  C= 
2 S Xc] t 
# 
s 
t 

# 
S 
T 
-0=Ec]	$&.sm@H	 "-0<DSM	   3-	
    
2r%   r   )	metaclassdatapyclingo_observer_init_program)onerrorrz   c                 f    [         R                  " U5      R                  nUR                  U 5        gNT)r   from_handler   r;   )r7   r   observers      r&   _pyclingo_observer_init_programr   ~  s+     ))$/44H+&r%   pyclingo_observer_begin_stepc                 d    [         R                  " U 5      R                  nUR                  5         gr   )r   r   r   r@   r   r   s     r&   _pyclingo_observer_begin_stepr     s'    ))$/44Hr%   pyclingo_observer_end_stepc                 d    [         R                  " U 5      R                  nUR                  5         gr   )r   r   r   r   r   s     r&   _pyclingo_observer_end_stepr     s'    ))$/44Hr%   pyclingo_observer_rulec           	          [         R                  " U5      R                  nUR                  U [	        U5       Vs/ s H  oqU   PM	     sn[	        U5       Vs/ s H  osU   PM	     sn5        gs  snf s  snf r   )r   r   r   rF   range)rB   rC   	head_sizerD   	body_sizer   r   is           r&   _pyclingo_observer_ruler     sh    ))$/44HMM%	"23"2Qa"23uYGW5XGW!1gGW5X  45X   A-
A2pyclingo_observer_weight_rulec                     [         R                  " U5      R                  nUR                  U [	        U5       Vs/ s H  oU   PM	     snU[	        U5       Vs/ s H  oU   R
                  XH   R                  4PM!     sn5        gs  snf s  snf r   )r   r   r   rJ   r   literalweight)	rB   rC   r   rH   rD   r   r   r   r   s	            r&   _pyclingo_observer_weight_ruler     s     ))$/44H	*+*Qa*+49)4DE4Dqq'//47>>	*4DE	 	 	,Es   B
&Bpyclingo_observer_minimizec           	          [         R                  " U5      R                  nUR                  U [	        U5       Vs/ s H  oQU   R
                  X   R                  4PM!     sn5        gs  snf r   )r   r   r   rP   r   r   r   )rL   rM   sizer   r   r   s         r&   _pyclingo_observer_minimizer     s^    ))$/44HeDkRkQK''););<kR  Ss   &A(
pyclingo_observer_projectc                     [         R                  " U5      R                  nUR                  [	        U5       Vs/ s H  o@U   PM	     sn5        gs  snf r   )r   r   r   rU   r   )rR   r   r   r   r   s        r&   _pyclingo_observer_projectr     sC    ))$/44Hd41Ah45 5   Apyclingo_observer_output_atomc                 z    [         R                  " U5      R                  nUR                  [	        U 5      U5        gr   )r   r   r   rZ   r   )rW   rX   r   r   s       r&   _pyclingo_observer_output_atomr     s1     ))$/44H.r%   pyclingo_observer_output_termc                     [         R                  " U5      R                  nUR                  [	        U 5      [        U5       Vs/ s H  oQU   PM	     sn5        gs  snf r   )r   r   r   r^   r   r   )rW   r\   r   r   r   r   s         r&   _pyclingo_observer_output_termr     sL     ))$/44Hd)L1A,)LM *Ms   A
pyclingo_observer_externalc                 z    [         R                  " U5      R                  nUR                  U [	        U5      5        gr   )r   r   r   rc   r   )rX   ri   r   r   s       r&   _pyclingo_observer_externalr     s0    ))$/44HdJu-.r%   pyclingo_observer_assumec                     [         R                  " U5      R                  nUR                  [	        U5       Vs/ s H  o@U   PM	     sn5        gs  snf r   )r   r   r   rg   r   )rM   r   r   r   r   s        r&   _pyclingo_observer_assumer     sA    ))$/44HOO%+6+Qa[+67 7r   pyclingo_observer_heuristicc                     [         R                  " U5      R                  nUR                  U [	        U5      X#[        U5       Vs/ s H  oU   PM	     sn5        gs  snf r   )r   r   r   rm   r   r   )	rX   ri   rj   rL   r\   r   r   r   r   s	            r&   _pyclingo_observer_heuristicr     sU    ))$/44HmE"D5QU;4W;aq\;4W  5Xs   Apyclingo_observer_acyc_edgec           	          [         R                  " U5      R                  nUR                  X[	        U5       Vs/ s H  obU   PM	     sn5        gs  snf r   )r   r   r   rs   r   )ro   rp   r\   r   r   r   r   s          r&   _pyclingo_observer_acyc_edger     sF    ))$/44HveDk'Jk!k'JK (K   A$pyclingo_observer_theory_term_numberc                 f    [         R                  " U5      R                  nUR                  X5        gr   )r   r   r   rx   )ru   rv   r   r   s       r&   %_pyclingo_observer_theory_term_numberr     s+     ))$/44H0r%   $pyclingo_observer_theory_term_stringc                 z    [         R                  " U5      R                  nUR                  U [	        U5      5        gr   )r   r   r   r|   r   )ru   rz   r   r   s       r&   %_pyclingo_observer_theory_term_stringr     s1     ))$/44H7r%   &pyclingo_observer_theory_term_compoundc           	          [         R                  " U5      R                  nUR                  X[	        U5       Vs/ s H  obU   PM	     sn5        gs  snf r   )r   r   r   r   r   )ru   r~   r   r   r   r   r   s          r&   '_pyclingo_observer_theory_term_compoundr      sM     ))$/44H!!t"EAQ<"E  #Fr    pyclingo_observer_theory_elementc           	          [         R                  " U5      R                  nUR                  U [	        U5       Vs/ s H  oqU   PM	     sn[	        U5       Vs/ s H  osU   PM	     sn5        gs  snf s  snf r   )r   r   r   r   r   )r   r   
terms_sizer\   condition_sizer   r   r   s           r&   !_pyclingo_observer_theory_elementr     sn     ))$/44H ,-,aq,-$^454!145
  	.5r   pyclingo_observer_theory_atomc           	          [         R                  " U5      R                  nUR                  X[	        U5       Vs/ s H  obU   PM	     sn5        gs  snf r   )r   r   r   r   r   )r   ru   r   r   r   r   r   s          r&   _pyclingo_observer_theory_atomr     sH     ))$/44Ht3UAQK3UV 4Vr   (pyclingo_observer_theory_atom_with_guardc           	          [         R                  " U5      R                  nUR                  U U[	        U5       Vs/ s H  oU   PM	     snUU5        gs  snf r   )r   r   r   r   r   )	r   ru   r   r   r   r   r   r   r   s	            r&   )_pyclingo_observer_theory_atom_with_guardr   %  sV     ))$/44H###Dk*k!k* 	 	+s   Ac                   l   \ rS rSrSrS rS rS rS\S\S\	\   S	S
4S jr
S\	\   S	S
4S jrS5S\\   S	\4S jjr\R                   4S\S\S	S
4S jjrS\S\S\S\S\	\   S	S
4S jrS\S\	\\\4      S	S
4S jrS\	\   S	S
4S jr/ S4S\	\   S\	\   S\S	S
4S jjr S6S\	\   S\S\	\\\4      S\S	S
4
S  jjrS!\S	\4S" jrS#\S	\4S$ jrS%\S&\	\   S	\4S' jrS(\S&\	\   S	\4S) jrS\S	\4S* jr S+\	\   S\	\   S	\4S, jr! S5S-\S.\	\   S/\\   S	\4S0 jjr" S5S-\S.\	\   S1\S2\S/\\   S	\4S3 jjr#S4r$g
)7r   i6  a  
Backend object providing a low level interface to extend a logic program.

This class allows for adding statements in ASPIF format.

See Also
--------
clingo.control.Control.backend

Notes
-----
The `Backend` is a context manager and must be used with Python's `with`
statement.
c                     Xl         X l        g N)_rep_error)r:   reperrors      r&   __init__Backend.__init__F  s    	r%   c                     U R                   R                  5         [        [        R                  " U R
                  5      U R                   S9  U $ )Nhandler)r   clearr   r   clingo_backend_beginr   r?   s    r&   	__enter__Backend.__enter__J  s4    d//		:DKKPr%   c                     U R                   R                  5         [        [        R                  " U R
                  5      U R                   S9  g)Nr   F)r   r   r   r   clingo_backend_endr   )r:   exc_typeexc_valexc_tbs       r&   __exit__Backend.__exit__O  s2    d--dii8$++Nr%   ro   rp   r\   r8   Nc                 n    [        [        R                  " U R                  XU[	        U5      5      5        g)z
Add an edge directive to the program.

Parameters
----------
node_u
    The start node represented as an unsigned integer.
node_v
    The end node represented as an unsigned integer.
condition
    List of program literals.
N)r   r   clingo_backend_acyc_edger   lenrr   s       r&   add_acyc_edgeBackend.add_acyc_edgeT  s+     	))		69c)n	
r%   rM   c           	      l    [        [        R                  " U R                  U[	        U5      5      5        g)zj
Add assumptions to the program.

Parameters
----------
literals
    The list of literals to assume true.
N)r   r   clingo_backend_assumer   r   rf   s     r&   
add_assumeBackend.add_assumeg  s#     	d00Hc(mTUr%   rW   c                     Uc  [         R                  nO![         R                  " SUR                  5      nU R                  R                  5         [        S[        R                  U R                  UU R                  S9$ )a\  
Return a fresh program atom or the atom associated with the given symbol.

If the given symbol does not exist in the atom base, it is added first. Such
atoms will be used in subequents calls to ground for instantiation.

Parameters
----------
symbol
    The symbol associated with the atom.
Returns
-------
The program atom representing the atom.
zclingo_symbol_t*clingo_atom_tr   )	r   NULLnewr   r   r   r	   r   clingo_backend_add_atom)r:   rW   p_syms      r&   add_atomBackend.add_atomr  sa      >IIEHH/=E((IIKK
 	
r%   rX   r`   c                 l    [        [        R                  " U R                  XR                  5      5        g)a   
Mark a program atom as external optionally fixing its truth value.

Parameters
----------
atom
    The program atom to mark as external.
value
    Optional truth value.

Notes
-----
Can also be used to release an external atom using `TruthValue.Release`.
N)r   r   clingo_backend_externalr   r`   rb   s      r&   add_externalBackend.add_external  s!     	d22499dKKPQr%   ri   rj   rL   c                     [        [        R                  " U R                  XR                  X4U[        U5      5      5        g)z
Add a heuristic directive to the program.

Parameters
----------
atom
    Program atom to heuristically modify.
type_
    The type of modification.
bias
    A signed integer.
priority
    An unsigned integer.
condition
    List of program literals.
N)r   r   clingo_backend_heuristicr   r`   r   rl   s         r&   add_heuristicBackend.add_heuristic  s1    0 	))		4diY	
r%   c           
      l    [        [        R                  " U R                  X[	        U5      5      5        g)z
Add a minimize constraint to the program.

Parameters
----------
priority
    Integer for the priority.
literals
    List of pairs of program literals and weights.
N)r   r   clingo_backend_minimizer   r   rO   s      r&   add_minimizeBackend.add_minimize  s&     	((HHV	
r%   rR   c           	      l    [        [        R                  " U R                  U[	        U5      5      5        g)zo
Add a project statement to the program.

Parameters
----------
atoms
    List of program atoms to project on.
N)r   r   clingo_backend_projectr   r   rT   s     r&   add_projectBackend.add_project  s#     	d11$))UCJOPr%   FrC   rD   rB   c                     [        [        R                  " U R                  X1[	        U5      U[	        U5      5      5        g)a`  
Add a disjuntive or choice rule to the program.

Parameters
----------
head
    The program atoms forming the rule head.
body
    The program literals forming the rule body.
choice
    Whether to add a disjunctive or choice rule.

Notes
-----
Integrity constraints and normal rules can be added by using an empty or
singleton head list, respectively.
N)r   r   clingo_backend_ruler   r   )r:   rC   rD   rB   s       r&   add_ruleBackend.add_rule  s1    * 	$$		6TD#d)	
r%   lowerc                     [        [        R                  " U R                  XA[	        U5      X#[	        U5      5      5        g)am  
Add a disjuntive or choice rule with one weight constraint with a lower bound
in the body to the program.

Parameters
----------
head
    The program atoms forming the rule head.
lower
    The lower bound.
body
    The pairs of program literals and weights forming the elements of the
    weight constraint.
choice
    Whether to add a disjunctive or choice rule.
N)r   r   clingo_backend_weight_ruler   r   )r:   rC   r   rD   rB   s        r&   add_weight_ruleBackend.add_weight_rule  s1    . 	++		6TET	
r%   rv   c                 `    [        S[        R                  U R                  UU R                  S9$ )z
Add a numeric theory term.

Parameters
----------
number
    The value of the term.

Returns
-------
The id of the added term.
clingo_id_tr   )r	   r   !clingo_backend_theory_term_numberr   r   )r:   rv   s     r&   add_theory_term_numberBackend.add_theory_term_number  s.     22IIKK
 	
r%   stringc                 |    [        S[        R                  U R                  UR	                  5       U R
                  S9$ )z
Add a theory term representing a string.

Parameters
----------
string
    The value of the term.

Returns
-------
The id of the added term.
r&  r   )r	   r   !clingo_backend_theory_term_stringr   encoder   )r:   r*  s     r&   add_theory_term_stringBackend.add_theory_term_string&  s4     22IIMMOKK
 	
r%   rz   r   c           
          [        S[        R                  U R                  UR	                  5       U[        U5      U R                  S9$ )z
Add a theory term representing a function.

Parameters
----------
name
    The name of the function.
arguments
    Sequence of term ids for the function arguments.

Returns
-------
The id of the added term.
r&  r   )r	   r   #clingo_backend_theory_term_functionr   r-  r   r   )r:   rz   r   s      r&   add_theory_term_function Backend.add_theory_term_function;  s>     44IIKKM	NKK
 	
r%   sequence_typec           
          [        S[        R                  U R                  UR                  U[        U5      U R                  S9$ )z
Add a theory term representing a sequence of theory terms.

Parameters
----------
sequence_type
    The type of the sequence
arguments
    Sequence of term ids for the function arguments.

Returns
-------
The id of the added term.
r&  r   )r	   r   #clingo_backend_theory_term_sequencer   r`   r   r   )r:   r4  r   s      r&   add_theory_term_sequence Backend.add_theory_term_sequenceT  s>    " 44II	NKK
 	
r%   c                 t    [        S[        R                  U R                  UR                  U R                  S9$ )z
Create a theory term from a symbol.

Parameters
----------
symbol
    The symbol to convert.

Returns
-------
The id of the added term.
r&  r   )r	   r   !clingo_backend_theory_term_symbolr   r   )r:   rW   s     r&   add_theory_term_symbolBackend.add_theory_term_symbolo  s2     22IIKKKK
 	
r%   r   c                     [        S[        R                  U R                  U[	        U5      U[	        U5      U R
                  S9$ )z
Create a theory atom element.

Parameters
----------
terms
    A sequence of term ids.
condition
    A sequence of program literals.

Returns
-------
The id of the added element.
r&  r   )r	   r   clingo_backend_theory_elementr   r   r   )r:   r   r\   s      r&   add_theory_elementBackend.add_theory_element  s?     ..IIJ	NKK	
 		
r%   ru   r   r   c                     Uc  Sn[        S[        R                  U R                  UUU[	        U5      U R
                  S9$ )a9  
Add a theory atom without a guard.

If no atom_id is given, a fresh atom id is assigned.

In case an atom id is given and an equivalent theory atom already
exists, the given atom id is ignored.

To declare a defined theory atom, a rule defining the program atom
should be added. Otherwise, the theory atom is considered an external
body occurrence.

Parameters
----------
term_id
    The id of the term associated with the theory atom.
elements
    A sequence of ids of theory atom elements.
atom_id_or_zero
    An optional program atom or zero for theory directives.
    r  r   )r	   r   clingo_backend_theory_atomr   r   r   )r:   ru   r   r   s       r&   add_theory_atomBackend.add_theory_atom  sF    6 "(O++IIMKK	
 		
r%   operatorr   c                     Uc  Sn[        S[        R                  U R                  UUU[	        U5      UR                  5       UU R                  S9
$ )a  
Add a theory atom with a guard.

Parameters
----------
term_id
    The id of the term associated with the theory atom.
elements
    A sequence of ids of theory atom elements.
operator
    String representing a theory operator.
right_hand_side_id
    Term id for the term on the right hand side.
atom_id_or_zero
    A optional program atom or zero for theory directives.

See Also
--------
Backend.add_theory_atom
rB  r  r   )r	   r   %clingo_backend_theory_atom_with_guardr   r   r-  r   )r:   ru   r   rF  r   r   s         r&   add_theory_atom_with_guard"Backend.add_theory_atom_with_guard  sS    8 "(O66IIMOOKK
 	
r%   )r   r   r   )F)%r   r   r   r   r   r   r   r   r   r   r   r  r   r   r
  r   r,   r  r   r  r   r  r  r   r  r#  r(  r   r.  r2  r   r7  r;  r?  rD  rI  r$   r   r%   r&   r   r   6  s   


C 
 
# 
SW 
&	V8C= 	VT 	V
x/ 
3 
< ;E:K:K R RZ RPT R"

 
 	

 
 C=
 

<
S 
HU38_4M 
RV 
	Q# 	Q4 	Q :<E
SM
)1#
EI
	
@ 
sm
 
 uS#X'	

 
 

:
S 
S 
*
S 
S 
*
S 
Xc] 
s 
2
/
<DSM
	
6
V 
 
*
 
(3- 
TW 
< *.	&
&
 3-&
 "#	&

 
&
\ *.)
)
 3-)
 	)

  )
 "#)
 
)
 )
r%   r   N)-r   abcr   typingr   r   r   r   	_internalr	   r
   r   r   r   r   corer   r   rW   r   __all__r   r   r   
def_externr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r%   r&   <module>rQ     sP  @  < < U U ) 
H &K >^ ^B	 f%,L *629WX Y *629UV W *629QR S f%,K

 *629UV W *629TU V f%,K f%,K *629UV W *629ST U *629VW X *629VW X f%,R f%,R f%,T f%,N		 f%,K f%,Vy
nY' y
r%   