Inversion of the typing relation #
A derivation of Typed Γ e T ends with the rule for the head constructor of e, followed by
any number of subsumption steps. Each lemma here inverts one constructor: the premises of its
rule hold for some type below T. Mean sites are omitted: completions contain none.
theorem
Determinize.Proof.Frontend.typed_bvar_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{i : ℕ}
(h : Spec.Paper.Typed Γ (Spec.Paper.Expr.bvar ℝ Spec.Paper.DistributionAction i) T)
:
∃ (T₀ : Spec.Paper.Ty), Spec.Paper.HasVar Γ i T₀ ∧ T₀.Sub T
theorem
Determinize.Proof.Frontend.typed_unit_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
(h : Spec.Paper.Typed Γ Spec.Paper.Expr.unit T)
:
theorem
Determinize.Proof.Frontend.typed_bool_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{b : Bool}
(h : Spec.Paper.Typed Γ (Spec.Paper.Expr.bool ℝ Spec.Paper.DistributionAction b) T)
:
theorem
Determinize.Proof.Frontend.typed_real_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{q : ℝ}
(h : Spec.Paper.Typed Γ (Spec.Paper.Expr.real ℝ Spec.Paper.DistributionAction q) T)
:
∃ (m : Spec.Paper.Affinity), (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_lam_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{b : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (b.lam ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (R : Spec.Paper.Ty), Spec.Paper.Typed (A :: Γ) b R ∧ (A.arr R).Sub T
theorem
Determinize.Proof.Frontend.typed_fix_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{b : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (b.fix ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (R : Spec.Paper.Ty), Spec.Paper.Typed (A :: A.arr R :: Γ) b R ∧ (A.arr R).Sub T
theorem
Determinize.Proof.Frontend.typed_app_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{f x : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (f.app ℝ Spec.Paper.DistributionAction x) T)
:
∃ (A : Spec.Paper.Ty) (R : Spec.Paper.Ty), Spec.Paper.Typed Γ f (A.arr R) ∧ Spec.Paper.Typed Γ x A ∧ R.Sub T
theorem
Determinize.Proof.Frontend.typed_pair_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (l.pair ℝ Spec.Paper.DistributionAction r) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty), Spec.Paper.Typed Γ l A ∧ Spec.Paper.Typed Γ r B ∧ (A.prod B).Sub T
theorem
Determinize.Proof.Frontend.typed_fst_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{p : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (p.fst ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty), Spec.Paper.Typed Γ p (A.prod B) ∧ A.Sub T
theorem
Determinize.Proof.Frontend.typed_snd_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{p : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (p.snd ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty), Spec.Paper.Typed Γ p (A.prod B) ∧ B.Sub T
theorem
Determinize.Proof.Frontend.typed_inl_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{v : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (v.inl ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty), Spec.Paper.Typed Γ v A ∧ (A.sum B).Sub T
theorem
Determinize.Proof.Frontend.typed_inr_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{v : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (v.inr ℝ Spec.Paper.DistributionAction) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty), Spec.Paper.Typed Γ v B ∧ (A.sum B).Sub T
theorem
Determinize.Proof.Frontend.typed_matchSum_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{s l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (s.matchSum ℝ Spec.Paper.DistributionAction l r) T)
:
∃ (A : Spec.Paper.Ty) (B : Spec.Paper.Ty) (R : Spec.Paper.Ty),
Spec.Paper.Typed Γ s (A.sum B) ∧ Spec.Paper.Typed (A :: Γ) l R ∧ Spec.Paper.Typed (B :: Γ) r R ∧ R.Sub T
theorem
Determinize.Proof.Frontend.typed_nil_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
(h : Spec.Paper.Typed Γ Spec.Paper.Expr.nil T)
:
∃ (A : Spec.Paper.Ty), A.list.Sub T
theorem
Determinize.Proof.Frontend.typed_cons_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{hd tl : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (hd.cons ℝ Spec.Paper.DistributionAction tl) T)
:
∃ (A : Spec.Paper.Ty), Spec.Paper.Typed Γ hd A ∧ Spec.Paper.Typed Γ tl A.list ∧ A.list.Sub T
theorem
Determinize.Proof.Frontend.typed_matchList_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{s n c : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (s.matchList ℝ Spec.Paper.DistributionAction n c) T)
:
∃ (A : Spec.Paper.Ty) (R : Spec.Paper.Ty),
Spec.Paper.Typed Γ s A.list ∧ Spec.Paper.Typed Γ n R ∧ Spec.Paper.Typed (A :: A.list :: Γ) c R ∧ R.Sub T
theorem
Determinize.Proof.Frontend.typed_ite_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{c a b : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (c.ite ℝ Spec.Paper.DistributionAction a b) T)
:
∃ (R : Spec.Paper.Ty),
Spec.Paper.Typed Γ c Spec.Paper.Ty.bool ∧ Spec.Paper.Typed Γ a R ∧ Spec.Paper.Typed Γ b R ∧ R.Sub T
theorem
Determinize.Proof.Frontend.typed_letE_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{v b : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (v.letE ℝ Spec.Paper.DistributionAction b) T)
:
∃ (V : Spec.Paper.Ty) (R : Spec.Paper.Ty), Spec.Paper.Typed Γ v V ∧ Spec.Paper.Typed (V :: Γ) b R ∧ R.Sub T
theorem
Determinize.Proof.Frontend.typed_neg_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{b : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (b.neg ℝ Spec.Paper.DistributionAction) T)
:
∃ (m : Spec.Paper.Affinity), Spec.Paper.Typed Γ b (Spec.Paper.Ty.float m) ∧ (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_add_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (l.add ℝ Spec.Paper.DistributionAction r) T)
:
∃ (m : Spec.Paper.Affinity),
Spec.Paper.Typed Γ l (Spec.Paper.Ty.float m) ∧ Spec.Paper.Typed Γ r (Spec.Paper.Ty.float m) ∧ (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_mul_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (l.mul ℝ Spec.Paper.DistributionAction r) T)
:
∃ (m : Spec.Paper.Affinity),
Spec.Paper.Typed Γ l (Spec.Paper.Ty.float Spec.Paper.Affinity.G) ∧ Spec.Paper.Typed Γ r (Spec.Paper.Ty.float m) ∧ (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_div_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (l.div ℝ Spec.Paper.DistributionAction r) T)
:
∃ (m : Spec.Paper.Affinity),
Spec.Paper.Typed Γ l (Spec.Paper.Ty.float m) ∧ Spec.Paper.Typed Γ r (Spec.Paper.Ty.float Spec.Paper.Affinity.G) ∧ (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_lt_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{l r : Spec.Paper.Expr}
(h : Spec.Paper.Typed Γ (l.lt ℝ Spec.Paper.DistributionAction r) T)
:
theorem
Determinize.Proof.Frontend.typed_uniform_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{l u : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.uniform ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) l u) T)
:
Spec.Paper.Typed Γ l (Spec.Paper.Ty.float m) ∧ Spec.Paper.Typed Γ u (Spec.Paper.Ty.float m) ∧ (Spec.Paper.Ty.float m).Sub T
theorem
Determinize.Proof.Frontend.typed_gaussian_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a b : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.gaussian ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a b) T)
:
theorem
Determinize.Proof.Frontend.typed_poisson_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.poisson ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a) T)
:
theorem
Determinize.Proof.Frontend.typed_discrete_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.discrete ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a) T)
:
theorem
Determinize.Proof.Frontend.typed_bernoulli_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.bernoulli ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a) T)
:
theorem
Determinize.Proof.Frontend.typed_exponential_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.exponential ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a) T)
:
theorem
Determinize.Proof.Frontend.typed_beta_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a b : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ (Spec.Paper.Expr.beta ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a b)
T)
:
theorem
Determinize.Proof.Frontend.typed_gamma_inv
{Γ : List Spec.Paper.Ty}
{T : Spec.Paper.Ty}
{m : Spec.Paper.Affinity}
{a b : Spec.Paper.Expr}
(h :
Spec.Paper.Typed Γ
(Spec.Paper.Expr.gamma ℝ Spec.Paper.DistributionAction (Spec.Paper.DistributionAction.sample m) a b) T)
:
theorem
Determinize.Proof.Frontend.hasVar_iff
{Γ : List Spec.Paper.Ty}
{i : ℕ}
{A : Spec.Paper.Ty}
:
A variable has the type at its index in the context.