TheoremarityOf_spec
Statement
theorem arityOf_spec : (τ : Ty) → (n : Nat) → arityOf τ = some n →
∃ ks args t, τ = arrows ks (.con args t) ∧ ks.length = n
| .fn a b, n, h => by
simp only [arityOf] at h
cases hb : arityOf b with
| none => rw [hb] at h; cases h
| some m =>
rw [hb] at h
simp only [Option.map_some, Option.some.injEq] at h
obtain ⟨ks, args, t, rfl, hl⟩Proof
arityOf_spec b m hb
exact ⟨a :: ks, args, t, rfl, by simp [hl, h]⟩
| .con args t, n, h => by
simp only [arityOf, Option.some.injEq] at h
exact ⟨[], args, t, rfl, by simp [h]⟩
| .var _, _, h => by simp [arityOf] at h
| .record _ _, _, h => by simp [arityOf] at hProved by a term, which Lean's kernel checks directly.
Used by
In StandardElmMech/Stat/RefuseScope.lean: Refusals by scope, constructor arity and imports, for one module and for a module after a helper (scopeFailB).
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.