proof.rb revision db8c56a73a065cf691f6e914e8385798edb2717e
# The Proof class is not supposed to be stored in the database. Its purpose is
# to allow for an easy way to create proving commands in the RESTful manner.
# It is called Proof to comply with the ProofsController which in turn gets
# called on */proofs routes.
# This class prepares the proving procedure and creates the models which are
# presented in the UI (ProofAttempt).
end
end
end
if not_provers.any?
record.errors.add attribute, "#{not_provers} are not provers"
end
end
end
# flags
# ontology related
# prover related
# axiom related
# timeout
# result related
validates :prover_ids, provers: true
if: :timeout_present?
def initialize(opts, prove_asynchronously: true)
@ontology = Ontology.find(opts[:ontology_id])
end
end
end
end
end
end
# This is needed for the validations to run.
opts[:proof][:prover_ids] ||= []
end
end
@proof_obligation ||=
if opts[:theorem_id]
else
end
end
@provers = [nil] if @provers.blank?
end
# HACK: Remove the empty string from params.
# Rails 4.2 introduces the html form option :include_hidden for this task.
end
end
end
@proof_attempts = []
if theorem?
else
end
end
end
provers.each do |prover|
@proof_attempts << proof_attempt
end
end
def build_axiom_selection(opts)
if AxiomSelection::METHODS.include?(axiom_selection_method)
send("build_#{axiom_selection_method}", opts)
end
end
def build_manual_axiom_selection(opts)
axiom_ids = normalize_check_box_ids(opts[:proof][:axioms])
@specific_axiom_selection = ManualAxiomSelection.new
if axiom_ids
specific_axiom_selection.axioms =
axiom_ids.map { |id| Axiom.unscoped.find(id) }
end
end
def build_sine_axiom_selection(opts)
@specific_axiom_selection =
SineAxiomSelection.new(opts[:proof][:sine_axiom_selection])
end
def timeout_present?
timeout.present?
end
def prove
proof_attempts.each do |proof_attempt|
if prove_asynchronously
ProofExecutionWorker.perform_async(proof_attempt.id)
else
ProofExecutionWorker.new.perform(proof_attempt.id)
end
end
end
end