-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbug_9268.v
46 lines (31 loc) · 1.01 KB
/
bug_9268.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From Stdlib Require Import ZArith.
From Stdlib Require Import Lia.
Local Open Scope Z_scope.
Definition Register := Z%type.
Definition Opcode := Z%type.
Inductive InstructionI : Type
:= Lb : Register -> Register -> Z -> InstructionI
| InvalidI : InstructionI.
Inductive Instruction : Type
:= IInstruction : InstructionI -> Instruction.
Definition funct3_LB : Z := 0.
Definition opcode_LOAD : Opcode := 3.
Set Universe Polymorphism.
Definition MachineInt := Z.
Definition funct3_JALR := 0.
Axiom InstructionMapper: Type -> Type.
Definition apply_InstructionMapper(mapper: InstructionMapper Z)(inst: Instruction): Z :=
match inst with
| IInstruction InvalidI => 2
| IInstruction (Lb rd rs1 oimm12) => 3
end.
Axiom Encoder: InstructionMapper MachineInt.
Definition encode: Instruction -> MachineInt := apply_InstructionMapper Encoder.
Lemma foo: forall (ins: InstructionI),
0 <= encode (IInstruction ins) ->
0 <= encode (IInstruction ins) .
Proof.
Set Printing Universes.
intros.
lia.
Qed.