induct: fixes x1 :: "nat list \<times> nat list \<times> (nat \<Rightarrow> pdf_type) \<times> cexpr"   and x2 :: "expr"   and x3 :: "cexpr"   and P :: "nat list \<times> nat list \<times> (nat \<Rightarrow> pdf_type) \<times> cexpr \<Rightarrow> expr \<Rightarrow> cexpr \<Rightarrow> bool" assumes "x1 \<turnstile>\<^sub>c x2 \<Rightarrow> x3"   and "\<And>v vs vs' \<Gamma> \<delta>. countable_type (val_type v) \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Val v) (map_vars Suc (branch_prob_cexpr (vs, vs', \<Gamma>, \<delta>)) *\<^sub>c \<langle>CVar 0 =\<^sub>c CVal v\<rangle>\<^sub>c)"   and "\<And>x vs vs' \<Gamma> \<delta>. x \<in> set vs \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Var x) (marg_dens_cexpr \<Gamma> vs x \<delta>)"   and "\<And>x vs y vs' \<Gamma> \<delta>. \<lbrakk>x \<in> set vs; y \<in> set vs; x \<noteq> y\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) <Var x ,  Var y> (marg_dens2_cexpr \<Gamma> vs x y \<delta>)"   and "\<And>vs vs' \<Gamma> \<delta> t. P (vs, vs', \<Gamma>, \<delta>) (Fail t) (CReal 0)"   and "\<And>vs vs' \<Gamma> e f \<delta> e' g. \<lbrakk>([], vs @ vs', \<Gamma>, CReal 1) \<turnstile>\<^sub>c e \<Rightarrow> f; P ([], vs @ vs', \<Gamma>, CReal 1) e f; (shift_vars vs, map Suc vs', case_nat (the (expr_type \<Gamma> e)) \<Gamma>, map_vars Suc \<delta> *\<^sub>c f) \<turnstile>\<^sub>c e' \<Rightarrow> g; P (shift_vars vs, map Suc vs', case_nat (the (expr_type \<Gamma> e)) \<Gamma>, map_vars Suc \<delta> *\<^sub>c f) e' g\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (LET e IN e') (map_vars (\<lambda>x. x - 1) g)"   and "\<And>vs vs' \<Gamma> \<delta> e f dst. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Random dst e) (\<integral>\<^sub>c map_vars (case_nat 0 (\<lambda>x. x + 2)) f *\<^sub>c dist_dens_cexpr dst (CVar 0) (CVar 1) \<partial>dist_param_type dst)"   and "\<And>e vs' vs \<Gamma> \<delta> dst. \<lbrakk>randomfree e; free_vars e \<subseteq> set vs'\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Random dst e) (map_vars Suc (branch_prob_cexpr (vs, vs', \<Gamma>, \<delta>)) *\<^sub>c dist_dens_cexpr dst (map_vars Suc (expr_rf_to_cexpr e)) (CVar 0))"   and "\<And>b vs vs' \<Gamma> \<delta> e1 f1 e2 f2. \<lbrakk>randomfree b; (vs, vs', \<Gamma>, \<delta> *\<^sub>c \<langle>expr_rf_to_cexpr b\<rangle>\<^sub>c) \<turnstile>\<^sub>c e1 \<Rightarrow> f1; P (vs, vs', \<Gamma>, \<delta> *\<^sub>c \<langle>expr_rf_to_cexpr b\<rangle>\<^sub>c) e1 f1; (vs, vs', \<Gamma>, \<delta> *\<^sub>c \<langle>\<not>\<^sub>c expr_rf_to_cexpr b\<rangle>\<^sub>c) \<turnstile>\<^sub>c e2 \<Rightarrow> f2; P (vs, vs', \<Gamma>, \<delta> *\<^sub>c \<langle>\<not>\<^sub>c expr_rf_to_cexpr b\<rangle>\<^sub>c) e2 f2\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (IF b THEN e1 ELSE e2) (f1 +\<^sub>c f2)"   and "\<And>vs vs' \<Gamma> b f \<delta> e1 g1 e2 g2. \<lbrakk>([], vs @ vs', \<Gamma>, CReal 1) \<turnstile>\<^sub>c b \<Rightarrow> f; P ([], vs @ vs', \<Gamma>, CReal 1) b f; (vs, vs', \<Gamma>, \<delta> *\<^sub>c cexpr_subst_val f TRUE) \<turnstile>\<^sub>c e1 \<Rightarrow> g1; P (vs, vs', \<Gamma>, \<delta> *\<^sub>c cexpr_subst_val f TRUE) e1 g1; (vs, vs', \<Gamma>, \<delta> *\<^sub>c cexpr_subst_val f FALSE) \<turnstile>\<^sub>c e2 \<Rightarrow> g2; P (vs, vs', \<Gamma>, \<delta> *\<^sub>c cexpr_subst_val f FALSE) e2 g2\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (IF b THEN e1 ELSE e2) (g1 +\<^sub>c g2)"   and "\<And>vs vs' \<Gamma> \<delta> e f t oper t'. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; \<Gamma> \<turnstile> e : t; op_type oper t = Some t'; countable_type t'\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (oper $$ e) (\<integral>\<^sub>c \<langle>oper $$\<^sub>c (CVar 0) =\<^sub>c CVar 1\<rangle>\<^sub>c *\<^sub>c map_vars (case_nat 0 (\<lambda>x. x + 2)) f \<partial>t)"   and "\<And>vs vs' \<Gamma> \<delta> e f t t'. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; \<Gamma> \<turnstile> e : PRODUCT t t'\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Fst $$ e) (\<integral>\<^sub>c (map_vars (case_nat 0 (\<lambda>x. x + 2)) f \<circ>\<^sub>c <CVar 1, CVar 0>\<^sub>c) \<partial>t')"   and "\<And>vs vs' \<Gamma> \<delta> e f t t'. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; \<Gamma> \<turnstile> e : PRODUCT t t'\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Snd $$ e) (\<integral>\<^sub>c (map_vars (case_nat 0 (\<lambda>x. x + 2)) f \<circ>\<^sub>c <CVar 0, CVar 1>\<^sub>c) \<partial>t)"   and "\<And>vs vs' \<Gamma> \<delta> e f. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Minus $$ e) (f \<circ>\<^sub>c -\<^sub>c CVar 0)"   and "\<And>vs vs' \<Gamma> \<delta> e f e'. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; randomfree e'; free_vars e' \<subseteq> set vs'\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Add $$ <e ,  e'>) (f \<circ>\<^sub>c CVar 0 -\<^sub>c map_vars Suc (expr_rf_to_cexpr e'))"   and "\<And>vs vs' \<Gamma> \<delta> e f c. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; c \<noteq> 0\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Mult $$ <e ,  Val (RealVal c)>) ((f \<circ>\<^sub>c CVar 0 *\<^sub>c CReal (inverse c)) *\<^sub>c CReal (inverse \<bar>c\<bar>))"   and "\<And>vs vs' \<Gamma> \<delta> e f t. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f; \<Gamma> \<turnstile> e : PRODUCT t t\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Add $$ e) (\<integral>\<^sub>c (map_vars (case_nat 0 (\<lambda>x. x + 2)) f \<circ>\<^sub>c <CVar 0, CVar 1 -\<^sub>c CVar 0>\<^sub>c) \<partial>t)"   and "\<And>vs vs' \<Gamma> \<delta> e f. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Inverse $$ e) ((f \<circ>\<^sub>c inverse\<^sub>c (CVar 0)) *\<^sub>c inverse\<^sub>c (CVar 0) ^\<^sub>c CInt 2)"   and "\<And>vs vs' \<Gamma> \<delta> e f. \<lbrakk>(vs, vs', \<Gamma>, \<delta>) \<turnstile>\<^sub>c e \<Rightarrow> f; P (vs, vs', \<Gamma>, \<delta>) e f\<rbrakk> \<Longrightarrow> P (vs, vs', \<Gamma>, \<delta>) (Exp $$ e) (IF\<^sub>c CReal 0 <\<^sub>c CVar 0 THEN (f \<circ>\<^sub>c ln\<^sub>c (CVar 0)) /\<^sub>c CVar 0 ELSE CReal 0)" shows "P x1 x2 x3"