Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

Homework 10

This is the task corresponding to homework 10.

Resources

Download Files

Definitions File

theory Defs
  imports "HOL-IMP.VCG"
begin

definition "SQUARE \<equiv> 
  ''z'' ::= N 1;;
  ''a'' ::= N 0;;
   WHILE Less (N 0) (V ''n'') DO (
     ''a'' ::= Plus (V ''a'') (V ''z'');;
     ''z'' ::= Plus (V ''z'') (N 2);; 
     ''n'' ::= Plus (V ''n'') (N (-1))
   )"

bundle ACOM begin
no_notation SKIP ("SKIP")
no_notation Assign ("_ ::= _" [1000, 61] 61)
no_notation Seq    ("_;;/ _"  [60, 61] 60)
no_notation If ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
notation Askip ("SKIP")
notation Aassign ("(_ ::= _)" [1000, 61] 61)
notation Aseq ("_;;/ _"  [60, 61] 60)
notation Aif ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
end

bundle COM begin
no_notation Askip ("SKIP")
no_notation Aassign ("(_ ::= _)" [1000, 61] 61)
no_notation Aseq ("_;;/ _"  [60, 61] 60)
no_notation Aif ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
notation SKIP ("SKIP")
notation Assign ("_ ::= _" [1000, 61] 61)
notation Seq    ("_;;/ _"  [60, 61] 60)
notation If ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
end

unbundle COM



end

Template File

theory Submission
  imports Defs
begin

theorem SQUARE_correct:
  "\<turnstile> {\<lambda>s. s ''n'' \<ge> 0 \<and> s=s\<^sub>0} SQUARE {\<lambda>s. s ''a'' = s\<^sub>0 ''n'' * s\<^sub>0 ''n''}"
  sorry

end

Check File

theory Check
  imports Submission
begin

theorem SQUARE_correct: "\<turnstile> {\<lambda>s. s ''n'' \<ge> 0 \<and> s=s\<^sub>0} SQUARE {\<lambda>s. s ''a'' = s\<^sub>0 ''n'' * s\<^sub>0 ''n''}"
  by (rule Submission.SQUARE_correct)

end

Terms and Conditions