induct: fixes x1 :: "nat set \<times> nat set \<times> (nat \<Rightarrow> pdf_type) \<times> ((nat \<Rightarrow> val) \<Rightarrow> ennreal)"   and x2 :: "expr"   and x3 :: "(nat \<Rightarrow> val) \<Rightarrow> val \<Rightarrow> ennreal"   and P :: "nat set \<times> nat set \<times> (nat \<Rightarrow> pdf_type) \<times> ((nat \<Rightarrow> val) \<Rightarrow> ennreal) \<Rightarrow> expr \<Rightarrow> ((nat \<Rightarrow> val) \<Rightarrow> val \<Rightarrow> ennreal) \<Rightarrow> bool" assumes "x1 \<turnstile>\<^sub>d x2 \<Rightarrow> x3"   and "\<And>V V' \<Gamma> \<delta> e f t f'. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f; \<Gamma> \<turnstile> e : t; \<And>\<rho>. \<rho> \<in> space (state_measure V' \<Gamma>) \<Longrightarrow> AE x in stock_measure t. f \<rho> x = f' \<rho> x; (\<lambda>(x, y). f' x y) \<in> borel_measurable (state_measure V' \<Gamma> \<Otimes>\<^sub>M stock_measure t)\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) e f'"   and "\<And>V V' \<Gamma> \<delta> e f \<delta>'. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f; \<And>\<sigma>. \<sigma> \<in> space (state_measure (V \<union> V') \<Gamma>) \<Longrightarrow> \<delta> \<sigma> = \<delta>' \<sigma>\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>') e f"   and "\<And>v V V' \<Gamma> \<delta>. countable_type (val_type v) \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Val v) (\<lambda>\<rho> x. branch_prob (V, V', \<Gamma>, \<delta>) \<rho> * indicator {v} x)"   and "\<And>x V V' \<Gamma> \<delta>. x \<in> V \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Var x) (marg_dens (V, V', \<Gamma>, \<delta>) x)"   and "\<And>V V' \<Gamma> e1 f \<delta> e2 g. \<lbrakk>({}, V \<union> V', \<Gamma>, \<lambda>_. 1) \<turnstile>\<^sub>d e1 \<Rightarrow> f; P ({}, V \<union> V', \<Gamma>, \<lambda>_. 1) e1 f; (shift_var_set V, Suc ` V', case_nat (the (expr_type \<Gamma> e1)) \<Gamma>, insert_dens V V' f \<delta>) \<turnstile>\<^sub>d e2 \<Rightarrow> g; P (shift_var_set V, Suc ` V', case_nat (the (expr_type \<Gamma> e1)) \<Gamma>, insert_dens V V' f \<delta>) e2 g\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (LET e1 IN e2) (\<lambda>\<rho>. g (case_nat undefined \<rho>))"   and "\<And>V V' \<Gamma> \<delta> e f dst. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Random dst e) (apply_dist_to_dens dst f)"   and "\<And>e V' V \<Gamma> \<delta> dst. \<lbrakk>randomfree e; free_vars e \<subseteq> V'\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Random dst e) (\<lambda>\<rho> x. branch_prob (V, V', \<Gamma>, \<delta>) \<rho> * dist_dens dst (expr_sem_rf \<rho> e) x)"   and "\<And>V V' \<Gamma> \<delta> t. P (V, V', \<Gamma>, \<delta>) (Fail t) (\<lambda>_ _. 0)"   and "\<And>x V y V' \<Gamma> \<delta>. \<lbrakk>x \<in> V; y \<in> V; x \<noteq> y\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) <Var x ,  Var y> (marg_dens2 (V, V', \<Gamma>, \<delta>) x y)"   and "\<And>V V' \<Gamma> b f \<delta> e1 g1 e2 g2. \<lbrakk>({}, V \<union> V', \<Gamma>, \<lambda>_. 1) \<turnstile>\<^sub>d b \<Rightarrow> f; P ({}, V \<union> V', \<Gamma>, \<lambda>_. 1) b f; (V, V', \<Gamma>, if_dens \<delta> f True) \<turnstile>\<^sub>d e1 \<Rightarrow> g1; P (V, V', \<Gamma>, if_dens \<delta> f True) e1 g1; (V, V', \<Gamma>, if_dens \<delta> f False) \<turnstile>\<^sub>d e2 \<Rightarrow> g2; P (V, V', \<Gamma>, if_dens \<delta> f False) e2 g2\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (IF b THEN e1 ELSE e2) (\<lambda>\<rho> x. g1 \<rho> x + g2 \<rho> x)"   and "\<And>b V V' \<Gamma> \<delta> e1 g1 e2 g2. \<lbrakk>randomfree b; (V, V', \<Gamma>, if_dens_det \<delta> b True) \<turnstile>\<^sub>d e1 \<Rightarrow> g1; P (V, V', \<Gamma>, if_dens_det \<delta> b True) e1 g1; (V, V', \<Gamma>, if_dens_det \<delta> b False) \<turnstile>\<^sub>d e2 \<Rightarrow> g2; P (V, V', \<Gamma>, if_dens_det \<delta> b False) e2 g2\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (IF b THEN e1 ELSE e2) (\<lambda>\<rho> x. g1 \<rho> x + g2 \<rho> x)"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Fst $$ e) (\<lambda>\<rho> x. \<integral>\<^sup>+ y. f \<rho> <|x, y|> \<partial>stock_measure (the (expr_type \<Gamma> (Snd $$ e))))"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Snd $$ e) (\<lambda>\<rho> y. \<integral>\<^sup>+ x. f \<rho> <|x, y|> \<partial>stock_measure (the (expr_type \<Gamma> (Fst $$ e))))"   and "\<And>\<Gamma> oper e V V' \<delta> f. \<lbrakk>countable_type (the (expr_type \<Gamma> (oper $$ e))); (V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (oper $$ e) (\<lambda>\<rho> y. \<integral>\<^sup>+ x. (if op_sem oper x = y then 1 else 0) * f \<rho> x \<partial>stock_measure (the (expr_type \<Gamma> e)))"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Minus $$ e) (\<lambda>\<sigma> x. f \<sigma> (op_sem Minus x))"   and "\<And>V V' \<Gamma> \<delta> e f e'. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f; randomfree e'; free_vars e' \<subseteq> V'\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Add $$ <e ,  e'>) (\<lambda>\<rho> x. f \<rho> (op_sem Add <|x, expr_sem_rf \<rho> (Minus $$ e')|>))"   and "\<And>V V' \<Gamma> \<delta> e f c. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f; val_type c = REAL; c \<noteq> RealVal 0\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Mult $$ <e ,  Val c>) (\<lambda>\<rho> x. f \<rho> (op_sem Mult <|x, op_sem Inverse c|>) * ennreal (inverse \<bar>extract_real c\<bar>))"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Exp $$ e) (\<lambda>\<sigma> x. if 0 < extract_real x then f \<sigma> (lift_RealVal safe_ln x) * ennreal (inverse (extract_real x)) else 0)"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Inverse $$ e) (\<lambda>\<sigma> x. f \<sigma> (op_sem Inverse x) * ennreal ((inverse (extract_real x))\<^sup>2))"   and "\<And>V V' \<Gamma> \<delta> e f. \<lbrakk>(V, V', \<Gamma>, \<delta>) \<turnstile>\<^sub>d e \<Rightarrow> f; P (V, V', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (V, V', \<Gamma>, \<delta>) (Add $$ e) (\<lambda>\<sigma> z. \<integral>\<^sup>+ x. f \<sigma> <|x, op_sem Add <|z, op_sem Minus x|>|> \<partial>stock_measure (val_type z))" shows "P x1 x2 x3"