Nominal/nominal_dt_supp.ML
author Christian Urban <urbanc@in.tum.de>
Fri, 10 Sep 2010 09:17:40 +0800
changeset 2475 486d4647bb37
parent 2451 d2e929f51fa9
child 2481 3a5ebb2fcdbf
permissions -rw-r--r--
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
(*  Title:      nominal_dt_alpha.ML
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
    Author:     Christian Urban
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
    Author:     Cezary Kaliszyk
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
  Deriving support propoerties for the quotient types.
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
*)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
signature NOMINAL_DT_SUPP =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
sig
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  val prove_supports: Proof.context -> thm list -> term list -> thm list  
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    11
  val prove_fsupp: Proof.context -> typ list -> thm -> thm list -> thm list
2451
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    12
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    13
  val fs_instance: typ list -> string list -> (string * sort) list -> thm list ->  
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    14
    local_theory -> local_theory
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    15
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    16
  val prove_fv_supp: typ list -> term list -> term list -> term list -> thm list -> thm list -> 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    17
    thm list -> thm list -> thm list -> thm list -> bclause list list -> Proof.context -> thm list 
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
end
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
structure Nominal_Dt_Supp: NOMINAL_DT_SUPP =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
struct
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    23
fun lookup xs x = the (AList.lookup (op=) xs x)
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    25
(* supports lemmas for constructors *)
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
fun mk_supports_goal ctxt qtrm =
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    28
  let  
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    29
    val vs = fresh_args ctxt qtrm
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    30
    val rhs = list_comb (qtrm, vs)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    31
    val lhs = fold (curry HOLogic.mk_prod) vs @{term "()"}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    32
      |> mk_supp
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    33
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    34
    mk_supports lhs rhs
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    35
    |> HOLogic.mk_Trueprop
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    36
  end
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
fun supports_tac ctxt perm_simps =
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    39
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    40
    val ss1 = HOL_basic_ss addsimps @{thms supports_def fresh_def[symmetric]}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    41
    val ss2 = HOL_ss addsimps @{thms swap_fresh_fresh fresh_Pair}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    42
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    43
    EVERY' [ simp_tac ss1,
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    44
             Nominal_Permeq.eqvt_strict_tac ctxt perm_simps [],
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    45
             simp_tac ss2 ]
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    46
  end
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
fun prove_supports_single ctxt perm_simps qtrm =
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    49
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    50
    val goal = mk_supports_goal ctxt qtrm 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    51
    val ctxt' = Variable.auto_fixes goal ctxt
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    52
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    53
    Goal.prove ctxt' [] [] goal
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    54
      (K (HEADGOAL (supports_tac ctxt perm_simps)))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    55
    |> singleton (ProofContext.export ctxt' ctxt)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    56
  end
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
fun prove_supports ctxt perm_simps qtrms =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  map (prove_supports_single ctxt perm_simps) qtrms
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    62
(* finite supp lemmas for qtypes *)
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    64
fun prove_fsupp ctxt qtys qinduct qsupports_thms =
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    65
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    66
    val (vs, ctxt') = Variable.variant_fixes (replicate (length qtys) "x") ctxt
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    67
    val goals = vs ~~ qtys
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    68
      |> map Free
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    69
      |> map (mk_finite o mk_supp)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    70
      |> foldr1 (HOLogic.mk_conj)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    71
      |> HOLogic.mk_Trueprop
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    72
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    73
    val tac = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    74
      EVERY' [ rtac @{thm supports_finite},
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    75
               resolve_tac qsupports_thms,
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    76
               asm_simp_tac (HOL_ss addsimps @{thms finite_supp supp_Pair finite_Un}) ]
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    77
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    78
    Goal.prove ctxt' [] [] goals
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    79
      (K (HEADGOAL (rtac qinduct THEN_ALL_NEW tac)))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    80
    |> singleton (ProofContext.export ctxt' ctxt)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    81
    |> Datatype_Aux.split_conj_thm
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    82
    |> map zero_var_indexes
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    83
  end
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
2451
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    85
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    86
(* finite supp instances *)
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    87
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    88
fun fs_instance qtys qfull_ty_names tvs qfsupp_thms lthy =
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    89
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    90
    val lthy1 = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    91
      lthy
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    92
      |> Local_Theory.exit_global
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    93
      |> Class.instantiation (qfull_ty_names, tvs, @{sort fs}) 
2451
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
    94
  
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    95
    fun tac _ =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    96
      Class.intro_classes_tac [] THEN
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    97
        (ALLGOALS (resolve_tac qfsupp_thms))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    98
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
    99
    lthy1
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   100
    |> Class.prove_instantiation_exit tac 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   101
    |> Named_Target.theory_init
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   102
  end
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   103
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   104
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   105
(* proves that fv and fv_bn equals supp *)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   106
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   107
fun mk_fvs_goals ty_arg_map fv =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   108
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   109
    val arg = fastype_of fv
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   110
      |> domain_type
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   111
      |> lookup ty_arg_map
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   112
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   113
    (fv $ arg, mk_supp arg)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   114
      |> HOLogic.mk_eq
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   115
      |> HOLogic.mk_Trueprop 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   116
  end
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   117
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   118
fun mk_fv_bns_goals ty_arg_map fv_bn alpha_bn =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   119
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   120
    val arg = fastype_of fv_bn
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   121
      |> domain_type
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   122
      |> lookup ty_arg_map
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   123
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   124
    (fv_bn $ arg, mk_supp_rel alpha_bn arg)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   125
      |> HOLogic.mk_eq
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   126
      |> HOLogic.mk_Trueprop 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   127
  end
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   128
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   129
fun add_ss thms =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   130
  HOL_basic_ss addsimps thms
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   131
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   132
fun symmetric thms = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   133
  map (fn thm => thm RS @{thm sym}) thms
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   134
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   135
val supp_abs_set = @{thms supp_abs(1)[symmetric]}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   136
val supp_abs_res = @{thms supp_abs(2)[symmetric]}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   137
val supp_abs_lst = @{thms supp_abs(3)[symmetric]}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   138
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   139
fun mk_supp_abs ctxt (BC (Set, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_abs_set 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   140
  | mk_supp_abs ctxt (BC (Res, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_abs_res
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   141
  | mk_supp_abs ctxt (BC (Lst, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_abs_lst
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   142
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   143
fun mk_supp_abs_tac ctxt [] = []
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   144
  | mk_supp_abs_tac ctxt (BC (_, [], _)::xs) = mk_supp_abs_tac ctxt xs
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   145
  | mk_supp_abs_tac ctxt (bc::xs) = (DETERM o mk_supp_abs ctxt bc)::mk_supp_abs_tac ctxt xs
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   146
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   147
fun mk_bn_supp_abs_tac thm =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   148
  (prop_of thm)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   149
  |> HOLogic.dest_Trueprop
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   150
  |> snd o HOLogic.dest_eq
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   151
  |> fastype_of
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   152
  |> (fn ty => case ty of
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   153
        @{typ "atom set"}  => simp_tac (add_ss supp_abs_set)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   154
      | @{typ "atom list"} => simp_tac (add_ss supp_abs_lst)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   155
      | _ => raise TERM ("mk_bn_supp_abs_tac", [prop_of thm]))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   156
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   157
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   158
val thms1 = @{thms supp_Pair supp_eqvt[symmetric] Un_assoc conj_assoc}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   159
val thms2 = @{thms de_Morgan_conj Collect_disj_eq finite_Un}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   160
val thms3 = @{thms alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   161
  prod.recs prod.cases prod.inject not_True_eq_False empty_def[symmetric] Finite_Set.finite.emptyI}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   162
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   163
fun ind_tac ctxt qinducts = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   164
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   165
    fun CASES_TAC_TO_TAC cases_tac st = Seq.map snd (cases_tac st)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   166
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   167
    DETERM o (CASES_TAC_TO_TAC o (Induct.induct_tac ctxt false [] [] [] (SOME qinducts) []))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   168
  end
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   169
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   170
fun p_tac msg i = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   171
  if false then print_tac ("ptest: " ^ msg) else all_tac
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   172
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   173
fun q_tac msg i = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   174
  if true then print_tac ("qtest: " ^ msg) else all_tac
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   175
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   176
fun prove_fv_supp qtys fvs fv_bns alpha_bns bn_simps fv_simps eq_iffs perm_simps 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   177
  fv_bn_eqvts qinducts bclausess ctxt =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   178
  let
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   179
    val (arg_names, ctxt') = 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   180
      Variable.variant_fixes (replicate (length qtys) "x") ctxt 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   181
    val args = map2 (curry Free) arg_names qtys 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   182
    val ty_arg_map = qtys ~~ args
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   183
    val ind_args = map SOME arg_names
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   184
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   185
    val goals1 = map (mk_fvs_goals ty_arg_map) fvs
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   186
    val goals2 = map2 (mk_fv_bns_goals ty_arg_map) fv_bns alpha_bns
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   187
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   188
    fun fv_tac ctxt bclauses =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   189
      SOLVED' (EVERY' [
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   190
        (fn i => print_tac ("FV Goal: " ^ string_of_int i ^ "  with  " ^ (@{make_string} bclauses))),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   191
        TRY o asm_full_simp_tac (add_ss (@{thm supp_Pair[symmetric]}::fv_simps)), 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   192
        p_tac "A",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   193
        TRY o EVERY' (mk_supp_abs_tac ctxt bclauses),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   194
        p_tac "B",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   195
        TRY o simp_tac (add_ss @{thms supp_def supp_rel_def}),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   196
        p_tac "C",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   197
        TRY o Nominal_Permeq.eqvt_tac ctxt (perm_simps @ fv_bn_eqvts) [], 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   198
        p_tac "D",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   199
        TRY o simp_tac (add_ss (@{thms Abs_eq_iff} @ eq_iffs)),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   200
        p_tac "E",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   201
        TRY o asm_full_simp_tac (add_ss thms3),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   202
        p_tac "F",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   203
        TRY o simp_tac (add_ss thms2),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   204
        p_tac "G",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   205
        TRY o asm_full_simp_tac (add_ss (thms1 @ (symmetric fv_bn_eqvts))),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   206
        p_tac "H",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   207
        (fn i => print_tac ("finished with FV Goal: " ^ string_of_int i))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   208
        ])
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   209
    
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   210
    fun bn_tac ctxt bn_simp =
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   211
      SOLVED' (EVERY' [
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   212
        (fn i => print_tac ("BN Goal: " ^ string_of_int i)),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   213
        TRY o asm_full_simp_tac (add_ss (@{thm supp_Pair[symmetric]}::fv_simps)),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   214
        q_tac "A",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   215
        TRY o mk_bn_supp_abs_tac bn_simp,
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   216
        q_tac "B",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   217
        TRY o simp_tac (add_ss @{thms supp_def supp_rel_def}),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   218
        q_tac "C",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   219
        TRY o Nominal_Permeq.eqvt_tac ctxt (perm_simps @ fv_bn_eqvts) [], 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   220
        q_tac "D",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   221
        TRY o simp_tac (add_ss (@{thms Abs_eq_iff} @ eq_iffs)),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   222
        q_tac "E",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   223
        TRY o asm_full_simp_tac (add_ss thms3),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   224
        q_tac "F",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   225
        TRY o simp_tac (add_ss thms2),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   226
        q_tac "G",
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   227
        TRY o asm_full_simp_tac (add_ss (thms1 @ (symmetric fv_bn_eqvts))),
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   228
        (fn i => print_tac ("finished with BN Goal: " ^ string_of_int i))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   229
        ])
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   230
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   231
    fun fv_tacs ctxt = map (fv_tac ctxt) bclausess
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   232
    fun bn_tacs ctxt = map (bn_tac ctxt) bn_simps
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   233
    
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   234
  in
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   235
    Goal.prove_multi ctxt' [] [] (goals1 @ goals2)
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   236
     (fn {context as ctxt, ...} => HEADGOAL 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   237
       (ind_tac ctxt qinducts THEN' RANGE  (fv_tacs ctxt @ bn_tacs ctxt)))
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   238
    |> ProofContext.export ctxt' ctxt
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   239
  end
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2451
diff changeset
   240
2451
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
   241
d2e929f51fa9 added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents: 2450
diff changeset
   242
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
end (* structure *)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244