source: src/ASM/PolicyStep.ma @ 2238

Last change on this file since 2238 was 2238, checked in by sacerdot, 7 years ago

Taken out lemma integrated.

File size: 57.2 KB
Line 
1include "ASM/PolicyFront.ma".
2include alias "basics/lists/list.ma".
3include alias "arithmetics/nat.ma".
4include alias "basics/logic.ma".
5
6lemma not_is_jump_to_destination_of_Nome:
7 ∀pi. ¬is_jump (Instruction pi) → destination_of pi = None ….
8 * try (#x #y #H) try (#y #H) try #H cases H %
9qed.
10
11lemma jump_expansion_step1:
12 ∀prefix: list labelled_instruction. S (|prefix|) < 2^16 → |prefix| < 2^16 → (*redundant*)
13 ∀labels: label_map.
14 ∀old_sigma : ppc_pc_map.
15 ∀inc_added : ℕ.
16 ∀inc_pc_sigma : ppc_pc_map.
17 ∀label : (option Identifier).
18 ∀instr : pseudo_instruction.
19 ∀inc_pc : ℕ.
20 ∀inc_sigma : (BitVectorTrie (ℕ×jump_length) 16).
21 ∀old_length : jump_length.
22 ∀Hpolicy : not_jump_default prefix 〈inc_pc,inc_sigma〉.
23 ∀policy : ppc_pc_map.
24 ∀new_length : jump_length.
25 ∀isize : ℕ.
26 let add_instr ≝ match instr with
27  [ Jmp  j        ⇒ Some ? (select_jump_length labels old_sigma inc_pc_sigma inc_added (|prefix|) j)
28  | Call c        ⇒ Some ? (select_call_length labels old_sigma inc_pc_sigma inc_added (|prefix|) c)
29  | Instruction i ⇒ jump_expansion_step_instruction labels old_sigma inc_pc_sigma inc_added (|prefix|) i
30  | _             ⇒ None ?
31  ] in
32 ∀Heq1 :
33  match add_instr with 
34   [None⇒〈short_jump,instruction_size_jmplen short_jump instr〉
35   |Some pl ⇒ 〈max_length old_length pl, instruction_size_jmplen (max_length old_length pl) instr〉]
36   =〈new_length,isize〉.
37 ∀Heq2 :
38   〈inc_pc+isize,
39     insert … (bitvector_of_nat … (S (|prefix|)))
40      〈inc_pc+isize, \snd  (lookup … (bitvector_of_nat … (S (|prefix|))) (\snd  old_sigma) 〈O,short_jump〉)〉
41      (insert … (bitvector_of_nat … (|prefix|)) 〈inc_pc,new_length〉 inc_sigma)〉
42   = policy.
43  not_jump_default (prefix@[〈label,instr〉]) policy.
44 #prefix #prefix_ok1 #prefix_ok #labels #old_sigma #inc_added #inc_pc_sigma #label #instr #inc_pc
45 #inc_sigma #old_length #Hpolicy #policy #new_length #isize #Heq1 #Heq2
46 #i >append_length <commutative_plus #Hi normalize in Hi;
47 cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
48 [ <Heq2 >lookup_insert_miss
49   [ >lookup_insert_miss
50     [ >(nth_append_first ? i prefix ?? Hi)
51       @(Hpolicy i Hi)
52     | @bitvector_of_nat_abs try assumption
53       [ @(transitive_lt ??? Hi) assumption ]
54       @lt_to_not_eq @Hi
55     ]
56   | @bitvector_of_nat_abs try assumption
57     [ @(transitive_lt ??? Hi) assumption ]
58     @lt_to_not_eq @le_S @Hi
59   ]
60 | <Heq2 >Hi >lookup_insert_miss
61   [ >lookup_insert_hit cases instr in Heq1;
62     [2,3,6: #x [3: #y] normalize nodelta #Heq1 <(proj1 ?? (pair_destruct ?????? Heq1)) #_ @refl
63     |4,5: #x normalize nodelta #Heq1 >nth_append_second try %
64           <minus_n_n #abs cases abs
65     |1: #pi normalize nodelta >nth_append_second [2: @le_n] <minus_n_n whd in match (nth ????);
66         #H #non_jump whd in match (jump_expansion_step_instruction ??????) in H;
67         >not_is_jump_to_destination_of_Nome in H; normalize nodelta // ]         
68   | @bitvector_of_nat_abs [3: // | @le_S_to_le ] assumption ]]
69qed.
70
71lemma jump_expansion_step2:
72 ∀prefix: list labelled_instruction. S (|prefix|) < 2^16 → |prefix| < 2^16 → (*redundant*)
73 ∀labels : label_map.
74 ∀old_sigma : ppc_pc_map.
75 ∀inc_pc : ℕ.
76 ∀inc_sigma : (BitVectorTrie (ℕ×jump_length) 16).
77 ∀Hpolicy1 :
78  \fst  (lookup … (bitvector_of_nat … O) inc_sigma 〈O,short_jump〉) = O.
79 ∀Hpolicy2:
80   inc_pc =\fst  (lookup … (bitvector_of_nat … (|prefix|)) inc_sigma 〈O,short_jump〉).
81 ∀policy : ppc_pc_map.
82 ∀new_length : jump_length.
83 ∀isize : ℕ.
84 ∀Heq2 :
85  〈inc_pc+isize,
86   insert (ℕ×jump_length) 16 (bitvector_of_nat 16 (S (|prefix|)))
87   〈inc_pc+isize,
88   \snd  (lookup (ℕ×jump_length) 16 (bitvector_of_nat 16 (S (|prefix|)))
89               (\snd  old_sigma) 〈O,short_jump〉)〉
90   (insert (ℕ×jump_length) 16 (bitvector_of_nat 16 (|prefix|))
91    〈inc_pc,new_length〉 inc_sigma)〉
92   = policy.
93 \fst  (lookup … (bitvector_of_nat … O) (\snd  policy) 〈O,short_jump〉) = O.
94 #prefix #prefix_ok1 #prefix_ok #labels #old_sigma #inc_pc
95 #inc_sigma #Hpolicy1 #Hpolicy2 #policy #new_length #isize #Heq2
96 <Heq2 >lookup_insert_miss
97 [ cases (decidable_eq_nat 0 (|prefix|))
98   [ #Heq <Heq >lookup_insert_hit >Hpolicy2 <Heq @Hpolicy1
99   | #Hneq >lookup_insert_miss
100     [ @Hpolicy1
101     | @bitvector_of_nat_abs try assumption @lt_O_S ]]
102 | @bitvector_of_nat_abs [ @lt_O_S | @prefix_ok1 | 3: @lt_to_not_eq @lt_O_S ] ]
103qed.
104
105lemma destination_of_None_to_is_jump_false:
106 ∀instr. destination_of instr = None … → is_jump' instr = false.
107 * normalize // try (#H1 #H2 #abs) try (#H1 #abs) destruct(abs)
108qed.
109
110lemma destination_of_Some_to_is_jump_true:
111 ∀instr,dst. destination_of instr = Some … dst → is_jump' instr = true.
112 #instr #dst cases instr normalize // try (#H1 #H2 #abs) try (#H1 #abs) try #abs
113 destruct(abs)
114qed.
115
116lemma jump_expansion_step3:
117 ∀program.
118 ∀labels : label_map.
119 ∀old_sigma : Σpolicy:ppc_pc_map.not_jump_default program policy.
120 ∀prefix,x,tl. program=prefix@[x]@tl →
121 ∀inc_added : ℕ.
122 ∀inc_pc_sigma : ppc_pc_map.
123 ∀label : option Identifier.
124 ∀instr : pseudo_instruction.
125 ∀p1 : x≃〈label,instr〉.
126 ∀inc_pc : ℕ.
127 ∀inc_sigma : (BitVectorTrie (ℕ×jump_length) 16).
128 ∀old_pc : ℕ.
129 ∀old_length : jump_length.
130 ∀Holdeq :
131  lookup (ℕ×jump_length) 16 (bitvector_of_nat 16 (|prefix|)) (\snd  old_sigma)
132   〈O,short_jump〉 =〈old_pc,old_length〉.
133 ∀Hpolicy : jump_increase prefix old_sigma 〈inc_pc,inc_sigma〉.
134 ∀policy : ppc_pc_map.
135 ∀new_length : jump_length.
136 ∀isize : ℕ.
137 ∀Heq1 :
138   match 
139   match instr
140    in pseudo_instruction
141    return λ_:pseudo_instruction.(option jump_length)
142    with 
143   [Instruction (i:(preinstruction Identifier))⇒
144    jump_expansion_step_instruction labels old_sigma inc_pc_sigma inc_added
145    (|prefix|) i
146   |Comment (_:String)⇒None jump_length
147   |Cost (_:costlabel)⇒None jump_length
148   |Jmp (j:Identifier)⇒
149    Some jump_length
150    (select_jump_length labels old_sigma inc_pc_sigma inc_added (|prefix|) j)
151   |Call (c:Identifier)⇒
152    Some jump_length
153    (select_call_length labels old_sigma inc_pc_sigma inc_added (|prefix|) c)
154   |Mov (_:[[dptr]]) (_:Identifier)⇒None jump_length]
155    in option
156    return λ_:(option jump_length).(jump_length×ℕ)
157    with 
158   [None⇒〈short_jump,instruction_size_jmplen short_jump instr〉
159   |Some (pl:jump_length)⇒
160    〈max_length old_length pl,
161    instruction_size_jmplen (max_length old_length pl) instr〉]
162   =〈new_length,isize〉.
163 ∀prefix_ok1 : S (|prefix|)< 2 \sup 16.
164 ∀prefix_ok : |prefix|< 2 \sup 16.
165 ∀Heq2b :
166  〈inc_pc+isize,
167   insert (ℕ×jump_length) 16 (bitvector_of_nat 16 (S (|prefix|)))
168   〈inc_pc+isize,
169   \snd  (lookup (ℕ×jump_length) 16 (bitvector_of_nat 16 (S (|prefix|)))
170               (\snd  old_sigma) 〈O,short_jump〉)〉
171   (insert (ℕ×jump_length) 16 (bitvector_of_nat 16 (|prefix|))
172    〈inc_pc,new_length〉 inc_sigma)〉
173   =policy.
174 jump_increase (prefix@[〈label,instr〉]) old_sigma policy.
175 #program #labels #old_sigma #prefix #x #tl #prf #inc_added #inc_pc_sigma #label
176 #instr #p1 #inc_pc #inc_sigma #old_pc #old_length #Holdeq #Hpolicy #policy #new_length
177 #isize #Heq1 #prefix_ok1 #prefix_ok #Heq2
178    #i >append_length >commutative_plus #Hi normalize in Hi;
179    cases (le_to_or_lt_eq … Hi) -Hi; #Hi
180    [ cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
181      [ (* USE[pass]: jump_increase *)
182        lapply (Hpolicy i (le_S_to_le … Hi))
183        <Heq2
184        @pair_elim #opc #oj #EQ1 >lookup_insert_miss
185        [ >lookup_insert_miss
186          [ @pair_elim #pc #j #EQ2 #X @X
187          | @bitvector_of_nat_abs
188            [ @(transitive_lt ??? Hi) ]
189            [1,2: assumption
190            | @lt_to_not_eq @Hi
191            ]
192          ]
193        | @bitvector_of_nat_abs
194          [ @(transitive_lt ??? Hi) @le_S_to_le ]
195          [1,2: assumption
196          | @lt_to_not_eq @le_S @Hi
197          ]
198        ]
199      | >Hi <Heq2 >Holdeq normalize nodelta
200        cut (|prefix| < |program|)
201        [ >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r ] #lt_prefix_program
202        >lookup_insert_miss
203        [ >lookup_insert_hit normalize nodelta
204          inversion instr in Heq1; normalize nodelta
205          [4,5: #x #_ #Heq1 <(proj1 ?? (pair_destruct ?????? Heq1)) @jmpleq_max_length
206          | #pi #Heqi whd in match jump_expansion_step_instruction; normalize nodelta
207            lapply (destination_of_None_to_is_jump_false pi)
208            lapply (destination_of_Some_to_is_jump_true pi)
209            cases (destination_of ?) normalize nodelta
210            [ #tgt #Hx
211            | #tgt #_ #_ #Heq1 <(proj1 ?? (pair_destruct ?????? Heq1)) @jmpleq_max_length
212            ]
213          |2,3,6: #x [3: #y] #Heqi ]
214          #Hj <(proj1 ?? (pair_destruct ?????? Hj))
215          lapply (pi2 ?? old_sigma (|prefix|) ??) try assumption
216          [1,3,5,7: >prf >nth_append_second try @le_n
217            <minus_n_n whd in match (nth ????); >p1 >Heqi
218            whd in match is_jump; normalize nodelta try % >Hx %
219          |*: >Holdeq #EQ2 >EQ2 %2 %]
220        | @bitvector_of_nat_abs
221          [ @le_S_to_le ]
222          [1,2: assumption
223          | @lt_to_not_eq @le_n
224          ]
225        ]
226      ]
227    | <Heq2 >Hi >lookup_insert_hit
228      normalize nodelta
229      cases (bvt_lookup … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma) 〈0,short_jump〉)
230      #a #b normalize nodelta %2 @refl
231    ]
232qed.
233
234(* One step in the search for a jump expansion fixpoint. *)
235definition jump_expansion_step: ∀program:(Σl:list labelled_instruction.
236  S (|l|) < 2^16 ∧ is_well_labelled_p l).
237  ∀labels:(Σlm:label_map.∀l.
238    occurs_exactly_once ?? l program →
239    bitvector_of_nat ? (lookup_def … lm l 0) =
240    address_of_word_labels_code_mem program l).
241  ∀old_policy:(Σpolicy:ppc_pc_map.
242    (* out_of_program_none program policy *)
243    And (And (And (And (not_jump_default program policy)
244    (\fst (bvt_lookup … (bitvector_of_nat ? 0) (\snd policy) 〈0,short_jump〉) = 0))
245    (\fst policy = \fst (bvt_lookup … (bitvector_of_nat ? (|program|)) (\snd policy) 〈0,short_jump〉)))
246    (sigma_compact_unsafe program labels policy))
247    (\fst policy ≤ 2^16)).
248  (Σx:bool × (option ppc_pc_map).
249    let 〈no_ch,y〉 ≝ x in
250    match y with
251    [ None ⇒ nec_plus_ultra program old_policy
252    | Some p ⇒ And (And (And (And (And (And (And
253       (not_jump_default program p)
254       (\fst (bvt_lookup … (bitvector_of_nat ? 0) (\snd p) 〈0,short_jump〉) = 0))
255       (\fst p = \fst (bvt_lookup … (bitvector_of_nat ? (|program|)) (\snd p) 〈0,short_jump〉)))
256       (jump_increase program old_policy p))
257       (sigma_compact_unsafe program labels p))
258       (sigma_jump_equal program old_policy p → no_ch = true))
259       (no_ch = true → sigma_pc_equal program old_policy p))
260       (\fst p ≤ 2^16)
261    ])
262    ≝
263  λprogram.λlabels.λold_sigma.
264  let 〈final_added, final_policy〉 ≝
265    pi1 ?? (foldl_strong (option Identifier × pseudo_instruction)
266    (λprefix.Σx:ℕ × ppc_pc_map.
267      let 〈added,policy〉 ≝ x in
268      And (And (And (And (And (And (And (And (And (not_jump_default prefix policy)
269      (\fst (bvt_lookup … (bitvector_of_nat ? 0) (\snd policy) 〈0,short_jump〉) = 0))
270      (\fst policy = \fst (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd policy) 〈0,short_jump〉)))
271      (jump_increase prefix old_sigma policy))
272      (sigma_compact_unsafe prefix labels policy))
273      (sigma_jump_equal prefix old_sigma policy → added = 0))
274      (added = 0 → sigma_pc_equal prefix old_sigma policy))
275      (out_of_program_none prefix policy))
276      (\fst (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd policy) 〈0,short_jump〉) =
277       \fst (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma) 〈0,short_jump〉) + added))
278      (sigma_safe prefix labels added old_sigma policy))
279    program
280    (λprefix.λx.λtl.λprf.λacc.
281      let 〈inc_added, inc_pc_sigma〉 ≝ (pi1 ?? acc) in
282      let 〈label,instr〉 ≝ x in
283      (* Now, we must add the current ppc and its pc translation.
284       * Three possibilities:
285       *   - Instruction is not a jump; i.e. constant size whatever the sigma we use;
286       *   - Instruction is a backward jump; we can use the sigma we're constructing,
287       *     since it will already know the translation of its destination;
288       *   - Instruction is a forward jump; we must use the old sigma (the new sigma
289       *     does not know the translation yet), but compensate for the jumps we
290       *     have lengthened.
291       *)
292      let add_instr ≝ match instr with
293      [ Jmp  j        ⇒ Some ? (select_jump_length labels old_sigma inc_pc_sigma inc_added (|prefix|) j)
294      | Call c        ⇒ Some ? (select_call_length labels old_sigma inc_pc_sigma inc_added (|prefix|) c)
295      | Instruction i ⇒ jump_expansion_step_instruction labels old_sigma inc_pc_sigma inc_added (|prefix|) i
296      | _             ⇒ None ?
297      ] in
298      let 〈inc_pc, inc_sigma〉 ≝ inc_pc_sigma in
299      let old_length ≝
300        \snd (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd (pi1 ?? old_sigma)) 〈0,short_jump〉) in
301      let old_size ≝ instruction_size_jmplen old_length instr in
302      let 〈new_length, isize〉 ≝ match add_instr with
303      [ None    ⇒ 〈short_jump, instruction_size_jmplen short_jump instr〉
304      | Some pl ⇒ 〈max_length old_length pl, instruction_size_jmplen (max_length old_length pl) instr〉
305      ] in
306      let new_added ≝ match add_instr with
307      [ None   ⇒ inc_added
308      | Some x ⇒ plus inc_added (minus isize old_size)
309      ] in
310      let old_Slength ≝
311        \snd (bvt_lookup … (bitvector_of_nat ? (S (|prefix|))) (\snd (pi1 ?? old_sigma)) 〈0,short_jump〉) in
312      let updated_sigma ≝
313        (* we add the new PC to the next position and the new jump length to this one *)
314        bvt_insert … (bitvector_of_nat ? (S (|prefix|))) 〈inc_pc + isize, old_Slength〉
315        (bvt_insert … (bitvector_of_nat ? (|prefix|)) 〈inc_pc, new_length〉 inc_sigma) in
316      〈new_added, 〈plus inc_pc isize, updated_sigma〉〉
317    ) 〈0, 〈0,
318      bvt_insert …
319        (bitvector_of_nat ? 0)
320        〈0, \snd (bvt_lookup … (bitvector_of_nat ? 0) (\snd (pi1 ?? old_sigma)) 〈0,short_jump〉)〉
321        (Stub ??)〉〉
322    ) in
323    if gtb (\fst final_policy) 2^16 then
324      〈eqb final_added 0, None ?〉
325    else
326      〈eqb final_added 0, Some ? final_policy〉.
327[ normalize nodelta @nmk #Habs lapply p -p cases (foldl_strong ? (λ_.Σx.?) ???)
328  #x #H #Heq >Heq in H; normalize nodelta -Heq -x #Hind
329  (* USE: inc_pc = fst of policy (from fold) *)
330  >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hind)))))))) in p1;
331  (* USE: fst policy < 2^16, inc_pc = fst of policy (old_sigma) *)
332  lapply (proj2 ?? (pi2 ?? old_sigma)) >(proj2 ?? (proj1 ?? (proj1 ?? (pi2 ?? old_sigma))))
333  #Hsig #Hge
334  (* USE: added = 0 → policy_pc_equal (from fold) *)
335  lapply ((proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hind)))) ? (|program|) (le_n (|program|)))
336  [ (* USE: policy_jump_equal → added = 0 (from fold) *)
337    @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hind))))) #i #Hi
338    inversion (is_jump (\snd (nth i ? program 〈None ?, Comment []〉)))
339    [ #Hj
340      (* USE: policy_increase (from fold) *)
341      lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hind)))))) i (le_S_to_le … Hi))
342      lapply (Habs i Hi ?) [ >Hj %]
343      cases (bvt_lookup … (bitvector_of_nat ? i) (\snd old_sigma) 〈0,short_jump〉)
344      #opc #oj
345      cases (bvt_lookup … (bitvector_of_nat ? i) (\snd final_policy) 〈0,short_jump〉)
346      #pc #j normalize nodelta #Heq >Heq cases j
347      [1,2: #abs cases abs #abs2 try (cases abs2) @refl
348      |3: #_ @refl
349      ]
350    | #Hnj
351      (* USE: not_jump_default (from fold and old_sigma) *)
352      >(proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hind)))))))) i Hi ?)
353      [2: >Hnj %]
354      >(proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (pi2 ?? old_sigma)))) i Hi ?) try %
355      >Hnj %
356    ]
357  | #abs >abs in Hsig; #Hsig
358    @(absurd ? Hsig) @lt_to_not_le @ltb_true_to_lt @Hge
359  ]
360| normalize nodelta lapply p -p cases (foldl_strong ? (λ_.Σx.?)???) in ⊢ (% → ?); #x #H #H2
361  >H2 in H; normalize nodelta -H2 -x #H @conj
362  [ @conj [ @conj
363  [ (* USE[pass]: not_jump_default, 0 ↦ 0, inc_pc = fst policy,
364     * jump_increase, sigma_compact_unsafe (from fold) *)
365    @(proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? H)))))
366  | #H2 (* USE[pass]: sigma_jump_equal → added = 0 (from fold) *)
367    @eq_to_eqb_true @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? H))))) @H2
368  ]
369  | (* USE[pass]: added = 0 → sigma_pc_equal (from fold) *)
370     #H2 @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? H)))) @eqb_true_to_eq @H2
371  ]
372  | @not_lt_to_le @ltb_false_to_not_lt @p1
373  ]
374|4: lapply (pi2 ?? acc) >p lapply (refl ? (inc_pc_sigma)) cases inc_pc_sigma in ⊢ (???% → %);
375  #inc_pc #inc_sigma #Hips
376  inversion (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd (pi1 ?? old_sigma)) 〈0,short_jump〉)
377  #old_pc #old_length #Holdeq #Hpolicy normalize nodelta in Hpolicy; @pair_elim
378  #added #policy normalize nodelta @pair_elim #new_length #isize normalize nodelta
379  #Heq1 #Heq2
380 cut (S (|prefix|) < 2^16)
381 [ @(transitive_lt … (proj1 … (pi2 ?? program))) @le_S_S >prf >append_length
382   <plus_n_Sm @le_S_S @le_plus_n_r ] #prefix_ok1
383 cut (|prefix| < 2^16) [ @(transitive_lt … prefix_ok1) %] #prefix_ok
384 cases (pair_destruct ?????? Heq2) -Heq2 #Heq2a #Heq2b
385  % [ % [ % [ % [ % [ % [ % [ % [ % ]]]]]]]]
386  (* NOTE: to save memory and speed up work, there's cases daemon here. They can be
387   * commented out for full proofs, but this needs a lot of memory and time *)
388  [ (* not_jump_default *)
389    @(jump_expansion_step1 … Heq1 Heq2b) try assumption
390    @(proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))))
391  | (* 0 ↦ 0 *)
392    @(jump_expansion_step2 … Heq2b) try assumption
393    [ @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ??  (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))))
394    | @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))) ]
395  | (* inc_pc = fst of policy *)
396    <Heq2b >append_length >(commutative_plus (|prefix|)) >lookup_insert_hit @refl
397  | (* jump_increase *)
398    @(jump_expansion_step3 … (pi1 ?? old_sigma) … prf … p1 ??? old_length Holdeq
399      … Heq1 prefix_ok1 prefix_ok Heq2b)
400    try @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
401    cases (pi2 … old_sigma) * * * #H #_ #_ #_ #_ @H
402  | (* sigma_compact_unsafe *) cases daemon (*
403    #i >append_length <commutative_plus #Hi normalize in Hi;
404    <(proj2 ?? (pair_destruct ?????? Heq2))
405    cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
406    [ >lookup_opt_insert_miss
407      [ >lookup_opt_insert_miss
408        [ >lookup_opt_insert_miss
409          [ cases (le_to_or_lt_eq … Hi) -Hi #Hi
410            [ >lookup_opt_insert_miss
411              [ (* USE[pass]: sigma_compact_unsafe *)
412                lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))) i ?)
413                [ @le_S_to_le @Hi ]
414                cases (bvt_lookup_opt … (bitvector_of_nat ? i) inc_sigma)
415                [ normalize nodelta #X @X
416                | #x cases x -x #x1 #x2
417                  cases (bvt_lookup_opt … (bitvector_of_nat ? (S i)) inc_sigma)
418                  normalize nodelta
419                  [ #X @X
420                  | #y cases y -y #y1 #y2 normalize nodelta >nth_append_first
421                    [ #X @X
422                    | @le_S_to_le @Hi
423                    ]
424                  ]
425                ]
426              | @bitvector_of_nat_abs
427                [3: @lt_to_not_eq @Hi ]
428              ]
429            | >Hi >lookup_opt_insert_hit normalize nodelta
430              (* USE[pass]: sigma_compact_unsafe *)
431              lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))) i ?)
432              [ <Hi @le_n
433              | cases (bvt_lookup_opt … (bitvector_of_nat ? i) inc_sigma)
434                [ normalize nodelta #X @X
435                | #x cases x -x #x1 #x2
436                  (* USE: inc_pc = fst inc_sigma *)
437                  lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
438                  <Hi lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S i)) inc_sigma))
439                  cases (bvt_lookup_opt … (bitvector_of_nat ? (S i)) inc_sigma) in ⊢ (???% → %);
440                  [ normalize nodelta #_  #_ #H cases H
441                  | #y cases y -y #y1 #y2 #Heq >nth_append_first
442                    [ normalize nodelta >(lookup_opt_lookup_hit … Heq 〈0,short_jump〉)
443                      #Heq2 <Heq2 #X @X
444                    | <Hi @le_n
445                    ]
446                  ]
447                ]
448              ]
449            ]
450          ]
451        ]
452      ]
453      [3,4,5: @bitvector_of_nat_abs]
454      [ @(transitive_lt ??? (le_S_S … Hi))
455      |3: @lt_to_not_eq @le_S_S @Hi
456      |4,7,10: @(transitive_lt ??? Hi) @le_S_to_le
457      |5,11: @le_S_to_le
458      |6: @lt_to_not_eq @Hi
459      |9: @lt_to_not_eq @le_S @Hi
460      ]
461      @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf >append_length
462        <plus_n_Sm @le_S_S @le_plus_n_r
463    | >Hi >lookup_opt_insert_miss
464      [2: @bitvector_of_nat_abs
465        [ @le_S_to_le ]
466        [1,2: @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length @le_S_S
467          <plus_n_Sm @le_S_S @le_plus_n_r
468        | @lt_to_not_eq @le_n
469        ]
470      ]
471      >lookup_opt_insert_hit >lookup_opt_insert_hit normalize nodelta
472      (* USE: out_of_program_none ← *)
473      lapply (proj2 ?? (proj2 ?? (proj1 ?? (proj1 ?? Hpolicy)) i ?))
474      [ >Hi @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length @le_S_S @le_plus_n_r
475      | >Hi
476        (* USE: inc_pc = fst policy *)
477        lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
478        lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) inc_sigma))
479        cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) inc_sigma) in ⊢ (???% → %);
480        [ #Heq #_ #H @⊥ @(absurd (|prefix| > |prefix|))
481          [ @H %
482          | @le_to_not_lt @le_n
483          ]
484        | #x cases x -x #x1 #x2 #Heq #Hip #_ >nth_append_second
485          [2: @le_n] <minus_n_n whd in match (nth ????); normalize nodelta
486          >Hip >(lookup_opt_lookup_hit … Heq 〈0,short_jump〉)
487          cases instr in Heq1;
488          [2,3,6: #x [3: #y] #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
489            <(proj1 ?? (pair_destruct ?????? Heq1)) %
490          |4,5: #x #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
491            <(proj1 ?? (pair_destruct ?????? Heq1)) %
492          |1: #pi cases pi normalize nodelta
493            [1,2,3,4,5,6,7,8,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37:
494              [1,2,3,6,7,24,25: #x #y
495              |4,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23: #x]
496              #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
497              <(proj1 ?? (pair_destruct ?????? Heq1)) %
498            |9,10,11,12,13,14,15,16,17: #x [3,4,5,8,9: #y] #Heq1
499              <(proj2 ?? (pair_destruct ?????? Heq1))
500              <(proj1 ?? (pair_destruct ?????? Heq1)) %
501            ]
502          ]
503        ]
504      ]
505    ]
506  ] *)
507  | (* policy_jump_equal → added = 0 *) cases daemon (*
508    <(proj2 ?? (pair_destruct ?????? Heq2))
509    #Heq <(proj1 ?? (pair_destruct ?????? Heq2))
510    (* USE[pass]: policy_jump_equal → added = 0 *)
511    >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))) ?)
512    [ cases instr in Heq1 Heq;
513      [2,3,6: #x [3: #y] normalize nodelta #_ #_ %
514      |4,5: #x normalize nodelta #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
515        #Heq lapply Holdeq -Holdeq
516        (* USE: inc_pc = fst inc_sigma *)
517        >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
518        lapply (Heq (|prefix|) ?)
519        [1,3: >append_length <plus_n_Sm @le_S_S @le_plus_n_r]
520        -Heq >lookup_insert_miss
521        [1,3: >lookup_insert_hit <(proj1 ?? (pair_destruct ?????? Heq1))
522          #Heq <Heq cases (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma) 〈0,short_jump〉)
523          #y #z #Hyz >(proj2 ?? (pair_destruct ?????? Hyz)) <minus_n_n %
524        |2,4: @bitvector_of_nat_abs
525          [1,4: @le_S_to_le]
526          [1,2,3,5: @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf >append_length
527            <plus_n_Sm @le_S_S @le_plus_n_r
528          |4,6: @lt_to_not_eq @le_n
529          ]
530        ]
531      |1: #pi cases pi normalize nodelta
532        [1,2,3,4,5,6,7,8,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37:
533          [1,2,3,6,7,24,25: #x #y
534          |4,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23: #x] #_ #_ @refl
535        |9,10,11,12,13,14,15,16,17: #x [3,4,5,8,9: #y] #Heq1
536          <(proj2 ?? (pair_destruct ?????? Heq1)) #Heq lapply Holdeq -Holdeq
537          (* USE: inc_pc = fst inc_sigma *)
538          >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
539          lapply (Heq (|prefix|) ?)
540          [1,3,5,7,9,11,13,15,17: >append_length <plus_n_Sm @le_S_S @le_plus_n_r]
541          -Heq >lookup_insert_miss
542          [1,3,5,7,9,11,13,15,17: >lookup_insert_hit in ⊢ (???(???%) → ?); <(proj1 ?? (pair_destruct ?????? Heq1))
543            #Heq <Heq cases (bvt_lookup … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma) 〈0,short_jump〉)
544            #y #z #Hyz >(proj2 ?? (pair_destruct ?????? Hyz)) <minus_n_n / by /
545          |2,4,6,8,10,12,14,16,18: @bitvector_of_nat_abs
546            [3,6,9,12,15,18,21,24,27: @lt_to_not_eq @le_n
547            |1,4,7,10,13,16,19,22,25: @le_S_to_le
548            ]
549            @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S
550              >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
551          ]
552        ]
553      ]
554    | #i #Hi lapply (Heq i ?)
555      [ >append_length <plus_n_Sm @le_S <plus_n_O @Hi
556      | >lookup_insert_miss
557        [ >lookup_insert_miss
558          [ / by /
559          | @bitvector_of_nat_abs
560            [ @(transitive_lt ??? Hi) ]
561            [1,2: @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length @le_S_S
562              @le_plus_n_r
563            | @lt_to_not_eq @Hi
564            ]
565          ]
566        | @bitvector_of_nat_abs
567          [ @(transitive_lt ??? Hi) @le_S_to_le ]
568          [1,2: @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length @le_S_S
569            <plus_n_Sm @le_S_S @le_plus_n_r
570          | @lt_to_not_eq @le_S @Hi
571          ]
572        ]
573      ]
574    ]
575  ] *)
576  | (* added = 0 → policy_pc_equal *) cases daemon
577    (* USE[pass]: added = 0 → policy_pc_equal *)
578    (* lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))
579    <(proj2 ?? (pair_destruct ?????? Heq2))
580    <(proj1 ?? (pair_destruct ?????? Heq2))
581    lapply Heq1 -Heq1 lapply (refl ? instr)
582    cases instr in ⊢ (???% → % → %); normalize nodelta
583    [2,3,6: #x [3: #y] #Hins #Heq1 #Hold #Hadded #i >append_length >commutative_plus
584      #Hi normalize in Hi;
585      cases (le_to_or_lt_eq … Hi) -Hi #Hi
586      [1,3,5: cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
587        [1,3,5: <(proj2 ?? (pair_destruct ?????? Heq2)) >lookup_insert_miss
588          [1,3,5: >lookup_insert_miss
589            [1,3,5: @(Hold Hadded i (le_S_to_le … Hi))
590            |2,4,6: @bitvector_of_nat_abs
591              [3,6,9: @lt_to_not_eq @Hi
592              |1,4,7: @(transitive_lt ??? Hi)
593              ]
594              @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
595              @le_S_S <plus_n_Sm @le_S @le_plus_n_r
596            ]
597          |2,4,6: @bitvector_of_nat_abs
598            [3,6,9: @lt_to_not_eq @le_S @Hi
599            |1,4,7: @(transitive_lt … Hi) @le_S_to_le
600            ]
601            @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
602              @le_S_S <plus_n_Sm @le_S_S @le_plus_n_r
603          ]
604        |2,4,6: >Hi >lookup_insert_miss
605          [1,3,5: >lookup_insert_hit >(Hold Hadded (|prefix|) (le_n (|prefix|)))
606            @sym_eq (* USE: fst p = lookup |prefix| *)
607            @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
608          |2,4,6: @bitvector_of_nat_abs
609            [3,6,9: @lt_to_not_eq @le_n
610            |1,4,7: @le_S_to_le
611            ]
612            @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
613              @le_S_S <plus_n_Sm @le_S_S @le_plus_n_r
614          ]
615        ]
616      |2,4,6: >Hi >lookup_insert_hit
617        (* USE fst p = lookup |prefix| *)
618        >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
619        <(Hold Hadded (|prefix|) (le_n (|prefix|)))
620        (* USE: sigma_compact (from old_sigma) *)
621        lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
622        [1,3,5: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
623        |2,4,6:
624          lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
625          cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% -> %);
626          [1,3,5: normalize nodelta #_ #ABS cases ABS
627          |2,4,6: lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
628            cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
629            [1,3,5: normalize nodelta #Hl #x cases x -x #pc #j normalize nodelta #Hl2 #ABS cases ABS
630            |2,4,6: normalize nodelta #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #EQ
631              normalize nodelta >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉)
632              >(lookup_opt_lookup_hit … EQ 〈0,short_jump〉)
633              >prf >p1 >Hins >nth_append_second
634              [2,4,6: @(le_n (|prefix|))
635              |1,3,5: <minus_n_n whd in match (nth ????); <(proj2 ?? (pair_destruct ?????? Heq1))
636                 #H >H @plus_left_monotone @instruction_size_irrelevant @nmk / by /
637              ]
638            ]
639          ]
640        ]
641      ]
642    |4,5: #x #Hins #Heq1 #Hold #Hadded #i >append_length >commutative_plus
643       #Hi normalize in Hi; cases (le_to_or_lt_eq … Hi) -Hi #Hi
644       [1,3: cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
645         [1,3: >lookup_insert_miss
646           [1,3: >lookup_insert_miss
647             [1,3: @(Hold ? i (le_S_to_le … Hi)) >commutative_plus in Hadded;
648               @plus_zero_zero
649             |2,4: @bitvector_of_nat_abs
650               [3,6: @lt_to_not_eq @Hi
651               |1,4: @(transitive_lt ??? Hi)
652               ]
653               @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
654               >append_length @le_plus_n_r
655             ]
656           |2,4: @bitvector_of_nat_abs
657             [3,6: @lt_to_not_eq @le_S @Hi
658             |1,4: @(transitive_lt ??? Hi) @le_S_to_le
659             ]
660             @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
661             >append_length <plus_n_Sm @le_S_S @le_plus_n_r
662           ]
663         |2,4: >Hi >lookup_insert_miss
664           [1,3: >lookup_insert_hit >(Hold ? (|prefix|) (le_n (|prefix|)))
665             [2,4: >commutative_plus in Hadded; @plus_zero_zero] @sym_eq
666             (* USE: fst p = lookup |prefix| *)
667             @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
668           |2,4: @bitvector_of_nat_abs
669             [3,6: @lt_to_not_eq @le_n
670             |1,4: @(transitive_lt ??? (le_S_S … (le_n (|prefix|))))
671             ]
672             @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
673             >append_length <plus_n_Sm @le_S_S @le_plus_n_r
674           ]
675         ]
676       |2,4: >Hi >lookup_insert_hit <(proj2 ?? (pair_destruct ?????? Heq1))
677         elim (le_to_or_lt_eq … (minus_zero_to_le … (plus_zero_zero … Hadded)))
678         [1,3: #H @⊥ @(absurd ? H) @le_to_not_lt <(proj2 ?? (pair_destruct ?????? Heq1))
679           @jump_length_le_max / by I/
680         |2,4: #H (* USE: fst p = lookup |prefix| *)
681           >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
682           <(Hold ? (|prefix|) (le_n (|prefix|)))
683           [1,3: <(proj2 ?? (pair_destruct ?????? Heq1)) in H; #H
684             >(jump_length_equal_max … H)
685             [1,3: (* USE: sigma_compact_unsafe (from old_sigma) *)
686               lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
687               [1,3: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
688               |2,4: lapply Holdeq lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
689                 cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
690                 [1,3: normalize nodelta #_ #_ #ABS cases ABS
691                 |2,4: normalize nodelta
692                   lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
693                   cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
694                   [1,3: #_ #x cases x -x #pc #j normalize nodelta #_ #_ #ABS cases ABS
695                   |2,4: #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #EQ
696                     normalize nodelta >(lookup_opt_lookup_hit … EQ 〈0,short_jump〉)
697                     >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) #EQpair
698                     >(proj2 ?? (pair_destruct ?????? EQpair)) >prf >nth_append_second
699                     [1,3: <minus_n_n >p1 whd in match (nth ????); >Hins #H @H
700                     |2,4: @le_n
701                     ]
702                   ]
703                 ]
704               ]
705             |2,4: / by I/
706             ]
707           |2,4: @plus_zero_zero [2,4: >commutative_plus @Hadded]
708           ]
709         ]
710       ]
711     |1: #pi cases pi normalize nodelta
712      [1,2,3,4,5,6,7,8,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37:
713        [1,2,3,6,7,24,25: #x #y
714        |4,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23: #x]
715        #Hins #Heq1 #Hold #Hadded #i >append_length >commutative_plus #Hi normalize in Hi;
716        cases (le_to_or_lt_eq … Hi) -Hi #Hi
717        [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
718          cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
719          [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
720            <(proj2 ?? (pair_destruct ?????? Heq2))
721            >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc+isize,?〉 16 (bitvector_of_nat 16 (S (|prefix|))) (bitvector_of_nat 16 i))
722            [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
723              >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc,new_length〉 16 (bitvector_of_nat 16 (|prefix|)) (bitvector_of_nat 16 i) inc_sigma)
724              [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
725                @(Hold Hadded i (le_S_to_le … Hi))
726              |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
727                @bitvector_of_nat_abs
728                [3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84:
729                  @lt_to_not_eq @Hi
730                |1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82:
731                  @(transitive_lt ??? Hi)
732                ]
733                @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
734                @le_S_S <plus_n_Sm @le_S @le_plus_n_r
735              ]
736            |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
737              @bitvector_of_nat_abs
738              [3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84:
739                @lt_to_not_eq @le_S @Hi
740              |1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82:
741                @(transitive_lt … Hi) @le_S_to_le
742              ]
743              @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
744              @le_S_S <plus_n_Sm @le_S_S @le_plus_n_r
745            ]
746          |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
747            >Hi >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc+isize,?〉 16 (bitvector_of_nat 16 (S (|prefix|))) (bitvector_of_nat 16 (|prefix|)))
748            [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
749              >lookup_insert_hit >(Hold Hadded (|prefix|) (le_n (|prefix|))) @sym_eq
750              (* USE: fst p = lookup |prefix| *)
751              @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
752            |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
753              @bitvector_of_nat_abs
754              [3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84:
755                @lt_to_not_eq @le_n
756              |1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82:
757                @le_S_to_le
758              ]
759              @(transitive_lt … (proj1 ?? (pi2 ?? program))) >prf >append_length
760                @le_S_S <plus_n_Sm @le_S_S @le_plus_n_r
761            ]
762          ]
763        |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
764          >Hi >lookup_insert_hit
765          (* USE fst p = lookup |prefix| *)
766          >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
767          <(Hold Hadded (|prefix|) (le_n (|prefix|)))
768          (* USE: sigma_compact (from old_sigma) *)
769          lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
770          [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
771            >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
772          |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
773            lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
774            cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% -> %);
775            [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
776              normalize nodelta #_ #ABS cases ABS
777            |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
778              lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
779              cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
780              [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
781                normalize nodelta #Hl #x cases x -x #pc #j normalize nodelta #Hl2 #ABS cases ABS
782              |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
783                normalize nodelta #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #EQ
784                normalize nodelta >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉)
785                >(lookup_opt_lookup_hit … EQ 〈0,short_jump〉)
786                >prf >p1 >Hins >nth_append_second
787                [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
788                  @(le_n (|prefix|))
789                |1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
790                  <minus_n_n whd in match (nth ????); <(proj2 ?? (pair_destruct ?????? Heq1))
791                  #H >H @plus_left_monotone @instruction_size_irrelevant @nmk #H @H
792                ]
793              ]
794            ]
795          ]
796        ]
797      |9,10,11,12,13,14,15,16,17: #x [3,4,5,8,9: #y] #Hins #Heq1 #Hold #Hadded
798        #i >append_length >commutative_plus #Hi normalize in Hi; cases (le_to_or_lt_eq … Hi)
799        -Hi #Hi
800        [1,3,5,7,9,11,13,15,17: cases (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
801          [1,3,5,7,9,11,13,15,17:
802            >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc+isize,?〉 16 (bitvector_of_nat 16 (S (|prefix|))) (bitvector_of_nat 16 i))
803            [1,3,5,7,9,11,13,15,17:
804              >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc,new_length〉 16 (bitvector_of_nat 16 (|prefix|)) (bitvector_of_nat 16 i) inc_sigma)
805              [1,3,5,7,9,11,13,15,17: @(Hold ? i (le_S_to_le … Hi))
806                >commutative_plus in Hadded; @plus_zero_zero
807              |2,4,6,8,10,12,14,16,18: @bitvector_of_nat_abs
808                [3,6,9,12,15,18,21,24,27: @lt_to_not_eq @Hi
809                |1,4,7,10,13,16,19,22,25: @(transitive_lt ??? Hi)
810                ]
811                @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
812                >append_length @le_plus_n_r
813              ]
814            |2,4,6,8,10,12,14,16,18: @bitvector_of_nat_abs
815              [3,6,9,12,15,18,21,24,27: @lt_to_not_eq @le_S @Hi
816              |1,4,7,10,13,16,19,22,25: @(transitive_lt ??? Hi) @le_S_to_le
817              ]
818              @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
819              >append_length <plus_n_Sm @le_S_S @le_plus_n_r
820            ]
821          |2,4,6,8,10,12,14,16,18: >Hi
822            >(lookup_insert_miss (ℕ×jump_length) 〈0,short_jump〉 〈inc_pc+isize,?〉 16 (bitvector_of_nat 16 (S (|prefix|))) (bitvector_of_nat 16 (|prefix|)))
823            [1,3,5,7,9,11,13,15,17: >lookup_insert_hit >(Hold ? (|prefix|) (le_n (|prefix|)))
824              [2,4,6,8,10,12,14,16,18: >commutative_plus in Hadded; @plus_zero_zero] @sym_eq
825              (* USE: fst p = lookup |prefix| *)
826              @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy))))))))
827            |2,4,6,8,10,12,14,16,18: @bitvector_of_nat_abs
828              [3,6,9,12,15,18,21,24,27: @lt_to_not_eq @le_n
829              |1,4,7,10,13,16,19,22,25: @(transitive_lt ??? (le_S_S … (le_n (|prefix|))))
830              ]
831              @(transitive_lt … (proj1 ?? (pi2 ?? program))) @le_S_S >prf
832              >append_length <plus_n_Sm @le_S_S @le_plus_n_r
833            ]
834          ]
835        |2,4,6,8,10,12,14,16,18: >Hi >lookup_insert_hit <(proj2 ?? (pair_destruct ?????? Heq1))
836          elim (le_to_or_lt_eq … (minus_zero_to_le … (plus_zero_zero … Hadded)))
837          [1,3,5,7,9,11,13,15,17: #H @⊥ @(absurd ? H) @le_to_not_lt
838            <(proj2 ?? (pair_destruct ?????? Heq1)) @jump_length_le_max / by I/
839          |2,4,6,8,10,12,14,16,18: #H (* USE: fst p = lookup |prefix| *)
840            >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
841            <(Hold ? (|prefix|) (le_n (|prefix|)))
842            [1,3,5,7,9,11,13,15,17: <(proj2 ?? (pair_destruct ?????? Heq1)) in H; #H
843              >(jump_length_equal_max … H)
844              [1,3,5,7,9,11,13,15,17: (* USE: sigma_compact_unsafe (from old_sigma) *)
845                lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
846                [1,3,5,7,9,11,13,15,17: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
847                |2,4,6,8,10,12,14,16,18: lapply Holdeq
848                  lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
849                  cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
850                  [1,3,5,7,9,11,13,15,17: normalize nodelta #_ #_ #ABS cases ABS
851                  |2,4,6,8,10,12,14,16,18: normalize nodelta
852                    lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
853                    cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
854                    [1,3,5,7,9,11,13,15,17: #_ #x cases x -x #pc #j normalize nodelta
855                      #_ #_ #ABS cases ABS
856                    |2,4,6,8,10,12,14,16,18: #x cases x -x #Spc #Sj #EQS #x cases x -x
857                      #pc #j #EQ
858                      normalize nodelta >(lookup_opt_lookup_hit … EQ 〈0,short_jump〉)
859                      >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) #EQpair
860                      >(proj2 ?? (pair_destruct ?????? EQpair)) >prf >nth_append_second
861                      [1,3,5,7,9,11,13,15,17: <minus_n_n >p1 whd in match (nth ????); >Hins #H @H
862                      |2,4,6,8,10,12,14,16,18: @le_n
863                      ]
864                    ]
865                  ]
866                ]
867              |2,4,6,8,10,12,14,16,18: / by I/
868              ]
869            |2,4,6,8,10,12,14,16,18: @plus_zero_zero
870              [2,4,6,8,10,12,14,16,18: >commutative_plus @Hadded]
871            ]
872          ]
873        ]
874      ]
875    ] *)
876  | (* out_of_program_none *) cases daemon
877    (* #i #Hi2 >append_length <commutative_plus @conj
878    [ (* → *) #Hi normalize in Hi;
879      cases instr in Heq2; normalize nodelta
880      #x [6: #y] #H <(proj2 ?? (pair_destruct ?????? H)) >lookup_opt_insert_miss
881      [1,3,5,7,9,11: >lookup_opt_insert_miss
882        [1,3,5,7,9,11: (* USE[pass]: out_of_program_none → *)
883          @(proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))) i Hi2))
884          @le_S_to_le @Hi
885        |2,4,6,8,10,12: @bitvector_of_nat_abs
886          [1,4,7,10,13,16: @Hi2
887          |2,5,8,11,14,17: @(transitive_lt … Hi2)
888          |3,6,9,12,15,18: @sym_neq @lt_to_not_eq
889          ] @le_S_to_le @Hi
890        ]
891      |2,4,6,8,10,12: @bitvector_of_nat_abs
892        [1,4,7,10,13,16: @Hi2
893        |2,5,8,11,14,17: @(transitive_lt … Hi2)
894        |3,6,9,12,15,18: @sym_neq @lt_to_not_eq
895        ] @Hi
896      ]
897    | (* ← *) <(proj2 ?? (pair_destruct ?????? Heq2)) #Hl
898      elim (decidable_lt i (|prefix|))
899      [ #Hi
900        lapply (proj2 ?? (insert_lookup_opt_miss ?????? (proj2 ?? (insert_lookup_opt_miss ?????? Hl))))
901        #Hl2 (* USE[pass]: out_of_program_none ← *)
902        lapply (proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))) i Hi2) Hl2)
903        #Hi3 @⊥ @(absurd ? Hi) @le_to_not_lt @le_S_to_le @Hi3
904      | #Hi elim (le_to_or_lt_eq … (not_lt_to_le … Hi))
905        [ #Hi3 elim (le_to_or_lt_eq … Hi3)
906          [ / by /
907          | #X lapply (proj1 ?? (insert_lookup_opt_miss ?????? Hl)) >X >eq_bv_refl #H normalize in H; destruct (H)
908          ]
909        | #X lapply (proj1 ?? (insert_lookup_opt_miss ?????? (proj2 ?? (insert_lookup_opt_miss ?????? Hl))))
910          >X >eq_bv_refl #H normalize in H; destruct (H)
911        ]
912      ]
913    ] *)
914  | (* lookup p = lookup old_sigma + added *) cases daemon
915    (* <(proj2 ?? (pair_destruct ?????? Heq2)) >append_length <plus_n_Sm <plus_n_O
916    >lookup_insert_hit
917    <(proj1 ?? (pair_destruct ?????? Heq2)) cases instr in p1 Heq1;
918    [2,3,6: #x [3: #y] normalize nodelta #p1 #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
919      (* USE: sigma_compact_unsafe (from old_sigma) *)
920      lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
921      [1,3,5: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
922      |2,4,6: lapply Holdeq -Holdeq
923        lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
924        cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
925        [1,3,5: normalize nodelta #_ #_ #abs cases abs
926        |2,4,6: lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
927          cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
928          [1,3,5: normalize nodelta #_ #x cases x -x #Spc #Sj normalize nodelta #_ #_ #abs cases abs
929          |2,4,6: #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #Holdeq #EQ normalize nodelta
930            #H (* USE: fst p = lookup |prefix| *)
931            >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
932            (* USE[pass]: lookup p = lookup old_sigma + added *)
933            >(proj2 ?? (proj1 ?? Hpolicy)) >(lookup_opt_lookup_hit … Holdeq 〈0,short_jump〉) in EQ;
934            -Holdeq #EQ <(proj1 ?? (pair_destruct ?????? EQ))
935            >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) >H >prf >nth_append_second
936            [1,3,5: <minus_n_n >p1 whd in match (nth ????); >associative_plus
937              >(associative_plus pc) @plus_left_monotone >commutative_plus
938              @plus_right_monotone @instruction_size_irrelevant @nmk #H @H
939            |2,4,6: @le_n
940            ]
941          ]
942        ]
943      ]
944    |4,5: #x normalize nodelta #p1 #Heq1
945      (* USE: sigma_compact_unsafe (from old_sigma) *)
946      lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
947      [1,3: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
948      |2,4: lapply Holdeq -Holdeq
949        lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
950        cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
951        [1,3: normalize nodelta #_ #_ #abs cases abs
952        |2,4: lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
953          cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
954          [1,3: normalize nodelta #_ #x cases x -x #Spc #Sj normalize nodelta #_ #_ #abs cases abs
955          |2,4: #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #Holdeq #EQ normalize nodelta
956            #H (* USE: fst p = lookup |prefix| *)
957            >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
958            (* USE[pass]: lookup p = lookup old_sigma + added *)
959            >(proj2 ?? (proj1 ?? Hpolicy)) >(lookup_opt_lookup_hit … Holdeq 〈0,short_jump〉) in EQ;
960            -Holdeq #EQ <(proj1 ?? (pair_destruct ?????? EQ))
961            >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) >H >associative_plus
962            >(associative_plus pc) @plus_left_monotone >assoc_plus1
963            >(associative_plus inc_added) @plus_left_monotone >plus_minus_commutative
964            [1,3: >(proj2 ?? (pair_destruct ?????? EQ)) >prf >nth_append_second
965              [1,3: <minus_n_n whd in match (nth ????); >p1 >commutative_plus
966                @minus_plus_m_m
967              |2,4: @le_n
968              ]
969            |2,4: <(proj2 ?? (pair_destruct ?????? Heq1)) @jump_length_le_max @I
970            ]
971          ]
972        ]
973      ]
974    |1: #pi cases pi
975      [1,2,3,4,5,6,7,8,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37:
976        [1,2,3,6,7,24,25: #x #y
977        |4,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23: #x]
978        normalize nodelta #p1 #Heq1 <(proj2 ?? (pair_destruct ?????? Heq1))
979        (* USE: sigma_compact_unsafe (from old_sigma) *)
980        lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
981        [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
982          >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
983        |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
984          lapply Holdeq -Holdeq lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
985          cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
986          [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
987            normalize nodelta #_ #_ #abs cases abs
988          |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
989            lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
990            cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
991            [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
992              normalize nodelta #_ #x cases x -x #Spc #Sj normalize nodelta #_ #_ #abs cases abs
993            |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
994              #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j #Holdeq #EQ normalize nodelta
995              #H (* USE: fst p = lookup |prefix| *)
996              >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
997              (* USE[pass]: lookup p = lookup old_sigma + added *)
998              >(proj2 ?? (proj1 ?? Hpolicy)) >(lookup_opt_lookup_hit … Holdeq 〈0,short_jump〉) in EQ;
999              -Holdeq #EQ <(proj1 ?? (pair_destruct ?????? EQ))
1000              >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) >H >prf >nth_append_second
1001              [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55:
1002                <minus_n_n >p1 whd in match (nth ????); >associative_plus
1003                >(associative_plus pc) @plus_left_monotone >commutative_plus
1004                @plus_right_monotone @instruction_size_irrelevant @nmk #H @H
1005              |2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56:
1006                @le_n
1007              ]
1008            ]
1009          ]
1010        ]
1011      |9,10,11,12,13,14,15,16,17: #x [3,4,5,8,9: #y] normalize nodelta #p1 #Heq1
1012      (* USE: sigma_compact_unsafe (from old_sigma) *)
1013        lapply (proj2 ?? (proj1 ?? (pi2 ?? old_sigma)) (|prefix|) ?)
1014        [1,3,5,7,9,11,13,15,17: >prf >append_length <plus_n_Sm @le_S_S @le_plus_n_r
1015        |2,4,6,8,10,12,14,16,18: lapply Holdeq -Holdeq
1016          lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)))
1017          cases (bvt_lookup_opt … (bitvector_of_nat ? (|prefix|)) (\snd old_sigma)) in ⊢ (???% → %);
1018          [1,3,5,7,9,11,13,15,17: normalize nodelta #_ #_ #abs cases abs
1019          |2,4,6,8,10,12,14,16,18: lapply (refl ? (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)))
1020            cases (bvt_lookup_opt … (bitvector_of_nat ? (S (|prefix|))) (\snd old_sigma)) in ⊢ (???% → %);
1021            [1,3,5,7,9,11,13,15,17: normalize nodelta #_ #x cases x -x #Spc #Sj
1022              normalize nodelta #_ #_ #abs cases abs
1023            |2,4,6,8,10,12,14,16,18: #x cases x -x #Spc #Sj #EQS #x cases x -x #pc #j
1024              #Holdeq #EQ normalize nodelta #H (* USE: fst p = lookup |prefix| *)
1025              >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? (proj1 ?? Hpolicy)))))))
1026              (* USE[pass]: lookup p = lookup old_sigma + added *)
1027              >(proj2 ?? (proj1 ?? Hpolicy)) >(lookup_opt_lookup_hit … Holdeq 〈0,short_jump〉) in EQ;
1028              -Holdeq #EQ <(proj1 ?? (pair_destruct ?????? EQ))
1029              >(lookup_opt_lookup_hit … EQS 〈0,short_jump〉) >H >associative_plus
1030              >(associative_plus pc) @plus_left_monotone >assoc_plus1
1031              >(associative_plus inc_added) @plus_left_monotone >plus_minus_commutative
1032              [1,3,5,7,9,11,13,15,17: >(proj2 ?? (pair_destruct ?????? EQ)) >prf
1033                >nth_append_second
1034                [1,3,5,7,9,11,13,15,17: <minus_n_n whd in match (nth ????); >p1
1035                  >commutative_plus @minus_plus_m_m
1036                |2,4,6,8,10,12,14,16,18: @le_n
1037                ]
1038              |2,4,6,8,10,12,14,16,18: <(proj2 ?? (pair_destruct ?????? Heq1))
1039                @jump_length_le_max @I
1040              ]
1041            ]
1042          ]
1043        ]
1044      ]
1045    ] *)
1046  | (* sigma_safe *) cases daemon (*#i >append_length >commutative_plus #Hi normalize in Hi;
1047    elim (le_to_or_lt_eq … (le_S_S_to_le … Hi)) -Hi #Hi
1048    [ >nth_append_first [2: @Hi]
1049      <(proj2 ?? (pair_destruct ?????? Heq2)) >lookup_insert_miss
1050      [ >lookup_insert_miss
1051        [ >lookup_insert_miss
1052          [ elim (le_to_or_lt_eq … Hi) -Hi #Hi
1053            [ >lookup_insert_miss
1054              [ >lookup_insert_miss
1055                [ (* USE[pass]: sigma_safe *)
1056                  lapply ((proj2 ?? Hpolicy) i (le_S_to_le … Hi))
1057                  cases (bvt_lookup … (bitvector_of_nat ? i) inc_sigma 〈0,short_jump〉)
1058                  #pc #j normalize nodelta
1059                  cases (bvt_lookup … (bitvector_of_nat ? (S i)) inc_sigma 〈0,short_jump〉)
1060                  #Spc #Sj normalize nodelta
1061                  cases (nth i ? prefix 〈None ?, Comment []〉) #lbl #ins normalize nodelta
1062                  #Hind #dest #Hj lapply (Hind dest Hj) -Hind -Hj lapply (proj1 ?? (pair_destruct ?????? Heq2)) cases instr
1063                  [2,3,6: [3: #x] #y normalize nodelta #EQ <EQ cases j normalize nodelta
1064                    [1,4,7: *)
1065                 
1066  ]       
1067| normalize nodelta % [ % [ % [ % [ % [ % [ % [ % [ % ]]]]]]]]
1068  [ #i cases i
1069    [ #Hi @⊥ @(absurd … Hi) @not_le_Sn_O
1070    | -i #i #Hi #Hj @⊥ @(absurd … Hi) @not_le_Sn_O
1071    ]
1072  | >lookup_insert_hit @refl
1073  | >lookup_insert_hit @refl
1074  | #i #Hi <(le_n_O_to_eq … Hi)
1075    >lookup_insert_hit cases (bvt_lookup … (bitvector_of_nat ? 0) (\snd old_sigma) 〈0,short_jump〉)
1076    #a #b normalize nodelta %2 @refl
1077  | #i cases i
1078    [ #Hi @⊥ @(absurd … Hi) @not_le_Sn_O
1079    | -i #i #Hi @⊥ @(absurd … Hi) @not_le_Sn_O
1080    ]
1081  | #_ %
1082  | #_ #i #Hi <(le_n_O_to_eq … Hi) >lookup_insert_hit
1083    (* USE: 0 ↦ 0 (from old_sigma) *)
1084    @(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (pi2 ?? old_sigma)))))
1085  | #i cases i
1086    [ #Hi2 @conj
1087      [ #Hi @⊥ @(absurd ? Hi) @le_to_not_lt / by /
1088      | >lookup_opt_insert_hit #H destruct (H)
1089      ]
1090    | -i #i #Hi2 @conj
1091      [ #Hi >lookup_opt_insert_miss
1092        [ / by refl/
1093        | @bitvector_of_nat_abs
1094          [ @Hi2
1095          | / by /
1096          | @sym_neq @lt_to_not_eq / by /
1097          ]
1098        ]
1099      | #_ @le_S_S @le_O_n
1100      ]
1101    ]
1102  | >lookup_insert_hit (* USE: 0 ↦ 0 (from old_sigma) *)
1103    >(proj2 ?? (proj1 ?? (proj1 ?? (proj1 ?? (pi2 ?? old_sigma))))) <plus_n_O %
1104  | #i cases i
1105    [ #Hi @⊥ @(absurd … Hi) @not_le_Sn_O
1106    | -i #i #Hi @⊥ @(absurd … Hi) @not_le_Sn_O
1107    ]
1108  ]
1109]
1110qed.
Note: See TracBrowser for help on using the repository browser.