Cross Reference: theorem.rb
xref
: /
ontohub
/
app
/
models
/
theorem.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
theorem.rb revision d85d3e053a2d0da45c4e242e6807f5062a0ebab1
class
Theorem
<
Sentence
include
StateUpdater
has_many
:
proof_attempts
,
foreign_key
:
'sentence_id'
,
dependent
: :
destroy
belongs_to
:
proof_status
attr_accessible
:
state
, :
state_updated_at
, :
last_error
, :
provable
validates
:
state
,
inclusion
: {
in
:
State
::
STATES
}
before_validation
:
set_default_state
scope
:
provable
, ->
()
{
where
(
provable
:
true
)
}
scope
:
unprovable
, ->
()
{
where
(
provable
:
false
)
}
def
set_default_state
self.state
||=
'pending'
end
def
update_proof_status
(
proof_status
)
if
proof_status.solved
? || !
self.proof_status.solved
?
self.proof
_status
=
proof_status
save
!
end
end
def
prove_options
hets_options
=
ontology.hets
_options
Hets
::
ProveOptions.new
(**
hets_options.options
,
ontology
:
ontology
,
theorems
: [
self
])
end
end