Changeset 414
- Timestamp:
- Dec 13, 2010, 6:03:05 PM (9 years ago)
- Location:
- Deliverables/D4.1/Matita
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D4.1/Matita/Assembly.ma
r410 r414 430 430 let 〈name, size〉 ≝ preamble in 431 431 let addr_sixteen ≝ bitvector_of_nat sixteen addr in 432 〈insert ? ? addr_sixteen namedatalabels, addr + size〉)432 〈insert ? ? (bitvector_of_string ? name) addr_sixteen datalabels, addr + size〉) 433 433 〈(Stub ? ?), Z〉 preamble in 434 434 let 〈pc_labels, costs〉 ≝ … … 440 440 [ Instruction instr ⇒ 441 441 let code_memory ≝ load_code_memory (assembly1 instr) in 442 let 〈instr_pc', ignore〉 442 let 〈instr_pc', ignore〉 ≝ fetch code_memory (zero sixteen) in 443 443 let 〈instr', program_counter'〉 ≝ instr_pc' in 444 444 let program_counter_n' ≝ nat_of_bitvector ? program_counter' in … … 446 446 | Label label ⇒ 447 447 let program_counter_bv ≝ bitvector_of_nat sixteen program_counter in 448 〈〈program_counter, (insert ? ? program_counter_bv labellabels)〉, costs〉448 〈〈program_counter, (insert ? ? (bitvector_of_string ? label) program_counter_bv labels)〉, costs〉 449 449 | Cost cost ⇒ 450 450 let program_counter_bv ≝ bitvector_of_nat sixteen program_counter in … … 479 479 | Call call ⇒ 480 480 let pc_offset ≝ lookup ? ? (bitvector_of_string ? call) labels (zero ?) in 481 let address ≝ ADDR16 (bitvector_of_nat sixteen pc_offset) in 482 assembly1 (LCALL address) 483 | _ ⇒ ? 481 let address ≝ ADDR16 pc_offset in 482 assembly1 (LCALL ? address) 483 | Mov d trgt ⇒ 484 let pc_offset ≝ lookup ? ? (bitvector_of_string ? trgt) datalabels (zero ?) in 485 let address ≝ DATA16 pc_offset in 486 assembly1 (MOV ? (Right ? ?(Right ? ? (Right ? ? (Right ? ? (Right ? ? 〈DPTR, address〉)))))) 487 | Instruction instr ⇒ ? 488 | Jmp jmp ⇒ 489 let pc_offset ≝ lookup ? ? (bitvector_of_string ? jmp) labels (zero ?) in 490 let address ≝ ADDR16 pc_offset in 491 assembly1 (LJMP ? address) 492 | WithLabel jmp ⇒ ? 484 493 ] 485 494 ) instr_list -
Deliverables/D4.1/Matita/Map.ma
r410 r414 1 1 include "Universes.ma". 2 2 include "Compare.ma". 3 include "Maybe.ma". 3 4 4 5 ninductive Map (A: Type[0]) (B: Type[0]): Type[0] ≝ … … 7 8 | Node: A → B → Map A B → Map A B → Map A B. 8 9 10 (* Greater than or equal to the right, less than to the left. *) 11 9 12 nlet rec insert (A: Type[0]) (B: Type[0]) 10 (key: A) (f: A → A → Compare) (value: B) (map: Map A B) ≝13 (key: A) (f: A → A → Compare) (value: B) (map: Map A B) on map ≝ 11 14 match map with 12 [ Empty ⇒ Leaf key value15 [ Empty ⇒ Leaf … key value 13 16 | Leaf key' value' ⇒ 14 17 match f key key' with 15 [ Equal ⇒ ?16 | Less ⇒ ?17 | Greater ⇒ ?18 [ Equal ⇒ Node … key' value' (Empty …) (Leaf … key value) 19 | Less ⇒ Node … key' value' (Leaf … key value) (Empty …) 20 | Greater ⇒ Node … key' value' (Empty …) (Leaf … key value) 18 21 ] 19 | Node key' value' ⇒22 | Node key' value' left right ⇒ 20 23 match f key key' with 21 [ Equal ⇒ ?22 | Less ⇒ ?23 | Greater ?24 [ Equal ⇒ Node A B key' value' left (insert A B key f value right) 25 | Less ⇒ Node A B key' value' (insert A B key f value left) right 26 | Greater ⇒ Node A B key' value' left (insert A B key f value right) 24 27 ] 25 28 ]. 29 30 nlet rec lookup (A: Type[0]) (B: Type[0]) 31 (key: A) (f: A → A → Compare) (map: Map A B) on map ≝ 32 match map with 33 [ Empty ⇒ Nothing ? 34 | Leaf key' value' ⇒ 35 match f key key' with 36 [ Equal ⇒ Just ? value' 37 | _ ⇒ Nothing ? 38 ] 39 | Node key' value' left right ⇒ 40 match f key key' with 41 [ Equal ⇒ Just ? value' 42 | Less ⇒ lookup A B key f left 43 | Greater ⇒ lookup A B key f right 44 ] 45 ]. -
Deliverables/D4.1/Matita/String.ma
r329 r414 1 1 include "Char.ma". 2 2 include "List.ma". 3 include "Compare.ma". 3 4 4 5 ndefinition String ≝ List Char. 6 7 naxiom string_lexicographic_ordering: String → String → Compare. -
Deliverables/D4.1/Matita/depends
r410 r414 9 9 DoTest.ma Assembly.ma Interpret.ma Test.ma 10 10 ASM.ma BitVector.ma Either.ma String.ma 11 Map.ma Compare.ma Maybe.ma Universes.ma 11 12 Fetch.ma ASM.ma Arithmetic.ma BitVectorTrie.ma 12 13 Char.ma Universes.ma … … 15 16 Connectives.ma Plogic/equality.ma 16 17 Bool.ma Universes.ma 17 Assembly.ma ASM.ma Arithmetic.ma BitVectorTrie.ma Fetch.ma Status.ma18 Assembly.ma ASM.ma Arithmetic.ma BitVectorTrie.ma Fetch.ma Map.ma Status.ma 18 19 List.ma Maybe.ma Util.ma 19 20 Interpret.ma Fetch.ma Status.ma 20 21 Util.ma Nat.ma 22 Compare.ma Universes.ma 21 23 BitVector.ma String.ma Vector.ma 22 24 String.ma Char.ma List.ma
Note: See TracChangeset
for help on using the changeset viewer.