Reading Contracts
9 January 2019 OSU CSE 1
Reading Contracts 9 January 2019 OSU CSE 1 Recall: Mathematical - - PowerPoint PPT Presentation
Reading Contracts 9 January 2019 OSU CSE 1 Recall: Mathematical Models Each variable in the program has a type Examples: int , double , Each program type has a mathematical type that models it: you should think of any variable
9 January 2019 OSU CSE 1
9 January 2019 OSU CSE 3
9 January 2019 OSU CSE 4
9 January 2019 OSU CSE 5
9 January 2019 OSU CSE 6
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 7
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 8
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 9
9 January 2019 OSU CSE 10
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 11
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 12
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 13
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 14
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 15
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 16
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 17
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 18
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 19
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 20
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 21
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 22
9 January 2019 OSU CSE 23
9 January 2019 OSU CSE 24
9 January 2019 OSU CSE 25
9 January 2019 OSU CSE 26
9 January 2019 OSU CSE 27
9 January 2019 OSU CSE 28
9 January 2019 OSU CSE 29
9 January 2019 OSU CSE 30
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 31
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |s1| - 1 and * for all i, j: integer, a, b: string of integer * where (s1 = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 32
9 January 2019 OSU CSE 33
9 January 2019 OSU CSE 34
/** * ... * @replaces s2 * @requires * |<7>| >= 1 * @ensures * |s2| = |<7>| - 1 and * for all i, j: integer, a, b: string of integer * where (<7> = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 35
/** * ... * @replaces s2 * @requires * |<7>| >= 1 * @ensures * |s2| = |<7>| - 1 and * for all i, j: integer, a, b: string of integer * where (<7> = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 36
/** * ... * @replaces s2 * @requires * |<7>| >= 1 * @ensures * |s2| = |<7>| - 1 and * for all i, j: integer, a, b: string of integer * where (<7> = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 37
/** * ... * @replaces s2 * @requires * |s1| >= 1 * @ensures * |s2| = |<7>| - 1 and * for all i, j: integer, a, b: string of integer * where (<7> = a * <i> * <j> * b) * (there exists c, d: string of integer * (|c| = |a| and s2 = c * <(i+j)/2> * d)) */ public static void smooth(Sequence<Integer> s1, Sequence<Integer> s2) {...}
9 January 2019 OSU CSE 38
for all i, j: integer, a, b: string of integer where (<7> = a * <i> * <j> * b) (...)
9 January 2019 OSU CSE 39
9 January 2019 OSU CSE 40
9 January 2019 OSU CSE 41
9 January 2019 OSU CSE 42
9 January 2019 OSU CSE 43
9 January 2019 OSU CSE 44
9 January 2019 OSU CSE 45
9 January 2019 OSU CSE 46
9 January 2019 OSU CSE 47
9 January 2019 OSU CSE 48
9 January 2019 OSU CSE 49
9 January 2019 OSU CSE 50
9 January 2019 OSU CSE 51
9 January 2019 OSU CSE 52
9 January 2019 OSU CSE 53
9 January 2019 OSU CSE 54
9 January 2019 OSU CSE 55