Logic and Reasoning in AI + programming




After I finished any undertaken work, I always ask myself; “what did I learn? What was the main point about this?” for example about university, end of this year I asked myself what did I learn from my second year in university? And specific about a module which is our main subject “Formal aspect of computer science” (http://scom.hud.ac.uk/scomtlm/cia2326/) with Professor Lee McCluskey. Although I know that I learnt a lot from this module and I almost understand all subjects in this module, but it’s hard to show because all are formula and mathematical, here we are talking about “First Order Logic”, “Clausal Form and Unification”, “Resolution and the Refutation Method”, “Algebraic Specifications” and etc.. A few weeks back, while I was programming I found some logic which seems to be hard, it was a page which only user and admin could access that page. If I need to allow all user access that page, I could write something like this; by assuming I know $user from the session $user=$_SESSION[‘user’] $admin=$_SESSION[‘admin’] Now we could write something like this(picture below) But I have a restriction here(for some reasons); I cannot use else statement, how do we solve this issue? According to what I learnt from "Formal aspect of computer science" module, I can use these formula; These are some well known equivalent FORMS in FOL called laws ( De Morgans laws etc) ¬ ( P & Q ) = ¬P V ¬Q ¬ ( P V Q ) = ¬P & ¬Q P=>Q = ¬P V Q ¬ ¬ P = P P <=> Q = (P=>Q)&(Q=>P) etc Logic and Reasoning in AI So I can easily use above fomula and solve the problem, I know that this example is obvious but my main point here is; to say that when I reached where I had to think about solving this problem, the first thing came in my mind was this module. I also used this logic(above laws) in retrieving data from database(using MySQL code). You are welcome to leave a comment and share your thought.

Comments

Popular posts from this blog

I solved GCHQ puzzle and this is how I did it

The best way to predict the future is to create it

Why I don't have social media account?