# HG changeset patch # User kleing # Date 1392790600 -39600 # Node ID fb3bb943a6060a34032b22ce7a52a52e006d8367 # Parent a6153343c44f9b95217039f15e865682018c9a07 provide more automation for type definitions (makes book exercises easier) diff -r a6153343c44f -r fb3bb943a606 src/HOL/IMP/Types.thy --- a/src/HOL/IMP/Types.thy Tue Feb 18 23:08:59 2014 +0100 +++ b/src/HOL/IMP/Types.thy Wed Feb 19 17:16:40 2014 +1100 @@ -83,6 +83,10 @@ V_ty: "\ \ V x : \ x" | Plus_ty: "\ \ a1 : \ \ \ \ a2 : \ \ \ \ Plus a1 a2 : \" +declare atyping.intros [intro!] +inductive_cases [elim!]: + "\ \ V x : \" "\ \ Ic i : \" "\ \ Rc r : \" "\ \ Plus a1 a2 : \" + text{* Warning: the ``:'' notation leads to syntactic ambiguities, i.e. multiple parse trees, because ``:'' also stands for set membership. In most situations Isabelle's type system will reject all but one parse tree, @@ -95,6 +99,9 @@ And_ty: "\ \ b1 \ \ \ b2 \ \ \ And b1 b2" | Less_ty: "\ \ a1 : \ \ \ \ a2 : \ \ \ \ Less a1 a2" +declare btyping.intros [intro!] +inductive_cases [elim!]: "\ \ Not b" "\ \ And b1 b2" "\ \ Less a1 a2" + inductive ctyping :: "tyenv \ com \ bool" (infix "\" 50) where Skip_ty: "\ \ SKIP" | Assign_ty: "\ \ a : \(x) \ \ \ x ::= a" | @@ -102,6 +109,7 @@ If_ty: "\ \ b \ \ \ c1 \ \ \ c2 \ \ \ IF b THEN c1 ELSE c2" | While_ty: "\ \ b \ \ \ c \ \ \ WHILE b DO c" +declare ctyping.intros [intro!] inductive_cases [elim!]: "\ \ x ::= a" "\ \ c1;;c2" "\ \ IF b THEN c1 ELSE c2"