Class: Bparity::Synthesis::InvariantMiner

Inherits:
Object
  • Object
show all
Defined in:
lib/bparity/synthesis.rb

Instance Method Summary collapse

Instance Method Details

#mine(records) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bparity/synthesis.rb', line 10

def mine(records)
  successful = records.filter_map do |record|
    outcome = record["outcome"]
    outcome["value"] if outcome&.fetch("kind", nil) == "return"
  end
  return [] if successful.length < 2

  candidates(successful).map.with_index(1) do |expression, index|
    { "id" => format("inv-%04d", index), "expr" => expression, "support" => successful.length,
      "confidence" => 1.0, "provenance_level" => "B", "formal_level" => "F0" }
  end
end