Class: Lernen::Equiv::TestWordsOracle
- Defined in:
- lib/lernen/equiv/test_words_oracle.rb
Overview
TestWordsOracle provides an implementation of equivalence query that find a counterexample from the given words.
Instance Attribute Summary
Attributes inherited from Oracle
Instance Method Summary collapse
- #find_cex(hypothesis) ⇒ Object
-
#initialize(words, sul) ⇒ TestWordsOracle
constructor
: (Array[Array] words, System::SUL[In, Out] sul) -> void.
Methods inherited from Oracle
Constructor Details
#initialize(words, sul) ⇒ TestWordsOracle
: (Array[Array] words, System::SUL[In, Out] sul) -> void
15 16 17 18 19 |
# File 'lib/lernen/equiv/test_words_oracle.rb', line 15 def initialize(words, sul) super(sul) @words = words end |
Instance Method Details
#find_cex(hypothesis) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lernen/equiv/test_words_oracle.rb', line 22 def find_cex(hypothesis) super @words.each do |word| reset_internal(hypothesis) word.each_with_index do |input, index| hypothesis_output, sul_output = step_internal(hypothesis, input) if hypothesis_output != sul_output # steep:ignore @sul.shutdown return word[0..index] end end end nil end |