-2

I am having problem in representing a system of linear equations on Isabelle/HOL. I suppose I should simply write some equations jointed by "\and" but I have problem with type declaration for functions (+, *, -), coefficients, variables.

Can somebody help me in clarifying the type declarations for linear equations? In very simple terms and with examples, if possible! Thanks!

Kowmei
  • 1

1 Answers1

0

Without knowing more details on what you want to achieve, it is hard to answer.

  1. You are reasoning with linear equations, then you just write them down (if your variables are of type real, then + has type real => real => real).

  2. You are reasoning about linear equations, then you need to define a deep embedding of linear equations and an abstract model of them (e.g., you consider them as matrix of coefficients and have a function giving each variable a value and you check that the result matches your expectations).

Distinguishing 1 from 2 is a very basic question. I would recommend reading the prog-prove. While it is not about linear equations, you have the same duality: you can write functions (programs) in Isabelle or define a semantics to reason about functions in Isabelle.

If you are trying to achieve the simpler 1... you need an Isabelle tutorial like the prog-prove.

Mathias Fleury
  • 2,221
  • 5
  • 12
  • Thank you very much for your answer. First, I simply want to reason with linear equations, by building a system of them and seeing how to calculate its solutions in Isabelle. Then I could try to use the matrix form and doing e.g. Gauss. However, if I simply try to write an equation e.g. a + x - 3 y + z = 2, Isabelle complains stating that "Type unification failed: No type arity fun :: numeral . Type error in application: operator not of function type. Operator: 3 :: ??'a . Operand: y :: ??'b". The problem is not solved by assigning type real to each item. – Kowmei May 29 '23 at 15:15
  • you need to write out multiplication. So 3*y. Otherwise, Isabelle is looking for a function called '3'. – Mathias Fleury May 30 '23 at 16:02