Nominal/nominal_dt_supp.ML
author Christian Urban <urbanc@in.tum.de>
Sun, 29 Aug 2010 00:36:47 +0800
changeset 2449 6b51117b8955
parent 2448 b9d9c4540265
child 2450 217ef3e4282e
permissions -rw-r--r--
fiexed problem with constructors that have no arguments
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  
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
end
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
structure Nominal_Dt_Supp: NOMINAL_DT_SUPP =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
struct
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
(* supports lemmas *)
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
fun mk_supports_goal ctxt qtrm =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
let  
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  val vs = fresh_args ctxt qtrm
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  val rhs = list_comb (qtrm, vs)
2449
6b51117b8955 fiexed problem with constructors that have no arguments
Christian Urban <urbanc@in.tum.de>
parents: 2448
diff changeset
    24
  val lhs = fold (curry HOLogic.mk_prod) vs @{term "()"}
6b51117b8955 fiexed problem with constructors that have no arguments
Christian Urban <urbanc@in.tum.de>
parents: 2448
diff changeset
    25
    |> mk_supp
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
in
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  mk_supports lhs rhs
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  |> HOLogic.mk_Trueprop
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
end
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
fun supports_tac ctxt perm_simps =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
let
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  val ss1 = HOL_basic_ss addsimps @{thms supports_def fresh_def[symmetric]}
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  val ss2 = HOL_ss addsimps @{thms swap_fresh_fresh fresh_Pair}
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
in
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  EVERY' [ simp_tac ss1,
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
           Nominal_Permeq.eqvt_strict_tac ctxt perm_simps [],
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
           simp_tac ss2 ]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
end
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
fun prove_supports_single ctxt perm_simps qtrm =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
let
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  val goal = mk_supports_goal ctxt qtrm 
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  val ctxt' = Variable.auto_fixes goal ctxt
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
in
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  Goal.prove ctxt' [] [] goal
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
   (K (HEADGOAL (supports_tac ctxt perm_simps)))
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  |> singleton (ProofContext.export ctxt' ctxt)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
end
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
fun prove_supports ctxt perm_simps qtrms =
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  map (prove_supports_single ctxt perm_simps) qtrms
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
end (* structure *)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58