When defining an inductive predicate I can choose which parameters are fixed and which not. For a contrived example consider:
inductive foo for P where
"foo P True (Inl x) (Inl x)"
Is it somehow possible to turn this into an inductively defined set with one fixed and one non-fixed parameter?
inductive_set Foo for P where
"(Inl x, Inl x) : Foo P True"
is rejected with the error message:
Argument types 'd, bool of Foo do not agree with types'd of declared parameter
I know that I can define a set based on the inductive predicate version (e.g., Foo P b = {(x, y). foo P b x x}
), but then I always have to unfold it before I can apply induction or case-analysis (or have to introduce corresponding rules for Foo
, which seems a bit redundant).
This is a limitation of
inductive_set
, all parameters must be declared asfor
; in particular, you cannot instantiate them. Currently, the only solution is as you have described: define the predicate first and then introduce corresponding rules for the set. Fortunately, you can use the attributespred_to_set
andto_set
to do that automatically. In your example, this looks as follows: