Theoremassigns_cover
Statement
theorem assigns_cover (P Q : String → Prop) [DecidablePred P] [DecidablePred Q] :
∀ ns : List String, ∃ U ∈ assigns ns, ∀ s,
(BVar.ty (.named s) ∈ U ↔ s ∈ ns ∧ P s) ∧ (BVar.row (.named s) ∈ U ↔ s ∈ ns ∧ Q s)
| [] => ⟨[], by simp [assigns], by simp⟩
| n :: ns => by
obtain ⟨U0, hU0, h0⟩Proof
assigns_cover P Q ns
have key : ∀ U ∈ [U0, .ty (.named n) :: U0, .row (.named n) :: U0, .ty (.named n) :: .row (.named n) :: U0],
U ∈ assigns (n :: ns) := by
intro U hU
simp only [assigns, List.mem_flatMap]
exact ⟨U0, hU0, hU⟩
by_cases hp : P n <;> by_cases hq : Q n
· refine ⟨_, key (.ty (.named n) :: .row (.named n) :: U0) (by simp), fun s => ?_⟩
have := h0 s
by_cases e : s = n
· subst e; simp [hp, hq]
· simp [e, this]
· refine ⟨_, key (.ty (.named n) :: U0) (by simp), fun s => ?_⟩
have := h0 s
by_cases e : s = n
· subst e; simp [hp, hq, this]
· simp [e, this]
· refine ⟨_, key (.row (.named n) :: U0) (by simp), fun s => ?_⟩
have := h0 s
by_cases e : s = n
· subst e; simp [hp, hq, this]
· simp [e, this]
· refine ⟨_, key U0 (by simp), fun s => ?_⟩
have := h0 s
by_cases e : s = n
· subst e; simp [hp, hq, this]
· simp [e, this]Proved by a term, which Lean's kernel checks directly.
Used by
In StandardElmMech/Stat/RefuseTypes.lean: Refusals by type expressions (aliases, constructor arguments, annotations, ports) and by the type of main (typesFailB, mainFailB), for every choice of generated names and variable sorts.
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.