theory ExampleNa imports NonDeterministicAutomata begin (* see http://en.wikipedia.org/wiki/Nondeterministic_finite_state_machine *) datatype state = S0 | S1 | S2 | S3 | S4 datatype symbol = ZERO | ONE (* transitions definition *) consts T :: "(state, symbol)transitionFunction" inductive "T s x" intros [intro]:"\s=S0; x=None\ \ S1 \ T s x" [intro]:"\s=S0; x=None\ \ S3 \ T s x" [intro]:"\s=S1;x=Some ZERO\ \ S2 \ T s x" [intro]:"\s=S1;x=Some ONE\ \ S1 \ T s x" [intro]:"\s=S2;x=Some ZERO\ \ S1 \ T s x" [intro]:"\s=S2;x=Some ONE\ \ S2 \ T s x" [intro]:"\s=S3;x=Some ZERO\ \ S3 \ T s x" [intro]:"\s=S3;x=Some ONE\ \ S4 \ T s x" [intro]:"\s=S4;x=Some ZERO\ \ S4 \ T s x" [intro]:"\s=S4;x=Some ONE\ \ S3 \ T s x" constdefs accept :: "symbol list \ bool" ACCEPT_DEF:"accept cl == S1 \ run T S1 cl \ S3 \ run T S1 cl" lemma "accept [ONE]" apply(simp add:ACCEPT_DEF RUN_DEF) apply blast done lemma "accept [ONE, ONE, ONE, ZERO, ONE, ZERO, ONE]" apply(simp add:ACCEPT_DEF RUN_DEF) apply blast done lemma "accept [ONE, ZERO, ONE, ZERO]" apply(simp add:ACCEPT_DEF RUN_DEF) apply blast done lemma "accept [ZERO, ZERO, ONE, ZERO, ONE, ZERO, ONE, ZERO]" oops end