TheoremenvKeys_step
Statement
theorem envKeys_step (ME : ModEnv) (p : SmLongId × List ModId) (E : Env) (K : List SmLongId)
(h : EnvKeys E K) : EnvKeys (envStep ME p E) (p.1 :: K)Proof
by
have h' := envKeys_mono h (fun k hk => List.mem_cons_of_mem p.1 hk)
have hid : ∀ q, EnvKeys { E with QE := addQ q id E.QE } (p.1 :: K) :=
fun q => envKeys_addQ q id h' (fun I x b hx => .inl hx)
obtain ⟨⟨q, i⟩, mids⟩ := p
cases q with
| none =>
cases i with
| ty c =>
rcases mids with _ | ⟨mid, _ | ⟨mid2, rest⟩⟩ <;> simp only [envStep] <;> try exact h'
split
· exact h'
· exact h'
| val x =>
rcases mids with _ | ⟨mid, _ | ⟨mid2, rest⟩⟩ <;> simp only [envStep] <;> try exact h'
split
· rename_i b0 _
refine ⟨fun y b hy => ?_, h'.2⟩
simp only [FMap.find?] at hy
split at hy
· rename_i e; subst e; simp
· exact h'.1 y b hy
· exact h'
| some q =>
cases i with
| ty c =>
rcases mids with _ | ⟨mid, _ | ⟨mid2, rest⟩⟩ <;> simp only [envStep] <;> try exact hid q
split
· exact envKeys_addQ q _ h' (fun I x b hx => .inl hx)
· exact hid q
| val x =>
rcases mids with _ | ⟨mid, _ | ⟨mid2, rest⟩⟩ <;> simp only [envStep] <;> try exact hid q
split
· refine envKeys_addQ q _ h' (fun I y b hy => ?_)
simp only [FMap.find?] at hy
split at hy
· rename_i e; subst e; exact .inr (by simp)
· exact .inl hy
· exact hid qProved with tactics, which Lean expands into a proof term that its kernel checks.
Theorems it uses
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.