This PR partly addresses #3458, by adding an option `autoPromoteIndices` to turn off the promotion of fixed indices to parameters. The actual fix for the issue is in a separate PR #3591. Because nested inductive datatypes parameters cannot contain local variables, it is often desirable for a fixed index to not be promoted, as to allow free variables in that place. See example in `3458_1.lean`
27 lines
1 KiB
Text
27 lines
1 KiB
Text
/- Ensure that turning off `autoPromoteIndices` stops indices
|
|
from being promoted to parameters in inductive types.
|
|
Because free variables aren't allowed in parameters of nested appearances,
|
|
it is sometimes desirable for fixed indices to not be promoted to parameters.
|
|
See `IInterp`.
|
|
-/
|
|
|
|
set_option autoImplicit false
|
|
universe u v w
|
|
|
|
structure ISignature (I : Type u) : Type (max u v + 1) where
|
|
symbols : I → Type v
|
|
indices : {i : I} → symbols i → List I
|
|
|
|
inductive All {I : Type u} (P : I → Type v) : List I → Type (max u v) where
|
|
| nil : All P []
|
|
| cons {x xs}: P x → All P xs → All P (x :: xs)
|
|
|
|
set_option inductive.autoPromoteIndices false
|
|
|
|
inductive IInterp {I} (ζ : ISignature.{u,v} I) (P : I → Type w) : I → Type (max u v w) where
|
|
| mk :{i : I} → (s : ζ.symbols i) → All P (ζ.indices s) → IInterp ζ P i
|
|
|
|
notation:max "I⟦ " ζ " ⟧" => IInterp ζ
|
|
|
|
inductive Iμ {I : Type u} (ζ : ISignature.{u,v} I) : I → Type (max u v) where
|
|
| mk : (i : I) → I⟦ ζ ⟧ (Iμ ζ) i → Iμ ζ i
|