Skip to content

Commit 5baa5f6

Browse files
author
github-actions
committed
Update API docs from pynever
1 parent 576e6fc commit 5baa5f6

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed

pynever/API/4_Verification.html

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@
259259
</section>
260260
<section id="module-pynever.strategies.verification.algorithms">
261261
<span id="algorithms"></span><h2>Algorithms<a class="headerlink" href="#module-pynever.strategies.verification.algorithms" title="Link to this heading"></a></h2>
262+
<p>This module contains the classes used to implement the different verification strategies. Following the strategy pattern,
263+
the class <code class="docutils literal notranslate"><span class="pre">VerificationStrategy</span></code> is the abstract class providing a <code class="docutils literal notranslate"><span class="pre">verify</span></code> method that requires a neural network and
264+
a property. The concrete classes <code class="docutils literal notranslate"><span class="pre">SSLPVerification</span></code> and <code class="docutils literal notranslate"><span class="pre">SSBPVerification</span></code> implement the verification strategies based
265+
on starsets and symbolic bounds propagation, respectively.</p>
262266
<dl class="py class">
263267
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.VerificationStrategy">
264268
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pynever.strategies.verification.algorithms.</span></span><span class="sig-name descname"><span class="pre">VerificationStrategy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parameters</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.VerificationStrategy" title="Link to this definition"></a></dt>
@@ -289,17 +293,17 @@
289293
<dl class="py method">
290294
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.VerificationStrategy.verify">
291295
<em class="property"><span class="k"><span class="pre">abstractmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">verify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">network</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prop</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.VerificationStrategy.verify" title="Link to this definition"></a></dt>
292-
<dd><p>Verify that the neural network of interest satisfy the property given as argument
296+
<dd><p>Verify that the neural network of interest satisfies the property given as argument
293297
using a verification strategy determined in the concrete children.</p>
294298
<dl class="field-list simple">
295299
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
296300
<dd class="field-odd"><ul class="simple">
297301
<li><p><strong>network</strong> (<a class="reference internal" href="0_Networks.html#pynever.networks.NeuralNetwork" title="pynever.networks.NeuralNetwork"><em>NeuralNetwork</em></a>) – The neural network to train.</p></li>
298-
<li><p><strong>prop</strong> (<em>Dataset</em>) – The property which the neural network must satisfy.</p></li>
302+
<li><p><strong>prop</strong> (<a class="reference internal" href="#pynever.strategies.verification.properties.NeverProperty" title="pynever.strategies.verification.properties.NeverProperty"><em>NeverProperty</em></a>) – The property which the neural network must satisfy.</p></li>
299303
</ul>
300304
</dd>
301305
<dt class="field-even">Returns<span class="colon">:</span></dt>
302-
<dd class="field-even"><p>True is the neural network satisfy the property, False otherwise.</p>
306+
<dd class="field-even"><p>True is the neural network satisfies the property, False otherwise.</p>
303307
</dd>
304308
<dt class="field-odd">Return type<span class="colon">:</span></dt>
305309
<dd class="field-odd"><p>bool</p>
@@ -313,11 +317,11 @@
313317
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSLPVerification">
314318
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pynever.strategies.verification.algorithms.</span></span><span class="sig-name descname"><span class="pre">SSLPVerification</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">params</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSLPVerification" title="Link to this definition"></a></dt>
315319
<dd><p>Bases: <a class="reference internal" href="#pynever.strategies.verification.algorithms.VerificationStrategy" title="pynever.strategies.verification.algorithms.VerificationStrategy"><code class="xref py py-class docutils literal notranslate"><span class="pre">VerificationStrategy</span></code></a></p>
316-
<p>Class used to represent the SSLP verification strategy.</p>
320+
<p>Class used to represent the SSLP (Star Sets with Linear Programming) verification strategy.</p>
317321
<dl class="py attribute">
318322
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSLPVerification.counterexample_stars">
319323
<span class="sig-name descname"><span class="pre">counterexample_stars</span></span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSLPVerification.counterexample_stars" title="Link to this definition"></a></dt>
320-
<dd><p>List of Star objects containing a counterexample</p>
324+
<dd><p>List of <code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code> objects containing a counterexample</p>
321325
<dl class="field-list simple">
322326
<dt class="field-odd">Type<span class="colon">:</span></dt>
323327
<dd class="field-odd"><p>list[Star]</p>
@@ -362,16 +366,16 @@
362366
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSBPVerification">
363367
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pynever.strategies.verification.algorithms.</span></span><span class="sig-name descname"><span class="pre">SSBPVerification</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parameters</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSBPVerification" title="Link to this definition"></a></dt>
364368
<dd><p>Bases: <a class="reference internal" href="#pynever.strategies.verification.algorithms.VerificationStrategy" title="pynever.strategies.verification.algorithms.VerificationStrategy"><code class="xref py py-class docutils literal notranslate"><span class="pre">VerificationStrategy</span></code></a></p>
365-
<p>Class used to represent the search-based verification strategy. It uses
366-
star propagation with Symbolic Bounds Propagation and an abstraction-refinement
367-
loop for better readability, structure and functionality</p>
369+
<p>Class used to represent the SSBP (Star Sets with Bounds Propagation) verification strategy.
370+
It uses star propagation with Symbolic Bounds Propagation and an abstraction-refinement
371+
loop for better readability, structure and functionality.</p>
368372
<dl class="py attribute">
369373
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSBPVerification.network">
370374
<span class="sig-name descname"><span class="pre">network</span></span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSBPVerification.network" title="Link to this definition"></a></dt>
371375
<dd><p>The neural network to verify</p>
372376
<dl class="field-list simple">
373377
<dt class="field-odd">Type<span class="colon">:</span></dt>
374-
<dd class="field-odd"><p><a class="reference internal" href="0_Networks.html#pynever.networks.SequentialNetwork" title="pynever.networks.SequentialNetwork">networks.SequentialNetwork</a></p>
378+
<dd class="field-odd"><p><a class="reference internal" href="0_Networks.html#pynever.networks.NeuralNetwork" title="pynever.networks.NeuralNetwork">NeuralNetwork</a></p>
375379
</dd>
376380
</dl>
377381
</dd></dl>
@@ -390,11 +394,19 @@
390394
<dl class="py method">
391395
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSBPVerification.init_search">
392396
<span class="sig-name descname"><span class="pre">init_search</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">network</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prop</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSBPVerification.init_search" title="Link to this definition"></a></dt>
393-
<dd><p>Initialize the search algorithm and compute the
394-
starting values for the bounds, the star and the target</p>
397+
<dd><p>Initialize the search algorithm and compute the starting values for the bounds and the star.</p>
395398
<dl class="field-list simple">
399+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
400+
<dd class="field-odd"><ul class="simple">
401+
<li><p><strong>network</strong> (<a class="reference internal" href="0_Networks.html#pynever.networks.NeuralNetwork" title="pynever.networks.NeuralNetwork"><em>NeuralNetwork</em></a>) – The neural network in use</p></li>
402+
<li><p><strong>prop</strong> (<a class="reference internal" href="#pynever.strategies.verification.properties.NeverProperty" title="pynever.strategies.verification.properties.NeverProperty"><em>NeverProperty</em></a>) – The property specification</p></li>
403+
</ul>
404+
</dd>
405+
<dt class="field-even">Returns<span class="colon">:</span></dt>
406+
<dd class="field-even"><p>The starting values for the star and the bounds.</p>
407+
</dd>
396408
<dt class="field-odd">Return type<span class="colon">:</span></dt>
397-
<dd class="field-odd"><p><span class="sphinx_autodoc_typehints-type"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">ExtendedStar</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">HyperRectangleBounds</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">VerboseBounds</span></code>]</span></p>
409+
<dd class="field-odd"><p>ExtendedStar, HyperRectangleBounds, VerboseBounds</p>
398410
</dd>
399411
</dl>
400412
</dd></dl>
@@ -421,8 +433,17 @@
421433
<dd><p>This method computes the intersection between a star and the output property
422434
using the intersection algorithm specified by the parameters</p>
423435
<dl class="field-list simple">
436+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
437+
<dd class="field-odd"><ul class="simple">
438+
<li><p><strong>star</strong> (<em>ExtendedStar</em>) – The <code class="xref py py-class docutils literal notranslate"><span class="pre">ExtendedStar</span></code> object containing the star to intersect</p></li>
439+
<li><p><strong>nn_bounds</strong> (<em>VerboseBounds</em>) – The bounds obtained through bounds propagation</p></li>
440+
</ul>
441+
</dd>
442+
<dt class="field-even">Returns<span class="colon">:</span></dt>
443+
<dd class="field-even"><p>The result of the intersection. If True, a counterexample is returned too.</p>
444+
</dd>
424445
<dt class="field-odd">Return type<span class="colon">:</span></dt>
425-
<dd class="field-odd"><p><span class="sphinx_autodoc_typehints-type"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">Tensor</span></code>]</span></p>
446+
<dd class="field-odd"><p>bool, torch.Tensor</p>
426447
</dd>
427448
</dl>
428449
</dd></dl>
@@ -431,10 +452,19 @@
431452
<dt class="sig sig-object py" id="pynever.strategies.verification.algorithms.SSBPVerification.get_next_target">
432453
<span class="sig-name descname"><span class="pre">get_next_target</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">star</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nn_bounds</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/NeverTools/pynever/blob/main/pynever/strategies/verification/algorithms.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pynever.strategies.verification.algorithms.SSBPVerification.get_next_target" title="Link to this definition"></a></dt>
433454
<dd><p>This method computes the next refinement target for the verification algorithm
434-
based on the strategy specified by the parameters</p>
455+
based on the strategy specified by the parameters.</p>
435456
<dl class="field-list simple">
457+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
458+
<dd class="field-odd"><ul class="simple">
459+
<li><p><strong>star</strong> (<em>ExtendedStar</em>) – The <code class="xref py py-class docutils literal notranslate"><span class="pre">ExtendedStar</span></code> object containing the star to refine</p></li>
460+
<li><p><strong>nn_bounds</strong> (<em>VerboseBounds</em>) – The bounds obtained through bounds propagation.</p></li>
461+
</ul>
462+
</dd>
463+
<dt class="field-even">Returns<span class="colon">:</span></dt>
464+
<dd class="field-even"><p>The next refinement target and the extended star to refine. If no more refinement is needed, None is returned.</p>
465+
</dd>
436466
<dt class="field-odd">Return type<span class="colon">:</span></dt>
437-
<dd class="field-odd"><p><span class="sphinx_autodoc_typehints-type"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">RefinementTarget</span></code> | <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">ExtendedStar</span></code>]</span></p>
467+
<dd class="field-odd"><p>RefinementTarget | None, ExtendedStar</p>
438468
</dd>
439469
</dl>
440470
</dd></dl>
@@ -447,15 +477,15 @@
447477
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
448478
<dd class="field-odd"><ul class="simple">
449479
<li><p><strong>network</strong> (<a class="reference internal" href="0_Networks.html#pynever.networks.NeuralNetwork" title="pynever.networks.NeuralNetwork"><em>NeuralNetwork</em></a>) – The network model in the internal representation</p></li>
450-
<li><p><strong>prop</strong> (<em>Property</em>) – The property specification</p></li>
480+
<li><p><strong>prop</strong> (<a class="reference internal" href="#pynever.strategies.verification.properties.NeverProperty" title="pynever.strategies.verification.properties.NeverProperty"><em>NeverProperty</em></a>) – The property specification</p></li>
451481
</ul>
452482
</dd>
453483
<dt class="field-even">Returns<span class="colon">:</span></dt>
454484
<dd class="field-even"><p>True if the network is safe, False otherwise. If the result is False and the
455485
search is complete it also returns a counterexample</p>
456486
</dd>
457487
<dt class="field-odd">Return type<span class="colon">:</span></dt>
458-
<dd class="field-odd"><p>bool, Optional[torch.Tensor]</p>
488+
<dd class="field-odd"><p>bool, torch.tensor | None</p>
459489
</dd>
460490
</dl>
461491
</dd></dl>

0 commit comments

Comments
 (0)