src/HOL/Tools/Function/partial_function.ML
changeset 60642 48dd1cefb4ae
parent 59936 b8ffc3dc9e24
child 60695 757549b4bbe6
equal deleted inserted replaced
60641:f6e8293747fd 60642:48dd1cefb4ae
   198         Conv.implies_conv split_paired_all_conv Conv.all_conv)
   198         Conv.implies_conv split_paired_all_conv Conv.all_conv)
   199 
   199 
   200     val (P_var, x_var) =
   200     val (P_var, x_var) =
   201        Thm.prop_of inst_rule |> Logic.strip_imp_concl |> HOLogic.dest_Trueprop
   201        Thm.prop_of inst_rule |> Logic.strip_imp_concl |> HOLogic.dest_Trueprop
   202       |> strip_comb |> apsnd hd
   202       |> strip_comb |> apsnd hd
   203     val P_rangeT = range_type (snd (Term.dest_Var P_var))
   203       |> apply2 dest_Var
       
   204     val P_rangeT = range_type (snd P_var)
   204     val PT = map (snd o dest_Free) args ---> P_rangeT
   205     val PT = map (snd o dest_Free) args ---> P_rangeT
   205     val x_inst = cert (foldl1 HOLogic.mk_prod args)
   206     val x_inst = cert (foldl1 HOLogic.mk_prod args)
   206     val P_inst = cert (uncurry_n (length args) (Free (P, PT)))
   207     val P_inst = cert (uncurry_n (length args) (Free (P, PT)))
   207 
   208 
   208     val inst_rule' = inst_rule
   209     val inst_rule' = inst_rule
   209       |> Tactic.rule_by_tactic ctxt
   210       |> Tactic.rule_by_tactic ctxt
   210         (Simplifier.simp_tac (put_simpset curry_uncurry_ss ctxt) 4
   211         (Simplifier.simp_tac (put_simpset curry_uncurry_ss ctxt) 4
   211          THEN Simplifier.simp_tac (put_simpset curry_uncurry_ss ctxt) 3
   212          THEN Simplifier.simp_tac (put_simpset curry_uncurry_ss ctxt) 3
   212          THEN CONVERSION (split_params_conv ctxt
   213          THEN CONVERSION (split_params_conv ctxt
   213            then_conv (Conv.forall_conv (K split_paired_all_conv) ctxt)) 3)
   214            then_conv (Conv.forall_conv (K split_paired_all_conv) ctxt)) 3)
   214       |> Thm.instantiate ([], [(cert P_var, P_inst), (cert x_var, x_inst)]) 
   215       |> Thm.instantiate ([], [(P_var, P_inst), (x_var, x_inst)])
   215       |> Simplifier.full_simplify (put_simpset split_conv_ss ctxt)
   216       |> Simplifier.full_simplify (put_simpset split_conv_ss ctxt)
   216       |> singleton (Variable.export ctxt' ctxt)
   217       |> singleton (Variable.export ctxt' ctxt)
   217   in
   218   in
   218     inst_rule'
   219     inst_rule'
   219   end;
   220   end;