src/HOL/Datatype.thy
changeset 21407 af60523da908
parent 21404 eb85850d3eb7
child 21454 a1937c51ed88
equal deleted inserted replaced
21406:4058f0886448 21407:af60523da908
   153 apply (blast intro: Node_K0_I Rep_Node [THEN Node_Push_I] 
   153 apply (blast intro: Node_K0_I Rep_Node [THEN Node_Push_I] 
   154          dest!: Abs_Node_inj 
   154          dest!: Abs_Node_inj 
   155          elim!: apfst_convE sym [THEN Push_neq_K0])  
   155          elim!: apfst_convE sym [THEN Push_neq_K0])  
   156 done
   156 done
   157 
   157 
   158 lemmas Atom_not_Scons = Scons_not_Atom [THEN not_sym, standard]
   158 lemmas Atom_not_Scons [iff] = Scons_not_Atom [THEN not_sym, standard]
   159 declare Atom_not_Scons [iff]
   159 
   160 
   160 
   161 (*** Injectiveness ***)
   161 (*** Injectiveness ***)
   162 
   162 
   163 (** Atomic nodes **)
   163 (** Atomic nodes **)
   164 
   164 
   175 apply (simp add: Leaf_def o_def)
   175 apply (simp add: Leaf_def o_def)
   176 apply (rule inj_onI)
   176 apply (rule inj_onI)
   177 apply (erule Atom_inject [THEN Inl_inject])
   177 apply (erule Atom_inject [THEN Inl_inject])
   178 done
   178 done
   179 
   179 
   180 lemmas Leaf_inject = inj_Leaf [THEN injD, standard]
   180 lemmas Leaf_inject [dest!] = inj_Leaf [THEN injD, standard]
   181 declare Leaf_inject [dest!]
       
   182 
   181 
   183 lemma inj_Numb: "inj(Numb)"
   182 lemma inj_Numb: "inj(Numb)"
   184 apply (simp add: Numb_def o_def)
   183 apply (simp add: Numb_def o_def)
   185 apply (rule inj_onI)
   184 apply (rule inj_onI)
   186 apply (erule Atom_inject [THEN Inr_inject])
   185 apply (erule Atom_inject [THEN Inr_inject])
   187 done
   186 done
   188 
   187 
   189 lemmas Numb_inject = inj_Numb [THEN injD, standard]
   188 lemmas Numb_inject [dest!] = inj_Numb [THEN injD, standard]
   190 declare Numb_inject [dest!]
       
   191 
   189 
   192 
   190 
   193 (** Injectiveness of Push_Node **)
   191 (** Injectiveness of Push_Node **)
   194 
   192 
   195 lemma Push_Node_inject:
   193 lemma Push_Node_inject:
   237 (** Scons vs Leaf **)
   235 (** Scons vs Leaf **)
   238 
   236 
   239 lemma Scons_not_Leaf [iff]: "Scons M N \<noteq> Leaf(a)"
   237 lemma Scons_not_Leaf [iff]: "Scons M N \<noteq> Leaf(a)"
   240 by (simp add: Leaf_def o_def Scons_not_Atom)
   238 by (simp add: Leaf_def o_def Scons_not_Atom)
   241 
   239 
   242 lemmas Leaf_not_Scons = Scons_not_Leaf [THEN not_sym, standard]
   240 lemmas Leaf_not_Scons  [iff] = Scons_not_Leaf [THEN not_sym, standard]
   243 declare Leaf_not_Scons [iff]
       
   244 
   241 
   245 (** Scons vs Numb **)
   242 (** Scons vs Numb **)
   246 
   243 
   247 lemma Scons_not_Numb [iff]: "Scons M N \<noteq> Numb(k)"
   244 lemma Scons_not_Numb [iff]: "Scons M N \<noteq> Numb(k)"
   248 by (simp add: Numb_def o_def Scons_not_Atom)
   245 by (simp add: Numb_def o_def Scons_not_Atom)
   249 
   246 
   250 lemmas Numb_not_Scons = Scons_not_Numb [THEN not_sym, standard]
   247 lemmas Numb_not_Scons [iff] = Scons_not_Numb [THEN not_sym, standard]
   251 declare Numb_not_Scons [iff]
       
   252 
   248 
   253 
   249 
   254 (** Leaf vs Numb **)
   250 (** Leaf vs Numb **)
   255 
   251 
   256 lemma Leaf_not_Numb [iff]: "Leaf(a) \<noteq> Numb(k)"
   252 lemma Leaf_not_Numb [iff]: "Leaf(a) \<noteq> Numb(k)"
   257 by (simp add: Leaf_def Numb_def)
   253 by (simp add: Leaf_def Numb_def)
   258 
   254 
   259 lemmas Numb_not_Leaf = Leaf_not_Numb [THEN not_sym, standard]
   255 lemmas Numb_not_Leaf [iff] = Leaf_not_Numb [THEN not_sym, standard]
   260 declare Numb_not_Leaf [iff]
       
   261 
   256 
   262 
   257 
   263 (*** ndepth -- the depth of a node ***)
   258 (*** ndepth -- the depth of a node ***)
   264 
   259 
   265 lemma ndepth_K0: "ndepth (Abs_Node(%k. Inr 0, x)) = 0"
   260 lemma ndepth_K0: "ndepth (Abs_Node(%k. Inr 0, x)) = 0"
   361 (** Injection **)
   356 (** Injection **)
   362 
   357 
   363 lemma In0_not_In1 [iff]: "In0(M) \<noteq> In1(N)"
   358 lemma In0_not_In1 [iff]: "In0(M) \<noteq> In1(N)"
   364 by (auto simp add: In0_def In1_def One_nat_def)
   359 by (auto simp add: In0_def In1_def One_nat_def)
   365 
   360 
   366 lemmas In1_not_In0 = In0_not_In1 [THEN not_sym, standard]
   361 lemmas In1_not_In0 [iff] = In0_not_In1 [THEN not_sym, standard]
   367 declare In1_not_In0 [iff]
       
   368 
   362 
   369 lemma In0_inject: "In0(M) = In0(N) ==>  M=N"
   363 lemma In0_inject: "In0(M) = In0(N) ==>  M=N"
   370 by (simp add: In0_def)
   364 by (simp add: In0_def)
   371 
   365 
   372 lemma In1_inject: "In1(M) = In1(N) ==>  M=N"
   366 lemma In1_inject: "In1(M) = In1(N) ==>  M=N"