isahipster: dacf61b88a84ed39603037e129610d60d34f5d17

     1: theory Sorted
     2: imports "$HIPSTER_HOME/IsaHipster"
     3: 
     4: begin
     5: datatype Nat = 
     6:   Z
     7:   | Succ "Nat"
     8: 
     9: fun leq :: "Nat => Nat => bool"
    10: where
    11:   "leq Z y = True"
    12: | "leq x Z = False"
    13: | "leq (Succ x) (Succ y) = leq x y"
    14: 
    15: (*hipster leq*)
    16: lemma lemma_a [thy_expl]: "leq x2 x2 = True"
    17: by (hipster_induct_simp_metis Sorted.leq.simps)
    18: 
    19: lemma lemma_aa [thy_expl]: "leq x2 (Succ x2) = True"
    20: by (hipster_induct_simp_metis Sorted.leq.simps)
    21: 
    22: lemma lemma_ab [thy_expl]: "leq (Succ x2) x2 = False"
    23: by (hipster_induct_simp_metis Sorted.leq.simps)
    24: 
    25: fun sorted :: "Nat list => bool"
    26: where
    27:   "sorted [] = True"
    28: | "sorted [x] = True"
    29: | "sorted (x # y # xs) = ((leq x y) \<and> (sorted (y#xs)))"
    30: thm sorted.induct
    31: 
    32: fun last :: "'a list \<Rightarrow> 'a" where
    33:   "last ([t]) = t"
    34: | "last (_ # ts) = last ts"
    35: thm last.induct
    36: 
    37: fun ins :: " Nat => Nat list => Nat list"
    38: where
    39:  "ins x [] = [x]"
    40: |"ins x (y#ys) = (if (leq x y) then (x#y#ys) else (y#(ins x ys)))"
    41: thm ins.induct
    42: 
    43: (*hipster sorted ins*)
    44: lemma lemma_ac [thy_expl]: "leq x2 x2 = True"
    45: by (tactic {* Hipster_Tacs.induct_simp_metis @{context} @{thms Sorted.sorted.simps Sorted.ins.simps thy_expl} *})
    46: 
    47: lemma lemma_ad [thy_expl]: "Sorted.sorted (ins Z x2) = Sorted.sorted x2"
    48: by (tactic {* Hipster_Tacs.induct_simp_metis @{context} @{thms Sorted.sorted.simps Sorted.ins.simps thy_expl} *})
    49: 
    50: lemma unknown [thy_expl]: "ins Z (ins x y) = ins x (ins Z y)"
    51: oops
    52: 
    53: lemma unknown [thy_expl]: "ins x (ins y z) = ins y (ins x z)"
    54: oops
    55: 
    56: lemma unknown [thy_expl]: "Sorted.sorted (ins x y) = Sorted.sorted y"
    57: oops
    58: 
    59: fun isort :: "Nat list => Nat list"
    60: where
    61:   "isort [] = []"
    62: | "isort (x#xs) = ins x (isort xs)"
    63: 
    64: lemma unknown [thy_expl]: "Sorted.sorted x \<Longrightarrow> isort x = x"
    65: oops
    66: 
    67: (*hipster sorted ins isort*)
    68: (*hipster_cond sorted isort*)
    69: ML {*
    70:   val _ = Proof_Context.init_global
    71: *}
    72: (*hipster_cond sorted isort leq sorted ins*)
    73: lemma lemma_ae [thy_expl]: "ins Z (isort x2) = isort (ins Z x2)"
    74: by (hipster_induct_simp_metis Sorted.sorted.simps Sorted.isort.simps Sorted.leq.simps Sorted.sorted.simps Sorted.ins.simps)
    75: (*
    76: lemma unknown [thy_expl]: "ins x (ins y z) = ins y (ins x z)"
    77: oops
    78: 
    79: lemma unknown [thy_expl]: "Sorted.sorted (ins x y) = Sorted.sorted y"
    80: oops
    81: 
    82: lemma unknown [thy_expl]: "isort (ins x y) = ins x (isort y)"
    83: oops
    84: 
    85: lemma unknown [thy_expl]: "Sorted.sorted (isort x) = True"
    86: oops
    87: 
    88: lemma unknown [thy_expl]: "isort (isort x) = isort x"
    89: oops
    90: 
    91: lemma unknown [thy_expl]: "ins Z (ins x y) = ins x (ins Z y)"
    92: oops
    93: 
    94: lemma unknown [thy_expl]: "Sorted.sorted x \<Longrightarrow> isort x = x"
    95: oops *)
    96: 
    97: lemma insSortInvarZ [simp] : "sorted ts \<Longrightarrow> sorted (ins Z ts)"
    98: by (hipster_induct_simp_metis Sorted.sorted.simps Sorted.ins.simps)
    99: lemma insSortInvar: "sorted ts \<Longrightarrow> sorted (ins x ts)"
   100: apply(case_tac x)
   101: apply(simp_all)
   102: apply(induction ts rule: ins.induct)
   103: apply(simp_all)
   104: apply (hipster_induct_simp_metis Sorted.sorted.simps Sorted.ins.simps Sorted.leq.simps)
   105: oops
   106: 
   107: (*
   108: lemma unknown [thy_expl]: "Sorted.sorted y \<Longrightarrow> Sorted.sorted (ins x y) = True"
   109: oops
   110: 
   111: lemma unknown [thy_expl]: "Sorted.sorted y \<Longrightarrow> isort (ins x y) = ins x y"
   112: oops
   113: 
   114: lemma unknown [thy_expl]: "Sorted.sorted x \<Longrightarrow> isort (ins Z x) = ins Z x"
   115: oops *)
   116: 
   117: end

Generated by git2html.