Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computing Fundamentals 2 CafeOBJ. Equational logic State is a list of variables with associated values. Evaluation of an expression E in a state is performed.

Similar presentations


Presentation on theme: "Computing Fundamentals 2 CafeOBJ. Equational logic State is a list of variables with associated values. Evaluation of an expression E in a state is performed."— Presentation transcript:

1 Computing Fundamentals 2 CafeOBJ

2 Equational logic State is a list of variables with associated values. Evaluation of an expression E in a state is performed by replacing all variables in E by their values in the state and then computing the value of the resulting expression. For example: –Expression x – y + 2 –State (x,5),(y,6) –Gives 5 – 6 + 2 –Evaluates to 1

3 Equational logic Theories in mathematical logic are defined by their axioms and inference rules (e.g. equational logic). An axiom is a distinguished expression that cannot be proved or disproved. An inference rule is a valid argument which permits the substitution of expressions in the steps of a formal proof. A theorem is either an axiom or a expression, that using the inference rules, is proved equal to an axiom or a previously proved theorem.

4 Semantics of variables, equality & Identity XY  6 XY 66 Identical = Equal Some points: CafeOBJ variables do not match the above conventional view of variables. In CafeOBJ a variable is constrained to range over a particular sort or kind. In contrast to programming languages real would objects are unique, so we may need different concepts of equality and identity for real world objects. X:Nat 0, 1, 2, 3, 4 ….  Variables in C Variables in CafeOBJ

5 Substitutions in CafeOBJ module SIMPLE-NAT { [Zero NzNat < Nat ] op 0 : -> Zero op s : Nat -> NzNat op _+_ : Nat Nat -> Nat vars N N' : Nat eq [eq1] : 0 + N = N. eq [eq2] : s(N) + N’ = s(N + N’). } Substitutions can be used for proofs. Evaluate expressions from CafeOBJ manual, see notes below.

6 SIMPLE-NAT 1 Here is a graphical representation of SIMPLE-NAT. Note the sets and the operations. module SIMPLE-NAT { [Zero NzNat < Nat ] op 0 : -> Zero op s : Nat -> NzNat op _+_ : Nat Nat -> Nat vars N N' : Nat eq [eq1] : 0 + N = N. eq [eq2] : s(N) + N’ = s(N + N’). }

7 TextPad: Add document class for CafeOBJ

8

9 Save CafeOBJ.syn in C:\Program Files\TextPad 5\system ; TextPad syntax definitions for CafeOBJ ; www.TextPad.com / http://www.ldl.jaist.ac.jp/cafeobj/ ; November 2011 ; Pat Browne ; http://www.comp.dit.ie/pbrowne/ ; version v1.0 ; ; Description: ; C=1 [Syntax] Namespace1 = 6 IgnoreCase = No InitKeyWordChars = A-Za-z_ KeyWordChars = A-Za-z0-9_' BracketChars = {[(.,;:)]} SyntaxStart = SyntaxEnd = SingleComment = -- SingleCommentAlt = **> StringsSpanLines = No StringStart = " StringEnd = " StringEsc = \ CharStart = ' CharEnd = ' CharEsc = \ [Keywords 1] eq ceq beq cbeq rule rl crl crule ax cax op ops bop bops assoc constr comm id mod! mod* module* module! protecting using extending including var vars record principal-sort true false -> == = is

10 TextPad : Add new tool (DOS command) for CafeOBJ

11


Download ppt "Computing Fundamentals 2 CafeOBJ. Equational logic State is a list of variables with associated values. Evaluation of an expression E in a state is performed."

Similar presentations


Ads by Google