lemma lall_strict[simp]: "lall⋅p⋅⊥ = ⊥" by fixrec_simp
fixrec lfilter :: "('a → tr) → 'a llist → 'a llist" where "lfilter⋅p⋅lnil = lnil"
| "lfilter⋅p⋅(x :@ xs) = If p⋅x then x :@ lfilter⋅p⋅xs else lfilter⋅p⋅xs"
lemma lfilter_strict[simp]: "lfilter⋅p⋅⊥ = ⊥" by fixrec_simp
lemma filter_filter: "lfilter⋅p⋅(lfilter⋅q⋅xs) = lfilter⋅(Λ x. q⋅x andalso p⋅x)⋅xs" proof(induct xs) fix a l assume"lfilter⋅p⋅(lfilter⋅q⋅l) = lfilter⋅(Λ(x::'a). q⋅x andalso p⋅x)⋅l" thus"lfilter⋅p⋅(lfilter⋅q⋅(a :@ l)) = lfilter⋅(Λ(x::'a). q⋅x andalso p⋅x)⋅(a :@ l)" by (cases "q⋅a" rule: trE, simp_all) qed simp_all
fixrec ldropWhile :: "('a → tr) → 'a llist → 'a llist" where "ldropWhile⋅p⋅lnil = lnil"
| "ldropWhile⋅p⋅(x :@ xs) = If p⋅x then ldropWhile⋅p⋅xs else x :@ xs"
lemma ldropWhile_strict[simp]: "ldropWhile⋅p⋅⊥ = ⊥" by fixrec_simp
lemma ldropWhile_lnil: "(ldropWhile⋅p⋅xs = lnil) = (lall⋅p⋅xs = TT)" proof(induct xs) fix a l assume"(ldropWhile⋅p⋅l = lnil) = (lall⋅p⋅l = TT)" thus"(ldropWhile⋅p⋅(a :@ l) = lnil) = (lall⋅p⋅(a :@ l) = TT)" by (cases "p⋅a" rule: trE, simp_all) qed simp_all
fixrec literate :: "('a → 'a) → 'a → 'a llist" where "literate⋅f⋅x = x :@ literate⋅f⋅(f⋅x)"
declare literate.simps[simp del]
text‹This order of tests is convenient for the nub proof. I can
the other would be convenient for other proofs...›
fixrec lmember :: "('a → 'a → tr) → 'a → 'a llist → tr" where "lmember⋅eq⋅x⋅lnil = FF"
| "lmember⋅eq⋅x⋅(lcons⋅y⋅ys) = (lmember⋅eq⋅x⋅ys orelse eq⋅y⋅x)"
lemma lmember_strict[simp]: "lmember⋅eq⋅x⋅⊥ = ⊥" by fixrec_simp
text‹This @{term "zipWith"} function follows Haskell's in being more
: zipping uneven lists results in a list as long as the
one. This is what the backtracking monad expects.›
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.