Theoremabs_ext
Statement
theorem abs_ext {C C' : Ctx} {Γ : Shape} {VE : ValEnv} {bs : List (String × Option Nat)}
(hA : Abs C Γ) (hS : VESound VE bs) (hL : LookupExt C C' VE) : Abs C' (extT Γ bs)Proof
by
intro lid b h
rw [hL lid] at h
obtain ⟨q, x⟩ := lid
cases q with
| some m =>
simp only at h
obtain ⟨a, ha, hv⟩ := hA _ b h
exact ⟨a, by simp only [extT]; exact ha, hv⟩
| none =>
simp only at h
simp only [extT]
cases hx : FMap.find? VE x with
| some w =>
rw [hx] at h; simp only [Option.some_or, Option.some.injEq] at h; subst h
obtain ⟨a, ha, hv⟩ := hS.1 x w hx
exact ⟨a, by rw [ha]; rfl, hv⟩
| none =>
rw [hx] at h
simp only [Option.none_or] at h
obtain ⟨a, ha, hv⟩ := hA _ b h
cases hb : FMap.find? bs x with
| none => exact ⟨a, by rw [ha]; rfl, hv⟩
| some a' =>
refine ⟨a', rfl, fun n hn _ => ?_⟩
subst hn
have := hS.2 x n hb
rw [hx] at this; cases thisProved with tactics, which Lean expands into a proof term that its kernel checks.
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.