theory Prelim imports "Fresh_Identifiers.Fresh_String" "Bounded_Deducibility_Security.Trivia" begin
subsection‹The basic types›
(* This version of string is needed for code generation: *) definition"emptyStr = STR ''''"
(* The users of the system: *)
datatype name = Nam String.literal definition"emptyName ≡ Nam emptyStr" datatype inform = Info String.literal definition"emptyInfo ≡ Info emptyStr"
datatype user = Usr name inform fun nameUser where"nameUser (Usr name info) = name" fun infoUser where"infoUser (Usr name info) = info" definition"emptyUser ≡ Usr emptyName emptyInfo"
(* Images (currently, pdf, to be changed): *) datatype img = emptyImg | Imag raw_data (* Visibility outside the current api: either friends-only or public
(i.e., exportable outside to the other apis): *) datatype vis = Vsb String.literal (* Accepted values: friend and public *) abbreviation"FriendV ≡ Vsb (STR ''friend'')" (* abbreviation "InternalV \<equiv> Vsb (STR ''internal'')" *) abbreviation"PublicV ≡ Vsb (STR ''public'')" fun stringOfVis where"stringOfVis (Vsb str) = str"
(* A post consists of a string for title, a string for its text,
a (possibly empty) image and a visibility specification: *)
datatypepost = Pst title "text" img (* vis *) (* Getters: *) fun titlePost where"titlePost (Pst title text img) = title" fun textPost where"textPost (Pst title text img) = text" fun imgPost where"imgPost (Pst title text img) = img" (* fun visPost where "visPost (Pst title text img vis) = vis" *) (* Setters: *) fun setTitlePost where"setTitlePost (Pst title text img) title' = Pst title' text img" fun setTextPost where"setTextPost(Pst title text img) text' = Pst title text' img" fun setImgPost where"setImgPost (Pst title text img) img' = Pst title text img'" (* fun setVisPost where "setVisPost (Pst title text img vis) vis' = Pst title text img vis'" *) (* *) definition emptyPost :: postwhere "emptyPost ≡ Pst emptyTitle emptyText emptyImg"(* FriendV" *) (* initially set to the lowest visibility: friend *)
lemma titlePost_emptyPost[simp]: "titlePost emptyPost = emptyTitle" and textPost_emptyPost[simp]: "textPost emptyPost = emptyText" and imgPost_emptyPost[simp]: "imgPost emptyPost = emptyImg" (* and visPost_emptyPost[simp]: "visPost emptyPost = FriendV" *) unfolding emptyPost_def by simp_all
datatype salt = Slt String.literal definition"emptySalt ≡ Slt emptyStr"
(* Information associated to requests for registration: both for users and apis *) datatype requestInfo = ReqInfo String.literal definition"emptyRequestInfo ≡ ReqInfo emptyStr"
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.