decidable


Lean complains it can't see that a statement is decidable


I'm trying to define the following quantity partn:
variable pi : nat -> Prop
variable (Hdecp : ∀ p, decidable (pi p))
definition partn (n : nat) : nat := ∏ p ∈ (prime_factors n), (if pi p then p^(mult p n) else 1)
but get the error
error: failed to synthesize placeholder
pi : ℕ → Prop,
n p : ℕ
⊢ decidable (pi p)
How can I help Lean recognize that (pi p) is indeed decidable thanks to Hdecp?
edit: The elaborator can actually infer the instance completely on its own, as long it's available in the definition's context:
variable (Hdecp : ∀ p, decidable (pi p))
include Hdecp
definition partn (n : nat) : nat := ∏ p ∈ (prime_factors n), (if pi p then p^(mult p n) else 1)
original answer (still useful if the instance has more complex hypotheses):
If you want to avoid the explicit call to ite, you can locally introduce the decidable instance:
definition partn (n : nat) : nat := ∏ p ∈ (prime_factors n),
have decidable (pi p), from Hdecp p,
if pi p then p^(mult p n) else 1
I found a solution:
definition partn (n : nat) : nat := ∏ p ∈ (prime_factors n), (#ite (pi p) (Hdecp p) nat (p^(mult p n)) 1)
which allows me to explicitly use Hdecp in my if-the-else

Related Links

Lean complains it can't see that a statement is decidable

Categories

HOME
amazon-web-services
swi-prolog
mousemove
hid
iverilog
vsts-build
semantic-web
jersey-2.0
nsis
capistrano
fedora
scheduler
polymer-2.x
selection
nullreferenceexception
spyder
bsd
fido-u2f
altium-designer
managed-c++
web-config-transform
unrar
code-climate
ninject
epplus
cloveretl
formsauthenticationticket
love2d
jade4j
installanywhere
cartopy
assert
praat
suds
grails-spring-security
distributed-caching
opal-framework
pyttsx
contactless-smartcard
dbcc
brightscript
sonicmq
head.js
lightning-workbench
karabiner
scala-collections
android-mediarecorder
lvalue
degrees
cognos-tm1
email-injection
rational-performance-test
libharu
e
openquery
godeps
smart-tv
fanotify
knife
swagger-maven-plugin
sequence-sql
cache-manifest
deque
gflags
incron
operands
image-rotation
windows-rt
xulrunner
pre
typesafe-stack
principalcontext
particle-swarm
xsd2code
grails-2.3
mousemotionlistener
disjoint-union
sly-scroller
axacropdf
jbox2d
tfs-sdk
significant-digits
linkbutton
multidrop-bus
mmc3
asio
drawimage
hungarian-notation
self-tracking-entities
powergui
ntruencrypt
version-control-migration
watchpoint

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App